Ocean
Ocean::FrustumT< T > Class Template Reference

This class implements a viewing frustum. More...

Public Types

enum  PlaneIds : unsigned int {
  PI_FRONT = 0u , PI_BACK = 1u , PI_LEFT = 2u , PI_RIGHT = 3u ,
  PI_TOP = 4u , PI_BOTTOM = 5u , PI_END = 6u
}
 Definition of ids for the individual planes of the frustum. More...
 
typedef T Type
 Definition of the used data type. More...
 

Public Member Functions

 FrustumT ()=default
 Default constructor creating an invalid frustum. More...
 
 FrustumT (const T width, const T height, const T focalLengthX, const T focalLengthY, const T principalPointX, const T principalPointY, const T nearDistance, const T farDistance)
 Creates a new viewing frustum, pointing towards the negative z-space with y-axis up. More...
 
 FrustumT (const PinholeCamera &pinholeCamera, const T nearDistance, const T farDistance)
 Creates a new viewing frustum from a camera, pointing towards the negative z-space with y-axis up. More...
 
 FrustumT (const AnyCameraT< T > &pinholeCamera, const T nearDistance, const T farDistance)
 Creates a new viewing frustum from a camera, pointing towards the negative z-space with y-axis up. More...
 
 FrustumT (const HomogenousMatrixT4< T > &world_T_camera, const T width, const T height, const T focalLengthX, const T focalLengthY, const T principalPointX, const T principalPointY, const T nearDistance, const T farDistance)
 Creates a new viewing frustum located anywhere in space. More...
 
 FrustumT (const HomogenousMatrixT4< T > &world_T_camera, const PinholeCamera &pinholeCamera, const T nearDistance, const T farDistance)
 Creates a new viewing frustum from a camera located anywhere in space. More...
 
 FrustumT (const HomogenousMatrixT4< T > &world_T_camera, const AnyCamera &pinholeCamera, const T nearDistance, const T farDistance)
 Creates a new viewing frustum from a camera located anywhere in space. More...
 
const PlaneT3< T > * planes () const
 Returns the six planes of the frustum, with order as defined in PlaneIds. More...
 
bool isInside (const VectorT3< T > &objectPoint) const
 Returns whether a 3D object point is inside this frustum. More...
 
bool isInside (const SphereT3< T > &sphere) const
 Returns whether a 3D sphere is located entirely inside this frustum. More...
 
bool isInside (const Box3 &box) const
 Returns whether a 3D box is located entirely inside this frustum. More...
 
bool isInside (const Vector3 *vertices, const size_t size) const
 Returns whether a 3D object is located entirely inside this frustum. More...
 
bool hasIntersection (const SphereT3< T > &sphere) const
 Returns whether a 3D sphere has an interaction with this frustum or is entirely inside this frustum. More...
 
bool hasIntersection (const Box3 &box) const
 Returns whether a 3D box has an interaction with this frustum or is entirely inside this frustum. More...
 
bool hasIntersection (const Vector3 *vertices, const size_t size) const
 Returns whether a 3D object has an interaction with this frustum or is entirely inside this frustum. More...
 
bool isValid () const
 Returns whether this frustum object is valid. More...
 
bool isEqual (const FrustumT< T > &frustum, const T eps=NumericT< T >::eps()) const
 Returns whether two frustum objects are equal up to a small epsilon. More...
 
bool operator== (const FrustumT< T > &frustum) const
 Returns whether two frustum objects are identical. More...
 
bool operator!= (const FrustumT< T > &frustum) const
 Returns whether two frustum objects are not identical. More...
 

Protected Attributes

PlaneT3< T > planes_ [PI_END]
 The six planes of the frustum. More...
 

Detailed Description

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

This class implements a viewing frustum.

The viewing frustum points towards the negative z-space with x-axis pointing towards the right plane of the frustum, and y-axis pointing towards the top plane of the frustum.

Template Parameters
TData type of the frustum elements.
See also
Frustum.

Member Typedef Documentation

◆ Type

template<typename T >
typedef T Ocean::FrustumT< T >::Type

Definition of the used data type.

Member Enumeration Documentation

◆ PlaneIds

template<typename T >
enum Ocean::FrustumT::PlaneIds : unsigned int

Definition of ids for the individual planes of the frustum.

Enumerator
PI_FRONT 

The front plane, with normal pointing into the frustum.

PI_BACK 

The back plane, with normal pointing into the frustum.

PI_LEFT 

The left plane, with normal pointing into the frustum.

PI_RIGHT 

The right plane, with normal pointing into the frustum.

PI_TOP 

The top plane, with normal pointing into the frustum.

PI_BOTTOM 

The bottom plane, with normal pointing into the frustum.

PI_END 

The number of planes.

Constructor & Destructor Documentation

◆ FrustumT() [1/7]

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

Default constructor creating an invalid frustum.

◆ FrustumT() [2/7]

template<typename T >
Ocean::FrustumT< T >::FrustumT ( const T  width,
const T  height,
const T  focalLengthX,
const T  focalLengthY,
const T  principalPointX,
const T  principalPointY,
const T  nearDistance,
const T  farDistance 
)

Creates a new viewing frustum, pointing towards the negative z-space with y-axis up.

Parameters
widthThe width of the camera image, in pixel, with range (0, infinity)
heightThe height of the camera image, in pixel, with range (0, infinity)
focalLengthXThe focal length of the camera in horizontal direction, in pixel domain, with range (0, infinity)
focalLengthYThe focal length of the camera in vertical direction, in pixel domain, with range (0, infinity)
principalPointXThe horizontal location of the camera's principal point, in pixel, with range (0, width)
principalPointYThe vertical location of the camera's principal point, in pixel, with range (0, height)
nearDistanceThe distance to the frustum's front plane, with range [0, infinity)
farDistanceThe distance to the frustum's back plane, with range (nearDistance, infinity)

◆ FrustumT() [3/7]

template<typename T >
Ocean::FrustumT< T >::FrustumT ( const PinholeCamera pinholeCamera,
const T  nearDistance,
const T  farDistance 
)
inline

Creates a new viewing frustum from a camera, pointing towards the negative z-space with y-axis up.

Parameters
pinholeCameraThe pinhole camera profile for which the frustum will be created, must be valid
nearDistanceThe distance to the frustum's front plane, with range [0, infinity)
farDistanceThe distance to the frustum's back plane, with range (nearDistance, infinity)

◆ FrustumT() [4/7]

template<typename T >
Ocean::FrustumT< T >::FrustumT ( const AnyCameraT< T > &  pinholeCamera,
const T  nearDistance,
const T  farDistance 
)
inline

Creates a new viewing frustum from a camera, pointing towards the negative z-space with y-axis up.

Parameters
pinholeCameraThe pinhole camera profile for which the frustum will be created, must be a pinhole camera, must be valid
nearDistanceThe distance to the frustum's front plane, with range [0, infinity)
farDistanceThe distance to the frustum's back plane, with range (nearDistance, infinity)

◆ FrustumT() [5/7]

template<typename T >
Ocean::FrustumT< T >::FrustumT ( const HomogenousMatrixT4< T > &  world_T_camera,
const T  width,
const T  height,
const T  focalLengthX,
const T  focalLengthY,
const T  principalPointX,
const T  principalPointY,
const T  nearDistance,
const T  farDistance 
)

Creates a new viewing frustum located anywhere in space.

Parameters
world_T_cameraThe transformation transforming the camera (pointing towards negative z-space with y-axis up) to world, must be valid
widthThe width of the camera image, in pixel, with range (0, infinity)
heightThe height of the camera image, in pixel, with range (0, infinity)
focalLengthXThe focal length of the camera in horizontal direction, in pixel domain, with range (0, infinity)
focalLengthYThe focal length of the camera in vertical direction, in pixel domain, with range (0, infinity)
principalPointXThe horizontal location of the camera's principal point, in pixel, with range (0, width)
principalPointYThe vertical location of the camera's principal point, in pixel, with range (0, height)
nearDistanceThe distance to the frustum's front plane, with range [0, infinity)
farDistanceThe distance to the frustum's back plane, with range (nearDistance, infinity)

◆ FrustumT() [6/7]

template<typename T >
Ocean::FrustumT< T >::FrustumT ( const HomogenousMatrixT4< T > &  world_T_camera,
const PinholeCamera pinholeCamera,
const T  nearDistance,
const T  farDistance 
)
inline

Creates a new viewing frustum from a camera located anywhere in space.

Parameters
world_T_cameraThe transformation transforming the camera (pointing towards negative z-space with y-axis up) to world, must be valid
pinholeCameraThe pinhole camera profile for which the frustum will be created, must be valid
nearDistanceThe distance to the frustum's front plane, with range [0, infinity)
farDistanceThe distance to the frustum's back plane, with range (nearDistance, infinity)

◆ FrustumT() [7/7]

template<typename T >
Ocean::FrustumT< T >::FrustumT ( const HomogenousMatrixT4< T > &  world_T_camera,
const AnyCamera pinholeCamera,
const T  nearDistance,
const T  farDistance 
)
inline

Creates a new viewing frustum from a camera located anywhere in space.

Parameters
world_T_cameraThe transformation transforming the camera (pointing towards negative z-space with y-axis up) to world, must be valid
pinholeCameraThe pinhole camera profile for which the frustum will be created, must be a pinhole camera, must be valid
nearDistanceThe distance to the frustum's front plane, with range [0, infinity)
farDistanceThe distance to the frustum's back plane, with range (nearDistance, infinity)

Member Function Documentation

◆ hasIntersection() [1/3]

template<typename T >
bool Ocean::FrustumT< T >::hasIntersection ( const Box3 box) const

Returns whether a 3D box has an interaction with this frustum or is entirely inside this frustum.

Parameters
boxThe box to check, must be valid
Returns
True, if so

◆ hasIntersection() [2/3]

template<typename T >
bool Ocean::FrustumT< T >::hasIntersection ( const SphereT3< T > &  sphere) const

Returns whether a 3D sphere has an interaction with this frustum or is entirely inside this frustum.

Parameters
sphereThe sphere to check, must be valid
Returns
True, if so

◆ hasIntersection() [3/3]

template<typename T >
bool Ocean::FrustumT< T >::hasIntersection ( const Vector3 vertices,
const size_t  size 
) const

Returns whether a 3D object has an interaction with this frustum or is entirely inside this frustum.

Parameters
verticesThe 3D vertices of the object to check, must be valid
sizeThe number of vertices, with range [1, infinity)
Returns
True, if so

◆ isEqual()

template<typename T >
bool Ocean::FrustumT< T >::isEqual ( const FrustumT< T > &  frustum,
const T  eps = NumericT<T>::eps() 
) const

Returns whether two frustum objects are equal up to a small epsilon.

Parameters
frustumThe second frustum to check
epsThe epsilon to be used, with range [0, infinity)
Returns
True, if so

◆ isInside() [1/4]

template<typename T >
bool Ocean::FrustumT< T >::isInside ( const Box3 box) const

Returns whether a 3D box is located entirely inside this frustum.

Parameters
boxThe box to check, must be valid
Returns
True, if so

◆ isInside() [2/4]

template<typename T >
bool Ocean::FrustumT< T >::isInside ( const SphereT3< T > &  sphere) const

Returns whether a 3D sphere is located entirely inside this frustum.

Parameters
sphereThe sphere to check, must be valid
Returns
True, if so

◆ isInside() [3/4]

template<typename T >
bool Ocean::FrustumT< T >::isInside ( const Vector3 vertices,
const size_t  size 
) const

Returns whether a 3D object is located entirely inside this frustum.

Parameters
verticesThe 3D vertices of the object to check, must be valid
sizeThe number of vertices, with range [1, infinity)
Returns
True, if so

◆ isInside() [4/4]

template<typename T >
bool Ocean::FrustumT< T >::isInside ( const VectorT3< T > &  objectPoint) const
inline

Returns whether a 3D object point is inside this frustum.

Parameters
objectPointThe 3D object point to check
Returns
True, if so

◆ isValid()

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

Returns whether this frustum object is valid.

◆ operator!=()

template<typename T >
bool Ocean::FrustumT< T >::operator!= ( const FrustumT< T > &  frustum) const
inline

Returns whether two frustum objects are not identical.

Parameters
frustumThe second frustum to check
Returns
True, if so

◆ operator==()

template<typename T >
bool Ocean::FrustumT< T >::operator== ( const FrustumT< T > &  frustum) const
inline

Returns whether two frustum objects are identical.

Parameters
frustumThe second frustum to check
Returns
True, if so

◆ planes()

template<typename T >
const PlaneT3< T > * Ocean::FrustumT< T >::planes
inline

Returns the six planes of the frustum, with order as defined in PlaneIds.

Returns
The frustum's planes

Field Documentation

◆ planes_

template<typename T >
PlaneT3<T> Ocean::FrustumT< T >::planes_[PI_END]
protected

The six planes of the frustum.


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