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
GfPlane Class Reference

Basic type: 3-dimensional plane. More...

#include <plane.h>

Public Member Functions

 GfPlane ()
 The default constructor leaves the plane parameters undefined.
 
 GfPlane (const GfVec3d &normal, double distanceToOrigin)
 This constructor sets this to the plane perpendicular to normal and at distance units from the origin.
 
 GfPlane (const GfVec3d &normal, const GfVec3d &point)
 This constructor sets this to the plane perpendicular to normal and that passes through point.
 
 GfPlane (const GfVec3d &p0, const GfVec3d &p1, const GfVec3d &p2)
 This constructor sets this to the plane that contains the three given points.
 
 GfPlane (const GfVec4d &eqn)
 This constructor creates a plane given by the equation eqn[0] * x + eqn[1] * y + eqn[2] * z + eqn[3] = 0.
 
void Set (const GfVec3d &normal, double distanceToOrigin)
 Sets this to the plane perpendicular to normal and at distance units from the origin.
 
GF_API void Set (const GfVec3d &normal, const GfVec3d &point)
 This constructor sets this to the plane perpendicular to normal and that passes through point.
 
GF_API void Set (const GfVec3d &p0, const GfVec3d &p1, const GfVec3d &p2)
 This constructor sets this to the plane that contains the three given points.
 
GF_API void Set (const GfVec4d &eqn)
 This method sets this to the plane given by the equation eqn[0] * x + eqn[1] * y + eqn[2] * z + eqn[3] = 0.
 
const GfVec3dGetNormal () const
 Returns the unit-length normal vector of the plane.
 
double GetDistanceFromOrigin () const
 Returns the distance of the plane from the origin.
 
GF_API GfVec4d GetEquation () const
 Give the coefficients of the equation of the plane.
 
bool operator== (const GfPlane &p) const
 Component-wise equality test.
 
bool operator!= (const GfPlane &p) const
 Component-wise inequality test.
 
double GetDistance (const GfVec3d &p) const
 Returns the distance of point from the plane.
 
GfVec3d Project (const GfVec3d &p) const
 Return the projection of p onto the plane.
 
GF_API GfPlaneTransform (const GfMatrix4d &matrix)
 Transforms the plane by the given matrix.
 
void Reorient (const GfVec3d &p)
 Flip the plane normal (if necessary) so that p is in the positive halfspace.
 
GF_API bool IntersectsPositiveHalfSpace (const GfRange3d &box) const
 Returns true if the given aligned bounding box is at least partially on the positive side (the one the normal points into) of the plane.
 
bool IntersectsPositiveHalfSpace (const GfVec3d &pt) const
 Returns true if the given point is on the plane or within its positive half space.
 

Detailed Description

Basic type: 3-dimensional plane.

This class represents a three-dimensional plane as a normal vector and the distance of the plane from the origin, measured along the normal. The plane can also be used to represent a half-space: the side of the plane in the direction of the normal.

Definition at line 36 of file plane.h.

Constructor & Destructor Documentation

◆ GfPlane() [1/5]

GfPlane ( )
inline

The default constructor leaves the plane parameters undefined.

Definition at line 41 of file plane.h.

◆ GfPlane() [2/5]

GfPlane ( const GfVec3d normal,
double  distanceToOrigin 
)
inline

This constructor sets this to the plane perpendicular to normal and at distance units from the origin.

The passed-in normal is normalized to unit length first.

Definition at line 47 of file plane.h.

◆ GfPlane() [3/5]

GfPlane ( const GfVec3d normal,
const GfVec3d point 
)
inline

This constructor sets this to the plane perpendicular to normal and that passes through point.

The passed-in normal is normalized to unit length first.

Definition at line 54 of file plane.h.

◆ GfPlane() [4/5]

GfPlane ( const GfVec3d p0,
const GfVec3d p1,
const GfVec3d p2 
)
inline

This constructor sets this to the plane that contains the three given points.

The normal is constructed from the cross product of (p1 - p0) (p2 - p0). Results are undefined if the points are collinear.

Definition at line 62 of file plane.h.

◆ GfPlane() [5/5]

GfPlane ( const GfVec4d eqn)
inline

This constructor creates a plane given by the equation eqn[0] * x + eqn[1] * y + eqn[2] * z + eqn[3] = 0.

Definition at line 68 of file plane.h.

Member Function Documentation

◆ GetDistance()

double GetDistance ( const GfVec3d p) const
inline

Returns the distance of point from the plane.

This distance will be positive if the point is on the side of the plane containing the normal.

Definition at line 131 of file plane.h.

◆ GetDistanceFromOrigin()

double GetDistanceFromOrigin ( ) const
inline

Returns the distance of the plane from the origin.

Definition at line 106 of file plane.h.

◆ GetEquation()

GF_API GfVec4d GetEquation ( ) const

Give the coefficients of the equation of the plane.

Suitable to OpenGL calls to set the clipping plane.

◆ GetNormal()

const GfVec3d & GetNormal ( ) const
inline

Returns the unit-length normal vector of the plane.

Definition at line 101 of file plane.h.

◆ IntersectsPositiveHalfSpace() [1/2]

GF_API bool IntersectsPositiveHalfSpace ( const GfRange3d box) const

Returns true if the given aligned bounding box is at least partially on the positive side (the one the normal points into) of the plane.

◆ IntersectsPositiveHalfSpace() [2/2]

bool IntersectsPositiveHalfSpace ( const GfVec3d pt) const
inline

Returns true if the given point is on the plane or within its positive half space.

Definition at line 161 of file plane.h.

◆ operator!=()

bool operator!= ( const GfPlane p) const
inline

Component-wise inequality test.

The normals and distances must match exactly for planes to be considered equal.

Definition at line 124 of file plane.h.

◆ operator==()

bool operator== ( const GfPlane p) const
inline

Component-wise equality test.

The normals and distances must match exactly for planes to be considered equal.

Definition at line 117 of file plane.h.

◆ Project()

GfVec3d Project ( const GfVec3d p) const
inline

Return the projection of p onto the plane.

Definition at line 136 of file plane.h.

◆ Reorient()

void Reorient ( const GfVec3d p)
inline

Flip the plane normal (if necessary) so that p is in the positive halfspace.

Definition at line 146 of file plane.h.

◆ Set() [1/4]

GF_API void Set ( const GfVec3d normal,
const GfVec3d point 
)

This constructor sets this to the plane perpendicular to normal and that passes through point.

The passed-in normal is normalized to unit length first.

◆ Set() [2/4]

void Set ( const GfVec3d normal,
double  distanceToOrigin 
)
inline

Sets this to the plane perpendicular to normal and at distance units from the origin.

The passed-in normal is normalized to unit length first.

Definition at line 75 of file plane.h.

◆ Set() [3/4]

GF_API void Set ( const GfVec3d p0,
const GfVec3d p1,
const GfVec3d p2 
)

This constructor sets this to the plane that contains the three given points.

The normal is constructed from the cross product of (p1 - p0) (p2 - p0). Results are undefined if the points are collinear.

◆ Set() [4/4]

GF_API void Set ( const GfVec4d eqn)

This method sets this to the plane given by the equation eqn[0] * x + eqn[1] * y + eqn[2] * z + eqn[3] = 0.

◆ Transform()

GF_API GfPlane & Transform ( const GfMatrix4d matrix)

Transforms the plane by the given matrix.


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