本文整理汇总了C++中Cylinder::radius方法的典型用法代码示例。如果您正苦于以下问题:C++ Cylinder::radius方法的具体用法?C++ Cylinder::radius怎么用?C++ Cylinder::radius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cylinder
的用法示例。
在下文中一共展示了Cylinder::radius方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dz
inline typename Cylinder<T_>::length_type
distance(Cylinder<T_> const& obj,
typename Cylinder<T_>::position_type const& pos)
{
typedef typename Cylinder<T_>::position_type position_type;
typedef typename Cylinder<T_>::length_type length_type;
/* First compute the (z,r) components of pos in a coordinate system
* defined by the vectors unitR and unit_z, where unitR is
* choosen such that unitR and unit_z define a plane in which
* pos lies. */
const std::pair<length_type, length_type> r_z(to_internal(obj, pos));
/* Then compute distance to cylinder. */
const length_type dz(std::fabs(r_z.second) - obj.half_length());
const length_type dr(r_z.first - obj.radius());
length_type distance;
if (dz > 0)
{
// pos is (either) to the right or to the left of the cylinder.
if (r_z.first > obj.radius())
{
// Compute distance to edge.
distance = std::sqrt( dz * dz + dr * dr );
}
else
{
distance = dz;
}
}
else
{
if (dr > obj.radius())
{
// pos is somewhere 'parallel' to the cylinder.
distance = dr;
}
else
{
// Inside cylinder.
distance = std::max(dr, dz);
}
}
return distance;
}
示例2: toWorldSpace
Cylinder CoordinateFrame::toWorldSpace(const Cylinder& c) const {
return Cylinder(
pointToWorldSpace(c.point(0)),
pointToWorldSpace(c.point(1)),
c.radius());
}
示例3:
bool operator==(const Cylinder& rhs) const
{
return position_ == rhs.position() && radius_ == rhs.radius() && unit_z_ == rhs.unit_z() && half_length_ == rhs.half_length();
}
示例4:
Cylinder::Cylinder(const Cylinder& rhs)
: center_(rhs.center()), radius_(rhs.radius()),
axis_(rhs.axis()), half_height_(rhs.half_height_)
{
;
}