Ocean
|
This class implements a 3D cylinder defined by its origin, axis, radius, and (signed) starting and stopping points along its axis. More...
Public Member Functions | |
CylinderT3 () | |
Creates an invalid cylinder. More... | |
CylinderT3 (const VectorT3< T > &origin, const VectorT3< T > &axis, const T radius, const T height) | |
Defines a new cylinder with a base along its axis at distance = 0 and with the specified height (positive distance along the axis). More... | |
CylinderT3 (const VectorT3< T > &origin, const VectorT3< T > &axis, const T radius, const T minSignedDistanceAlongAxis, const T maxSignedDistanceAlongAxis) | |
Defines a new cylinder. More... | |
const VectorT3< T > & | origin () const |
Returns the center of the cylinder's base. More... | |
const VectorT3< T > & | axis () const |
Returns the unit-length axis of the cylinder. More... | |
const T & | radius () const |
Returns the radius of the cylinder. More... | |
const T & | minSignedDistanceAlongAxis () const |
Returns the minimum signed truncation distance along the cylinder's axis. More... | |
const T & | maxSignedDistanceAlongAxis () const |
Returns the maximum signed truncation distance along the cylinder's axis. More... | |
T | height () const |
Returns the length of the cylinder along its axis. More... | |
bool | nearestIntersection (const LineT3< T > &ray, VectorT3< T > &point) const |
Returns the closest point of intersection of a ray with the outer surface of the cylinder, ignoring intersections with the cylinder's base and intersections that 1) exit the cylinder or 2) are a negative signed distance along the ray. More... | |
bool | isValid () const |
Returns whether this cylinder is valid. More... | |
Protected Attributes | |
VectorT3< T > | origin_ |
Center of the cylinder's base. More... | |
VectorT3< T > | axis_ |
Cylinder axis, a unit vector. More... | |
T | radius_ |
Radius of the cylinder. More... | |
T | minSignedDistanceAlongAxis_ |
Minimum signed truncation distance along the cone's axis. More... | |
T | maxSignedDistanceAlongAxis_ |
Maximum signed truncation distance along the cone's axis. More... | |
This class implements a 3D cylinder defined by its origin, axis, radius, and (signed) starting and stopping points along its axis.
Consider a finite right cylinder, consisting of (1) two circular endcaps that lie in parallel planes and (2) the curved surface connecting the endcaps. Let one of these endcaps be the "bottom base" and the other endcap be the "top base" of the cylinder. The cylinder axis is the unit vector pointing from the center of the bottom base to the center of the top base. Since we are considering a right (i.e., non-oblique) cylinder, each cylinder base is perpendicular to the axis.
Each cylinder has a 4DOF coordinate frame consisting of the line through its axis in 3D space. The cylinder origin can be defined using any 3D point lying on this line. The 3D center point of each cylinder base also lies on this line, at a fixed 1D distance along the line from the cylinder origin: bottom = origin + minSignedDistance * axis, top = origin + maxSignedDistance * axis.
The cylinder radius, r, is defined as the radius of the two circular endcaps. For any 3D point X lying on the cylinder surface between the endcaps, the distance to the nearest point on the cylinder center-line is r.
Note that the origin does not need to lie within the cylinder. Infinite cylinders (without endcaps) and half-infinite cylinders (with only one endcap) are also allowed.
Currently, cylinder-ray intersection checking is only supported for portion of the cylinder between its endcaps. Ray intersections with cylinder endcaps are not computed.
|
inline |
Creates an invalid cylinder.
|
inline |
Defines a new cylinder with a base along its axis at distance = 0 and with the specified height (positive distance along the axis).
origin | 3D coordinate for the center of the base of the cylinder |
axis | Direction vector of the cylinder's axis, expected to already be normalized to unit length |
radius | Radius of the cylinder, with range (0, infinity) |
height | The height of the cylinder, with range [0, infinity] |
|
inline |
Defines a new cylinder.
origin | 3D coordinate for the center of the base of the cylinder |
axis | Direction vector of the cylinder's axis, expected to already be normalized to unit length |
radius | Radius of the cylinder, with range (0, infinity) |
minSignedDistanceAlongAxis | Signed distance along the axis for the bottom of the cylinder, with range [-infinity, maxSignedDistanceAlongAxis] |
maxSignedDistanceAlongAxis | Signed distance along the axis for the top of the cylinder, with range [minSignedDistanceAlongAxis, infinity] |
|
inline |
Returns the unit-length axis of the cylinder.
|
inline |
Returns the length of the cylinder along its axis.
|
inline |
Returns whether this cylinder is valid.
|
inline |
Returns the maximum signed truncation distance along the cylinder's axis.
|
inline |
Returns the minimum signed truncation distance along the cylinder's axis.
bool Ocean::CylinderT3< T >::nearestIntersection | ( | const LineT3< T > & | ray, |
VectorT3< T > & | point | ||
) | const |
Returns the closest point of intersection of a ray with the outer surface of the cylinder, ignoring intersections with the cylinder's base and intersections that 1) exit the cylinder or 2) are a negative signed distance along the ray.
ray | Ray for which to find the intersection, must be valid |
point | Output 3D point of intersection |
|
inline |
Returns the center of the cylinder's base.
|
inline |
Returns the radius of the cylinder.
|
protected |
Cylinder axis, a unit vector.
|
protected |
Maximum signed truncation distance along the cone's axis.
|
protected |
Minimum signed truncation distance along the cone's axis.
|
protected |
Center of the cylinder's base.
|
protected |
Radius of the cylinder.