nlib
nn::nlib::simd::Frustum Class Reference

Class representing the view frustum. More...

#include "nn/nlib/simd/SimdGeometry.h"

Public Member Functions

 Frustum () noexcept
 Instantiates the object with default parameters (default constructor). Does not configure the default settings for the data members.
 
 Frustum (const Frustum &rhs) noexcept
 Copy constructor.
 
Frustumoperator= (const Frustum &rhs) noexcept
 Assignment operator.
 
 Frustum (SimdVectorArg center, SimdQuaternionArg rotation, float top, float bottom, float left, float right, float n, float f) noexcept
 Specifies the parameters and constructs a view frustum. More...
 
void Set (SimdVectorArg center, SimdQuaternionArg rotation, float top, float bottom, float left, float right, float n, float f) noexcept
 Performs the same operations as the constructor. See the description of the constructor.
 
void Transform (Frustum *frustum, float scale, SimdQuaternionArg rotation, SimdVectorArg translation) const noexcept
 Performs a 3D transform on an existing frustum and stores the transformed frustum in frustum. More...
 
void Transform (Frustum *frustum, SimdMatrixArg m) const noexcept
 Performs a 3D transform on an existing frustum and stores the transformed frustum in frustum. More...
 
void GetCorners (Float3 *corners) const noexcept
 Gets the vertices of the frustum in world coordinates. More...
 

Detailed Description

Class representing the view frustum.

Description
This class holds data for the six planes in (normalized) local coordinates that make up the view frustum, in addition to the vector that represents the position and the quaternion that represents the rotation.

Definition at line 118 of file SimdGeometry.h.

Constructor & Destructor Documentation

◆ Frustum()

nn::nlib::simd::Frustum::Frustum ( SimdVectorArg  center,
SimdQuaternionArg  rotation,
float  top,
float  bottom,
float  left,
float  right,
float  n,
float  f 
)
noexcept

Specifies the parameters and constructs a view frustum.

Parameters
[in]centerThe three-dimensional vector representing the position of the frustum.
[in]rotationA quaternion indicating the orientation of the frustum.
[in]topY-coordinate of the top of the near plane.
[in]bottomY-coordinate of the bottom of the near plane.
[in]leftX-coordinate on the left side of the near plane.
[in]rightX-coordinate on the right side of the near plane.
[in]nThe distance to the near plane.
[in]fThe distance to the far plane.
Description
The vertices of the frustum (in the local coordinate system) take the following values.
  • Near plane: (left, top, -n), (right, top, -n), (right, bottom, -n), (left, bottom, -n)
  • Far plane: (left * f/n, top * f/n, -f), (right * f/n, top * f/n, -f), (right * f/n, bottom * f/n, -f), (left * f/n, bottom * f/n, -f)
The following planes are kept in normalized forms inside the class. In all cases, the normal points toward the outside of the frustum, to enable such things as more efficient determination of containment relations.
  • Near plane: z + n = 0
  • Far plane: -z - f = 0
  • Top plane: y + (top/n)z = 0
  • Bottom plane: -y - (bottom/n)z = 0
  • Left plane: -x - (left/n)z = 0
  • Right plane: x + (right/n)z = 0
These planes are located in world coordinates, rotated by the amount of rotation and translated by the amount of center.

Member Function Documentation

◆ GetCorners()

nn::nlib::simd::Frustum::GetCorners ( Float3 corners) const
noexcept

Gets the vertices of the frustum in world coordinates.

Parameters
[out]cornersThe region storing the vertices. You must allocate a region that can hold the data for eight vertices.
Description
The vertices are stored in a specific order, starting with the vertices for the near plane (clockwise, starting with the upper left and then proceeding to the upper right, lower right, and lower left), followed by the vertices for the far plane (similarly clockwise, starting with the upper left and then proceeding to the upper right, lower right, and lower left).

◆ Transform() [1/2]

nn::nlib::simd::Frustum::Transform ( Frustum frustum,
float  scale,
SimdQuaternionArg  rotation,
SimdVectorArg  translation 
) const
noexcept

Performs a 3D transform on an existing frustum and stores the transformed frustum in frustum.

Parameters
[out]frustumStores the transformed frustum.
[in]scaleThe scaling.
[in]rotationThe rotation.
[in]translationThe translation.

◆ Transform() [2/2]

nn::nlib::simd::Frustum::Transform ( Frustum frustum,
SimdMatrixArg  m 
) const
noexcept

Performs a 3D transform on an existing frustum and stores the transformed frustum in frustum.

Parameters
[out]frustumStores the transformed frustum.
[in]mA 3D transform matrix.
Description
Scaling uses the maximum values along the xyz axes.

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