This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GfFrustum Class Reference

Basic type: View frustum. More...

#include <frustum.h>

Public Types

enum  ProjectionType { Orthographic , Perspective }
 This enum is used to determine the type of projection represented by a frustum. More...
 

Public Member Functions

GF_API GfFrustum ()
 This constructor creates an instance with default viewing parameters:
 
 GfFrustum (GfFrustum const &o)
 Copy constructor.
 
 GfFrustum (GfFrustum &&o) noexcept
 Move constructor.
 
GF_API GfFrustum (const GfVec3d &position, const GfRotation &rotation, const GfRange2d &window, const GfRange1d &nearFar, GfFrustum::ProjectionType projectionType, double viewDistance=5.0)
 This constructor creates an instance with the given viewing parameters.
 
GF_API GfFrustum (const GfMatrix4d &camToWorldXf, const GfRange2d &window, const GfRange1d &nearFar, GfFrustum::ProjectionType projectionType, double viewDistance=5.0)
 This constructor creates an instance from a camera matrix (always of a y-Up camera, also see SetPositionAndRotationFromMatrix) and the given viewing parameters.
 
GfFrustumoperator= (GfFrustum const &o) noexcept
 Copy assignment.
 
GfFrustumoperator= (GfFrustum &&o) noexcept
 Move assignment.
 
bool operator== (const GfFrustum &f) const
 
bool operator!= (const GfFrustum &f) const
 
GF_API ~GfFrustum ()
 Destructor.
 
Convenience methods

The methods in this group allow the frustum's data to be accessed and modified in terms of different representations that may be more convenient for certain applications.

GF_API void SetPerspective (double fieldOfViewHeight, double aspectRatio, double nearDistance, double farDistance)
 Sets up the frustum in a manner similar to gluPerspective().
 
GF_API void SetPerspective (double fieldOfView, bool isFovVertical, double aspectRatio, double nearDistance, double farDistance)
 Sets up the frustum in a manner similar to gluPerspective().
 
GF_API bool GetPerspective (double *fieldOfViewHeight, double *aspectRatio, double *nearDistance, double *farDistance) const
 Returns the current frustum in the format used by SetPerspective().
 
GF_API bool GetPerspective (bool isFovVertical, double *fieldOfView, double *aspectRatio, double *nearDistance, double *farDistance) const
 Returns the current frustum in the format used by SetPerspective().
 
GF_API double GetFOV (bool isFovVertical=false) const
 Returns the horizontal or vertical fov of the frustum.
 
GF_API void SetOrthographic (double left, double right, double bottom, double top, double nearPlane, double farPlane)
 Sets up the frustum in a manner similar to glOrtho().
 
GF_API bool GetOrthographic (double *left, double *right, double *bottom, double *top, double *nearPlane, double *farPlane) const
 Returns the current frustum in the format used by SetOrthographic().
 
GF_API void FitToSphere (const GfVec3d &center, double radius, double slack=0.0)
 Modifies the frustum to tightly enclose a sphere with the given center and radius, using the current view direction.
 
GF_API GfFrustumTransform (const GfMatrix4d &matrix)
 Transforms the frustum by the given matrix.
 
GF_API GfVec3d ComputeViewDirection () const
 Returns the normalized world-space view direction vector, which is computed by rotating the -z axis by the frustum's rotation.
 
GF_API GfVec3d ComputeUpVector () const
 Returns the normalized world-space up vector, which is computed by rotating the y axis by the frustum's rotation.
 
GF_API void ComputeViewFrame (GfVec3d *side, GfVec3d *up, GfVec3d *view) const
 Computes the view frame defined by this frustum.
 
GF_API GfVec3d ComputeLookAtPoint () const
 Computes and returns the world-space look-at point from the eye point (position), view direction (rotation), and view distance.
 
GF_API GfMatrix4d ComputeViewMatrix () const
 Returns a matrix that represents the viewing transformation for this frustum.
 
GF_API GfMatrix4d ComputeViewInverse () const
 Returns a matrix that represents the inverse viewing transformation for this frustum.
 
GF_API GfMatrix4d ComputeProjectionMatrix () const
 Returns a GL-style projection matrix corresponding to the frustum's projection.
 
GF_API double ComputeAspectRatio () const
 Returns the aspect ratio of the frustum, defined as the width of the window divided by the height.
 
GF_API std::vector< GfVec3dComputeCorners () const
 Returns the world-space corners of the frustum as a vector of 8 points, ordered as:
 
GF_API std::vector< GfVec3dComputeCornersAtDistance (double d) const
 Returns the world-space corners of the intersection of the frustum with a plane parallel to the near/far plane at distance d from the apex, ordered as:
 
GF_API GfFrustum ComputeNarrowedFrustum (const GfVec2d &windowPos, const GfVec2d &size) const
 Returns a frustum that is a narrowed-down version of this frustum.
 
GF_API GfFrustum ComputeNarrowedFrustum (const GfVec3d &worldPoint, const GfVec2d &size) const
 Returns a frustum that is a narrowed-down version of this frustum.
 
GF_API GfRay ComputeRay (const GfVec2d &windowPos) const
 Builds and returns a GfRay that starts at the viewpoint and extends through the given windowPos given in normalized coords (-1 to +1 in both dimensions) window position.
 
GF_API GfRay ComputeRay (const GfVec3d &worldSpacePos) const
 Builds and returns a GfRay that connects the viewpoint to the given 3d point in worldspace.
 
GF_API GfRay ComputePickRay (const GfVec2d &windowPos) const
 Builds and returns a GfRay that can be used for picking at the given normalized (-1 to +1 in both dimensions) window position.
 
GF_API GfRay ComputePickRay (const GfVec3d &worldSpacePos) const
 Builds and returns a GfRay that can be used for picking that connects the viewpoint to the given 3d point in worldspace.
 

Friends

size_t hash_value (const GfFrustum &f)
 

Value setting and access

The methods in this group set and access the values that are used to define a frustum.

void SetPosition (const GfVec3d &position)
 Sets the position of the frustum in world space.
 
const GfVec3dGetPosition () const
 Returns the position of the frustum in world space.
 
void SetRotation (const GfRotation &rotation)
 Sets the orientation of the frustum in world space as a rotation to apply to the default frame: looking along the -z axis with the +y axis as "up".
 
const GfRotationGetRotation () const
 Returns the orientation of the frustum in world space as a rotation to apply to the -z axis.
 
GF_API void SetPositionAndRotationFromMatrix (const GfMatrix4d &camToWorldXf)
 Sets the position and rotation of the frustum from a camera matrix (always from a y-Up camera).
 
void SetWindow (const GfRange2d &window)
 Sets the window rectangle in the reference plane that defines the left, right, top, and bottom planes of the frustum.
 
const GfRange2dGetWindow () const
 Returns the window rectangle in the reference plane.
 
void SetNearFar (const GfRange1d &nearFar)
 Sets the near/far interval.
 
const GfRange1dGetNearFar () const
 Returns the near/far interval.
 
void SetViewDistance (double viewDistance)
 Sets the view distance.
 
double GetViewDistance () const
 Returns the view distance.
 
void SetProjectionType (GfFrustum::ProjectionType projectionType)
 Sets the projection type.
 
GfFrustum::ProjectionType GetProjectionType () const
 Returns the projection type.
 
static double GetReferencePlaneDepth ()
 Returns the depth of the reference plane.
 

Intersection methods

The methods in this group implement intersection operations between this frustum and a given primitive.

GF_API bool Intersects (const GfBBox3d &bbox) const
 Returns true if the given axis-aligned bbox is inside or intersecting the frustum.
 
GF_API bool Intersects (const GfVec3d &point) const
 Returns true if the given point is inside or intersecting the frustum.
 
GF_API bool Intersects (const GfVec3d &p0, const GfVec3d &p1) const
 Returns true if the line segment formed by the given points is inside or intersecting the frustum.
 
GF_API bool Intersects (const GfVec3d &p0, const GfVec3d &p1, const GfVec3d &p2) const
 Returns true if the triangle formed by the given points is inside or intersecting the frustum.
 
static GF_API bool IntersectsViewVolume (const GfBBox3d &bbox, const GfMatrix4d &vpMat)
 Returns true if the bbox volume intersects the view volume given by the view-projection matrix, erring on the side of false positives for efficiency.
 

Detailed Description

Basic type: View frustum.

This class represents a viewing frustum in three dimensional eye space. It may represent either a parallel (orthographic) or perspective projection. One can think of the frustum as being defined by 6 boundary planes.

The frustum is specified using these parameters:

  • The position of the viewpoint.
  • The rotation applied to the default view frame, which is looking along the -z axis with the +y axis as the "up" direction.
  • The 2D window on the reference plane that defines the left, right, top, and bottom planes of the viewing frustum, as described below.
  • The distances to the near and far planes.
  • The projection type
  • The view distance.

The window and near/far parameters combine to define the view frustum as follows. Transform the -z axis and the +y axis by the frustum rotation to get the world-space view direction and up direction. Now consider the reference plane that is perpendicular to the view direction, a distance of referencePlaneDepth from the viewpoint, and whose y axis corresponds to the up direction. The window rectangle is specified in a 2D coordinate system embedded in this plane. The origin of the coordinate system is the point at which the view direction vector intersects the plane. Therefore, the point (0,1) in this plane is found by moving 1 unit along the up direction vector in this plane. The vector from the viewpoint to the resulting point will form a 45-degree angle with the view direction.

The view distance is only useful for interactive applications. It can be used to compute a look at point which is useful when rotating around an object of interest.

Definition at line 71 of file frustum.h.

Member Enumeration Documentation

◆ ProjectionType

This enum is used to determine the type of projection represented by a frustum.

Enumerator
Orthographic 

Orthographic projection.

Perspective 

Perspective projection.

Definition at line 75 of file frustum.h.

Constructor & Destructor Documentation

◆ GfFrustum() [1/5]

GF_API GfFrustum ( )

This constructor creates an instance with default viewing parameters:

  • The position is the origin.
  • The rotation is the identity rotation. (The view is along the -z axis, with the +y axis as "up").
  • The window is -1 to +1 in both dimensions.
  • The near/far interval is (1, 10).
  • The view distance is 5.0.
  • The projection type is GfFrustum::Perspective.

◆ GfFrustum() [2/5]

GfFrustum ( GfFrustum const &  o)
inline

Copy constructor.

Definition at line 91 of file frustum.h.

◆ GfFrustum() [3/5]

GfFrustum ( GfFrustum &&  o)
inlinenoexcept

Move constructor.

Definition at line 105 of file frustum.h.

◆ GfFrustum() [4/5]

GF_API GfFrustum ( const GfVec3d position,
const GfRotation rotation,
const GfRange2d window,
const GfRange1d nearFar,
GfFrustum::ProjectionType  projectionType,
double  viewDistance = 5.0 
)

This constructor creates an instance with the given viewing parameters.

◆ GfFrustum() [5/5]

GF_API GfFrustum ( const GfMatrix4d camToWorldXf,
const GfRange2d window,
const GfRange1d nearFar,
GfFrustum::ProjectionType  projectionType,
double  viewDistance = 5.0 
)

This constructor creates an instance from a camera matrix (always of a y-Up camera, also see SetPositionAndRotationFromMatrix) and the given viewing parameters.

◆ ~GfFrustum()

GF_API ~GfFrustum ( )

Destructor.

Member Function Documentation

◆ ComputeAspectRatio()

GF_API double ComputeAspectRatio ( ) const

Returns the aspect ratio of the frustum, defined as the width of the window divided by the height.

If the height is zero or negative, this returns 0.

◆ ComputeCorners()

GF_API std::vector< GfVec3d > ComputeCorners ( ) const

Returns the world-space corners of the frustum as a vector of 8 points, ordered as:

  • Left bottom near
  • Right bottom near
  • Left top near
  • Right top near
  • Left bottom far
  • Right bottom far
  • Left top far
  • Right top far

◆ ComputeCornersAtDistance()

GF_API std::vector< GfVec3d > ComputeCornersAtDistance ( double  d) const

Returns the world-space corners of the intersection of the frustum with a plane parallel to the near/far plane at distance d from the apex, ordered as:

  • Left bottom
  • Right bottom
  • Left top
  • Right top In particular, it gives the partial result of ComputeCorners when given near or far distance.

◆ ComputeLookAtPoint()

GF_API GfVec3d ComputeLookAtPoint ( ) const

Computes and returns the world-space look-at point from the eye point (position), view direction (rotation), and view distance.

◆ ComputeNarrowedFrustum() [1/2]

GF_API GfFrustum ComputeNarrowedFrustum ( const GfVec2d windowPos,
const GfVec2d size 
) const

Returns a frustum that is a narrowed-down version of this frustum.

The new frustum has the same near and far planes, but the other planes are adjusted to be centered on windowPos with the new width and height obtained from the existing width and height by multiplying by size[0] and size[1], respectively. Finally, the new frustum is clipped against this frustum so that it is completely contained in the existing frustum.

windowPos is given in normalized coords (-1 to +1 in both dimensions). size is given as a scalar (0 to 1 in both dimensions).

If the windowPos or size given is outside these ranges, it may result in returning a collapsed frustum.

This method is useful for computing a volume to use for interactive picking.

◆ ComputeNarrowedFrustum() [2/2]

GF_API GfFrustum ComputeNarrowedFrustum ( const GfVec3d worldPoint,
const GfVec2d size 
) const

Returns a frustum that is a narrowed-down version of this frustum.

The new frustum has the same near and far planes, but the other planes are adjusted to be centered on worldPoint with the new width and height obtained from the existing width and height by multiplying by size[0] and size[1], respectively. Finally, the new frustum is clipped against this frustum so that it is completely contained in the existing frustum.

worldPoint is given in world space coordinates. size is given as a scalar (0 to 1 in both dimensions).

If the size given is outside this range, it may result in returning a collapsed frustum.

If the worldPoint is at or behind the eye of the frustum, it will return a frustum equal to this frustum.

This method is useful for computing a volume to use for interactive picking.

◆ ComputePickRay() [1/2]

GF_API GfRay ComputePickRay ( const GfVec2d windowPos) const

Builds and returns a GfRay that can be used for picking at the given normalized (-1 to +1 in both dimensions) window position.

Contrasted with ComputeRay(), that method returns a ray whose origin is the eyepoint, while this method returns a ray whose origin is on the near plane.

◆ ComputePickRay() [2/2]

GF_API GfRay ComputePickRay ( const GfVec3d worldSpacePos) const

Builds and returns a GfRay that can be used for picking that connects the viewpoint to the given 3d point in worldspace.

◆ ComputeProjectionMatrix()

GF_API GfMatrix4d ComputeProjectionMatrix ( ) const

Returns a GL-style projection matrix corresponding to the frustum's projection.

◆ ComputeRay() [1/2]

GF_API GfRay ComputeRay ( const GfVec2d windowPos) const

Builds and returns a GfRay that starts at the viewpoint and extends through the given windowPos given in normalized coords (-1 to +1 in both dimensions) window position.

Contrasted with ComputePickRay(), this method returns a ray whose origin is the eyepoint, while that method returns a ray whose origin is on the near plane.

◆ ComputeRay() [2/2]

GF_API GfRay ComputeRay ( const GfVec3d worldSpacePos) const

Builds and returns a GfRay that connects the viewpoint to the given 3d point in worldspace.

Contrasted with ComputePickRay(), this method returns a ray whose origin is the eyepoint, while that method returns a ray whose origin is on the near plane.

◆ ComputeUpVector()

GF_API GfVec3d ComputeUpVector ( ) const

Returns the normalized world-space up vector, which is computed by rotating the y axis by the frustum's rotation.

◆ ComputeViewDirection()

GF_API GfVec3d ComputeViewDirection ( ) const

Returns the normalized world-space view direction vector, which is computed by rotating the -z axis by the frustum's rotation.

◆ ComputeViewFrame()

GF_API void ComputeViewFrame ( GfVec3d side,
GfVec3d up,
GfVec3d view 
) const

Computes the view frame defined by this frustum.

The frame consists of the view direction, up vector and side vector, as shown in this diagram.

up
^ ^
| /
| / view
|/
+- - - - > side

◆ ComputeViewInverse()

GF_API GfMatrix4d ComputeViewInverse ( ) const

Returns a matrix that represents the inverse viewing transformation for this frustum.

That is, it returns the matrix that converts points from eye (frustum) space to world space.

◆ ComputeViewMatrix()

GF_API GfMatrix4d ComputeViewMatrix ( ) const

Returns a matrix that represents the viewing transformation for this frustum.

That is, it returns the matrix that converts points from world space to eye (frustum) space.

◆ FitToSphere()

GF_API void FitToSphere ( const GfVec3d center,
double  radius,
double  slack = 0.0 
)

Modifies the frustum to tightly enclose a sphere with the given center and radius, using the current view direction.

The planes of the frustum are adjusted as necessary. The given amount of slack is added to the sphere's radius is used around the sphere to avoid boundary problems.

◆ GetFOV()

GF_API double GetFOV ( bool  isFovVertical = false) const

Returns the horizontal or vertical fov of the frustum.

The fov of the frustum is not necessarily the same value as displayed in the viewer. The displayed fov is a function of the focal length or FOV avar. The frustum's fov may be different due to things like lens breathing.

If the frustum is not of type GfFrustum::Perspective, the returned FOV will be 0.0.

Note
The default value for isFovVertical is false so calling GetFOV without an argument will return the horizontal field of view which is compatible with menv2x's old GfFrustum::GetFOV routine.

◆ GetNearFar()

const GfRange1d & GetNearFar ( ) const
inline

Returns the near/far interval.

Definition at line 266 of file frustum.h.

◆ GetOrthographic()

GF_API bool GetOrthographic ( double *  left,
double *  right,
double *  bottom,
double *  top,
double *  nearPlane,
double *  farPlane 
) const

Returns the current frustum in the format used by SetOrthographic().

If the current frustum is not an orthographic projection, this returns false and leaves the parameters untouched.

◆ GetPerspective() [1/2]

GF_API bool GetPerspective ( bool  isFovVertical,
double *  fieldOfView,
double *  aspectRatio,
double *  nearDistance,
double *  farDistance 
) const

Returns the current frustum in the format used by SetPerspective().

If the current frustum is not a perspective projection, this returns false and leaves the parameters untouched.

◆ GetPerspective() [2/2]

GF_API bool GetPerspective ( double *  fieldOfViewHeight,
double *  aspectRatio,
double *  nearDistance,
double *  farDistance 
) const

Returns the current frustum in the format used by SetPerspective().

If the current frustum is not a perspective projection, this returns false and leaves the parameters untouched.

◆ GetPosition()

const GfVec3d & GetPosition ( ) const
inline

Returns the position of the frustum in world space.

Definition at line 217 of file frustum.h.

◆ GetProjectionType()

GfFrustum::ProjectionType GetProjectionType ( ) const
inline

Returns the projection type.

Definition at line 287 of file frustum.h.

◆ GetReferencePlaneDepth()

static double GetReferencePlaneDepth ( )
inlinestatic

Returns the depth of the reference plane.

Definition at line 255 of file frustum.h.

◆ GetRotation()

const GfRotation & GetRotation ( ) const
inline

Returns the orientation of the frustum in world space as a rotation to apply to the -z axis.

Definition at line 231 of file frustum.h.

◆ GetViewDistance()

double GetViewDistance ( ) const
inline

Returns the view distance.

Definition at line 276 of file frustum.h.

◆ GetWindow()

const GfRange2d & GetWindow ( ) const
inline

Returns the window rectangle in the reference plane.

Definition at line 250 of file frustum.h.

◆ Intersects() [1/4]

GF_API bool Intersects ( const GfBBox3d bbox) const

Returns true if the given axis-aligned bbox is inside or intersecting the frustum.

Otherwise, it returns false. Useful when doing picking or frustum culling.

◆ Intersects() [2/4]

GF_API bool Intersects ( const GfVec3d p0,
const GfVec3d p1 
) const

Returns true if the line segment formed by the given points is inside or intersecting the frustum.

Otherwise, it returns false.

◆ Intersects() [3/4]

GF_API bool Intersects ( const GfVec3d p0,
const GfVec3d p1,
const GfVec3d p2 
) const

Returns true if the triangle formed by the given points is inside or intersecting the frustum.

Otherwise, it returns false.

◆ Intersects() [4/4]

GF_API bool Intersects ( const GfVec3d point) const

Returns true if the given point is inside or intersecting the frustum.

Otherwise, it returns false.

◆ IntersectsViewVolume()

static GF_API bool IntersectsViewVolume ( const GfBBox3d bbox,
const GfMatrix4d vpMat 
)
static

Returns true if the bbox volume intersects the view volume given by the view-projection matrix, erring on the side of false positives for efficiency.

This method is intended for cases where a GfFrustum is not available or when the view-projection matrix yields a view volume that is not expressable as a GfFrustum.

Because it errs on the side of false positives, it is suitable for early-out tests such as draw or intersection culling.

◆ operator!=()

bool operator!= ( const GfFrustum f) const
inline

Definition at line 198 of file frustum.h.

◆ operator=() [1/2]

GfFrustum & operator= ( GfFrustum &&  o)
inlinenoexcept

Move assignment.

Definition at line 157 of file frustum.h.

◆ operator=() [2/2]

GfFrustum & operator= ( GfFrustum const &  o)
inlinenoexcept

Copy assignment.

Definition at line 135 of file frustum.h.

◆ operator==()

bool operator== ( const GfFrustum f) const
inline

Definition at line 186 of file frustum.h.

◆ SetNearFar()

void SetNearFar ( const GfRange1d nearFar)
inline

Sets the near/far interval.

Definition at line 260 of file frustum.h.

◆ SetOrthographic()

GF_API void SetOrthographic ( double  left,
double  right,
double  bottom,
double  top,
double  nearPlane,
double  farPlane 
)

Sets up the frustum in a manner similar to glOrtho().

Sets the projection to GfFrustum::Orthographic and sets the window and near/far specifications based on the given values.

◆ SetPerspective() [1/2]

GF_API void SetPerspective ( double  fieldOfView,
bool  isFovVertical,
double  aspectRatio,
double  nearDistance,
double  farDistance 
)

Sets up the frustum in a manner similar to gluPerspective().

It sets the projection type to GfFrustum::Perspective and sets the window specification so that:

If isFovVertical is true, the resulting symmetric frustum encloses an angle of fieldOfView degrees in the vertical direction, with aspectRatio used to figure the angle in the horizontal direction.

If isFovVertical is false, the resulting symmetric frustum encloses an angle of fieldOfView degrees in the horizontal direction, with aspectRatio used to figure the angle in the vertical direction.

The near and far distances are specified as well. The window coordinates are computed as follows:

  • if isFovVertical:
  • top = tan(fieldOfView / 2)
  • right = top * aspectRatio
  • if NOT isFovVertical:
  • right = tan(fieldOfView / 2)
  • top = right / aspectRation
  • bottom = -top
  • left = -right
  • near = nearDistance
  • far = farDistance

◆ SetPerspective() [2/2]

GF_API void SetPerspective ( double  fieldOfViewHeight,
double  aspectRatio,
double  nearDistance,
double  farDistance 
)

Sets up the frustum in a manner similar to gluPerspective().

It sets the projection type to GfFrustum::Perspective and sets the window specification so that the resulting symmetric frustum encloses an angle of fieldOfViewHeight degrees in the vertical direction, with aspectRatio used to figure the angle in the horizontal direction. The near and far distances are specified as well. The window coordinates are computed as:

top = tan(fieldOfViewHeight / 2)
bottom = -top
right = top * aspectRatio
left = -right
near = nearDistance
far = farDistance

◆ SetPosition()

void SetPosition ( const GfVec3d position)
inline

Sets the position of the frustum in world space.

Definition at line 211 of file frustum.h.

◆ SetPositionAndRotationFromMatrix()

GF_API void SetPositionAndRotationFromMatrix ( const GfMatrix4d camToWorldXf)

Sets the position and rotation of the frustum from a camera matrix (always from a y-Up camera).

The resulting frustum's transform will always represent a right-handed and orthonormal coordinate sytem (scale, shear, and projection are removed from the given camToWorldXf).

◆ SetProjectionType()

void SetProjectionType ( GfFrustum::ProjectionType  projectionType)
inline

Sets the projection type.

Definition at line 281 of file frustum.h.

◆ SetRotation()

void SetRotation ( const GfRotation rotation)
inline

Sets the orientation of the frustum in world space as a rotation to apply to the default frame: looking along the -z axis with the +y axis as "up".

Definition at line 224 of file frustum.h.

◆ SetViewDistance()

void SetViewDistance ( double  viewDistance)
inline

Sets the view distance.

Definition at line 271 of file frustum.h.

◆ SetWindow()

void SetWindow ( const GfRange2d window)
inline

Sets the window rectangle in the reference plane that defines the left, right, top, and bottom planes of the frustum.

Definition at line 244 of file frustum.h.

◆ Transform()

GF_API GfFrustum & Transform ( const GfMatrix4d matrix)

Transforms the frustum by the given matrix.

The transformation matrix is applied as follows: the position and the direction vector are transformed with the given matrix. Then the length of the new direction vector is used to rescale the near and far plane and the view distance. Finally, the points that define the reference plane are transformed by the matrix. This method assures that the frustum will not be sheared or perspective-projected.

Note
Note that this definition means that the transformed frustum does not preserve scales very well. Do not use this function to transform a frustum that is to be used for precise operations such as intersection testing.

Friends And Related Function Documentation

◆ hash_value

size_t hash_value ( const GfFrustum f)
friend

Definition at line 174 of file frustum.h.


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