Ocean
Ocean::CylinderT3< T > Class Template Reference

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...
 
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...
 
radius_
 Radius of the cylinder. More...
 
minSignedDistanceAlongAxis_
 Minimum signed truncation distance along the cone's axis. More...
 
maxSignedDistanceAlongAxis_
 Maximum signed truncation distance along the cone's axis. More...
 

Detailed Description

template<typename T>
class Ocean::CylinderT3< T >

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.

Constructor & Destructor Documentation

◆ CylinderT3() [1/3]

template<typename T >
Ocean::CylinderT3< T >::CylinderT3
inline

Creates an invalid cylinder.

◆ CylinderT3() [2/3]

template<typename T >
Ocean::CylinderT3< T >::CylinderT3 ( const VectorT3< T > &  origin,
const VectorT3< T > &  axis,
const T  radius,
const T  height 
)
inline

Defines a new cylinder with a base along its axis at distance = 0 and with the specified height (positive distance along the axis).

Parameters
origin3D coordinate for the center of the base of the cylinder
axisDirection vector of the cylinder's axis, expected to already be normalized to unit length
radiusRadius of the cylinder, with range (0, infinity)
heightThe height of the cylinder, with range [0, infinity]

◆ CylinderT3() [3/3]

template<typename T >
Ocean::CylinderT3< T >::CylinderT3 ( const VectorT3< T > &  origin,
const VectorT3< T > &  axis,
const T  radius,
const T  minSignedDistanceAlongAxis,
const T  maxSignedDistanceAlongAxis 
)
inline

Defines a new cylinder.

Parameters
origin3D coordinate for the center of the base of the cylinder
axisDirection vector of the cylinder's axis, expected to already be normalized to unit length
radiusRadius of the cylinder, with range (0, infinity)
minSignedDistanceAlongAxisSigned distance along the axis for the bottom of the cylinder, with range [-infinity, maxSignedDistanceAlongAxis]
maxSignedDistanceAlongAxisSigned distance along the axis for the top of the cylinder, with range [minSignedDistanceAlongAxis, infinity]

Member Function Documentation

◆ axis()

template<typename T >
const VectorT3< T > & Ocean::CylinderT3< T >::axis
inline

Returns the unit-length axis of the cylinder.

Returns
Cylinder axis

◆ height()

template<typename T >
T Ocean::CylinderT3< T >::height
inline

Returns the length of the cylinder along its axis.

Returns
Cylinder's height, with range [0, infinity]

◆ isValid()

template<typename T >
bool Ocean::CylinderT3< T >::isValid
inline

Returns whether this cylinder is valid.

Returns
True, if so

◆ maxSignedDistanceAlongAxis()

template<typename T >
const T & Ocean::CylinderT3< T >::maxSignedDistanceAlongAxis
inline

Returns the maximum signed truncation distance along the cylinder's axis.

Returns
Distance value, with range [minSignedDistanceAlongAxis, infinity]

◆ minSignedDistanceAlongAxis()

template<typename T >
const T & Ocean::CylinderT3< T >::minSignedDistanceAlongAxis
inline

Returns the minimum signed truncation distance along the cylinder's axis.

Returns
Distance value, with range [-infinity, maxSignedDistanceAlongAxis]

◆ nearestIntersection()

template<typename T >
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.

Parameters
rayRay for which to find the intersection, must be valid
pointOutput 3D point of intersection
Returns
True if the computed intersection point is valid, otherwie false

◆ origin()

template<typename T >
const VectorT3< T > & Ocean::CylinderT3< T >::origin
inline

Returns the center of the cylinder's base.

Returns
Cylinder origin

◆ radius()

template<typename T >
const T & Ocean::CylinderT3< T >::radius
inline

Returns the radius of the cylinder.

Returns
Cylinder radius, with range (0, infinity)

Field Documentation

◆ axis_

template<typename T >
VectorT3<T> Ocean::CylinderT3< T >::axis_
protected

Cylinder axis, a unit vector.

◆ maxSignedDistanceAlongAxis_

template<typename T >
T Ocean::CylinderT3< T >::maxSignedDistanceAlongAxis_
protected

Maximum signed truncation distance along the cone's axis.

◆ minSignedDistanceAlongAxis_

template<typename T >
T Ocean::CylinderT3< T >::minSignedDistanceAlongAxis_
protected

Minimum signed truncation distance along the cone's axis.

◆ origin_

template<typename T >
VectorT3<T> Ocean::CylinderT3< T >::origin_
protected

Center of the cylinder's base.

◆ radius_

template<typename T >
T Ocean::CylinderT3< T >::radius_
protected

Radius of the cylinder.


The documentation for this class was generated from the following file: