Ocean
Ocean::ConeT3< T > Class Template Reference

This class implements a (possibly truncated) 3D cone. More...

Public Member Functions

 ConeT3 ()=default
 Creates an invalid cone. More...
 
 ConeT3 (const VectorT3< T > &apex, const VectorT3< T > &axis, const T apexAngle, const T minSignedDistanceAlongAxis=T(0.0), const T maxSignedDistanceAlongAxis=std::numeric_limits< T >::infinity())
 Defines a new cone. More...
 
const VectorT3< T > & apex () const
 Returns the tip of the cone. More...
 
const VectorT3< T > & axis () const
 Returns the unit-length axis of the cone. More...
 
apexAngle () const
 Returns the angle made between diametrically opposite points on the cone and the apex. More...
 
const T & minSignedDistanceAlongAxis () const
 Returns the minimum signed truncation distance along the cone's axis. More...
 
const T & maxSignedDistanceAlongAxis () const
 Returns the maximum signed truncation distance along the cone's 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 cone, ignoring intersections with the cone's base and intersections that 1) exit the cone or 2) are a negative signed distance along the ray. More...
 
bool isValid () const
 Returns whether this cone is valid. More...
 

Protected Attributes

VectorT3< T > apex_ = VectorT3<T>(T(0), T(0), T(0))
 Cone tip. More...
 
VectorT3< T > axis_ = VectorT3<T>(T(0), T(0), T(0))
 Cone axis, a unit vector. More...
 
cosSquaredHalfApexAngle_ = T(0)
 Cosine-squared of half of the cone's apex angle. More...
 
minSignedDistanceAlongAxis_ = T(0)
 Minimum signed truncation distance along the cone's axis. More...
 
maxSignedDistanceAlongAxis_ = T(0)
 Maximum signed truncation distance along the cone's axis. More...
 

Detailed Description

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

This class implements a (possibly truncated) 3D cone.

Constructor & Destructor Documentation

◆ ConeT3() [1/2]

template<typename T >
Ocean::ConeT3< T >::ConeT3 ( )
default

Creates an invalid cone.

◆ ConeT3() [2/2]

template<typename T >
Ocean::ConeT3< T >::ConeT3 ( const VectorT3< T > &  apex,
const VectorT3< T > &  axis,
const T  apexAngle,
const T  minSignedDistanceAlongAxis = T(0.0),
const T  maxSignedDistanceAlongAxis = std::numeric_limits<T>::infinity() 
)
inline

Defines a new cone.

Parameters
apex3D coordinate for the tip of the cone
axisDirection vector of the cone's axis, expected to already be normalized to unit length
apexAngleAngle in radians formed at the apex by any vertical slice of the cone through its apex, must be in (0, pi)
minSignedDistanceAlongAxisFor a truncated cone, the minimum signed distance along the cone's axis at which the cones stops, defaults to the apex of the cone (distance = 0); for an infinite cone, set the minimum radius to -infinity
maxSignedDistanceAlongAxisFor a truncated cone, the maximum signed distance along the cone's axis at which the cone stops; note that only horizontal slices (perpendicular to its axis) through the cone are supported

Member Function Documentation

◆ apex()

template<typename T >
const VectorT3< T > & Ocean::ConeT3< T >::apex
inline

Returns the tip of the cone.

Returns
Cone apex

◆ apexAngle()

template<typename T >
T Ocean::ConeT3< T >::apexAngle
inline

Returns the angle made between diametrically opposite points on the cone and the apex.

Returns
Cone's apex angle in radians, in range (0, pi)

◆ axis()

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

Returns the unit-length axis of the cone.

Returns
Cone axis

◆ isValid()

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

Returns whether this cone is valid.

Returns
True, if so

◆ maxSignedDistanceAlongAxis()

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

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

Returns
Distance value, with range (minSignedDistanceAlongAxis, infinity)

◆ minSignedDistanceAlongAxis()

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

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

If the cone ends at its apex, the value is zero; otherwise, the value is simply less than maxSignedDistanceAlongAxis.

Returns
Distance value, with range (-infinity, maxSignedDistanceAlongAxis)

◆ nearestIntersection()

template<typename T >
bool Ocean::ConeT3< 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 cone, ignoring intersections with the cone's base and intersections that 1) exit the cone 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, otherwise false

Field Documentation

◆ apex_

template<typename T >
VectorT3<T> Ocean::ConeT3< T >::apex_ = VectorT3<T>(T(0), T(0), T(0))
protected

Cone tip.

◆ axis_

template<typename T >
VectorT3<T> Ocean::ConeT3< T >::axis_ = VectorT3<T>(T(0), T(0), T(0))
protected

Cone axis, a unit vector.

◆ cosSquaredHalfApexAngle_

template<typename T >
T Ocean::ConeT3< T >::cosSquaredHalfApexAngle_ = T(0)
protected

Cosine-squared of half of the cone's apex angle.

◆ maxSignedDistanceAlongAxis_

template<typename T >
T Ocean::ConeT3< T >::maxSignedDistanceAlongAxis_ = T(0)
protected

Maximum signed truncation distance along the cone's axis.

◆ minSignedDistanceAlongAxis_

template<typename T >
T Ocean::ConeT3< T >::minSignedDistanceAlongAxis_ = T(0)
protected

Minimum signed truncation distance along the cone's axis.


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