|
|
| Capsule () |
| | Empty.
|
| | Capsule (const Vector &, const Vector &, const double &) |
| | Creates a capsule.
|
|
| ~Capsule () |
| | Empty.
|
| bool | Inside (const Vector &) const |
| | Check if a point is inside the capsule.
|
| double | R (const Vector &) const |
| | Computes the squared distance between a point and the capsule.
|
| double | Signed (const Vector &) const |
| | Computes the signed distance between a point and the capsule.
|
| bool | Intersect (const Ray &) const |
| | Check the intersection between a capsule and a ray.
|
| int | Intersect (const Ray &, double &, double &) const |
| | Compute the intersections between a capsule and a ray.
|
| int | Intersect (const Ray &, double &, double &, Vector &, Vector &) const |
| | Compute the intersections between a capsule and a ray.
|
| int | Intersect (const Ray &, double &, Vector &) const |
| | Compute the first positive intersection between a capsule and a ray.
|
| double | R (const Capsule &, double &, double &) const |
| | Computes the squared distance between two capsules.
|
| bool | Intersect (const Capsule &, double &, double &) const |
| | Check if two capsules intersect.
|
| Capsule | Rotated (const Matrix &) const |
| | Return a capsule rotated by a given matrix.
|
| Capsule | Translated (const Vector &) const |
| | Return a capsule translated by a given vector.
|
| Capsule | Scaled (const double &) const |
| | Return a scaled capsule.
|
| Capsule | Transformed (const Frame &) const |
| | Return a capsule transformed by a frame.
|
| Box | GetBox () const |
| | Computes the tight bounding box of the capsule.
|
|
double | Volume () const |
| | Compute the volume.
|
|
double | Area () const |
| | Compute the surface area.
|
|
double | Radius () const |
| | Gets the radius of a cylinder.
|
|
|
| Cylinder () |
| | Empty.
|
| | Cylinder (const Vector &, const Vector &, const double &) |
| | Creates a cylinder.
|
| | Cylinder (const double &, const double &, const double &=1.0) |
| | Creates a vertical cylinder.
|
| | Cylinder (const Vector &, const double &, const double &=1.0) |
| | Creates a vertical cylinder.
|
| | Cylinder (const Circle &, const double &, bool=false) |
| | Create a vertical cylinder as an extruded circle.
|
| | Cylinder (const Box &, const Axis &) |
| | Creates the boudning cylinder embedding a box rotated around an axis.
|
|
| ~Cylinder () |
| | Empty.
|
|
double | Radius () const |
| | Gets the radius of a cylinder.
|
| int | Intersect (const Ray &, double &, double &) const |
| | Compute the intersection between a cylinder and a ray.
|
| int | Intersect (const Ray &, double &, double &, Vector &, Vector &) const |
| | Compute the intersections between a cylinder and a ray.
|
| int | Intersect (const Ray &, double &, Vector &) const |
| | Compute the first positive intersection between a cylinder and a ray.
|
| bool | Intersect (const Ray &) const |
| | Check the intersection between a cylinder and a ray.
|
| bool | Inside (const Vector &) const |
| | Check if a point is inside or outside the cylinder.
|
|
double | Volume () const |
| | Computes the volume of a cylinder.
|
|
double | Area () const |
| | Computes the surface area of a cylinder.
|
| void | Scale (const double &) |
| | Uniformly scales a cylinder.
|
| Cylinder | Transformed (const FrameScaled &) const |
| | Transformed cylinder.
|
| Vector | RandomInside (Random &=Random::R239) const |
| | Generate a random vector inside the cylinder.
|
| Box | GetBox () const |
| | Computes the axis-aligned bounding box of a cylinder.
|
| Cylinder | Rotated (const Matrix &) const |
| | Return a cylinder rotated by a given matrix.
|
| Cylinder | Translated (const Vector &) const |
| | Return a cylinder translated by a given vector.
|
| Cylinder | Scaled (const double &) const |
| | Return a scaled cylinder.
|
| double | R (const Vector &) const |
| | Squared distance between a point and the cylinder.
|
| double | R (const Vector &, double &) const |
| | Computes the squared distance between a point and the cylinder.
|
| double | Signed (const Vector &) const |
| | Signed Euclidean distance between a point and a cylinder.
|
| Vector | Normal (const Vector &) const |
| | Compute the normal vector to a cylinder.
|
| Vector | SignedNormal (const Vector &) const |
| | Compute the normal vector to the surface of the cylinder.
|
|
Vector | Vertex (int) const |
| | Return one of the end vertexes of the axis.
|
| double | Radial (const Vector &, Vector &, Vector &) const |
| | Compute the radial coordinates of a point.
|
|
| Axis () |
| | Empty.
|
| | Axis (const Vector &, const Vector &) |
| | Creates an axis given end vertices.
|
|
| ~Axis () |
| | Empty.
|
| void | Rotate (const Matrix &) |
| | Rotates an axis.
|
| void | Translate (const Vector &) |
| | Translates an axis.
|
| void | Scale (const double &) |
| | Uniformly scales an axis.
|
| void | Scale (const Vector &) |
| | Scales an axis.
|
| Quadric | Equation (const Ray &) const |
| | Compute the polynomial equation of the Euclidean distance between a ray and the axis.
|
|
Vector | Vertex (int) const |
| | Return one of the end vertexes of the axis.
|
|
Vector | Point (const double &) const |
| | Compute a point on the axis.
|
|
Vector | GetAxis () const |
| | Returns the normalized axis vector.
|
|
double | Length () const |
| | Return the axis length.
|
| Vector | Symmetric (const Vector &) const |
| | Symmetric point.
|
| Sphere | Symmetric (const Sphere &) const |
| | Symmetric sphere.
|
| Vector | Normal (const Vector &) const |
| | Compute the normal vector between a point and its projection onto the edge.
|
| double | R (const Vector &) const |
| | Compute the squared distance to the segment.
|
| double | R (const Axis &) const |
| | Compute the squared distance between two axes.
|
| double | R (const Vector &, double &) const |
| | Compute the squared distance to the axis.
|
| Matrix | GetFrame () const |
| | Compute an orthonormal frame attached to the axis.
|
| Vector2 | Radial (const Vector &) const |
| | Compute the radial coordinates of a point.
|
| static Vector2 | Cast (const Vector &) |
| | Computes the inverse mapping of a point.
|
| static Matrix | GetFrame (const Vector &) |
| | Compute an orthonormal frame attached to the axis.
|
| static Vector | BoxVector (const Vector &) |
| | Compute the box vector extent of a unit circle with a given axis.
|
|
double | r = 1.0 |
| | Radius.
|
|
Vector | b = Vector::Z |
| | End vertexes of the axis.
|
|
Vector | axis = Vector::Z |
| | Normalized axis vector.
|
|
double | length = 1.0 |
| | Length of the axis.
|
|
static const double | epsilon = 1.0e-4 |
| | Epsilon value for intersection tests.
|
|
static const Cylinder | Unit |
| | Unit vertical cylinder.
|
|
static const Axis | Z |
| | Axes from origin, identical to Axis(Vector::Null,Vector::X) ...
|
A line-swept-sphere.
Capsules, which are line-swept-spheres, make good bounding volumes. The function Intersect(const Capsule&, double&, double&) detects the intersection between two capsules by comparing the squared distance between their segments, computed by R(const Capsule&, double&, double&), with the squared sum of their radii.
Note that capsule-ray intersection member function assumes that the ray direction is normalized.
| double Capsule::R |
( |
const Capsule & | cs, |
|
|
double & | u, |
|
|
double & | v ) const |
Computes the squared distance between two capsules.
The function computes the squared distance between the segments of the two capsules, using the closest point algorithm described by Christer Ericson, Real-Time Collision Detection, Morgan Kaufmann, 2005 (Section 5.1.9, Closest points of two line segments). The closest point on the first segment to the line of the second segment is computed and clamped, then the closest point on the second segment is computed, and the first one is updated if the second had to be clamped. Parallel segments and segments reduced to a point are handled without any threshold.
The algorithm by David Eberly (Distance between two line segments, Geometric Tools), based on the classification of the regions of the parameter domain, is not used: its parallel case requires a threshold, and it is not exact for nearly parallel segments.
The result is exact up to rounding errors, except for nearly parallel segments whose angle is lower than about \( 10^{-7} \) radians, where the error is of the order of that angle.
- Parameters
-
| cs | The other capsule. |
| u,v | Parameters in [0,1] of the closest points on the segments of the two capsules, where the minimum distance occurs. |