OpenVDB  0.104.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Frustum< Real > Class Template Reference

Frustum GeClass. More...

#include <Frustum.h>

Public Types

typedef Vec3< RealPoint
 
typedef Vec3< RealVector
 
typedef Plane< RealPlaneType
 

Public Member Functions

OPENVDB_DEPRECATED Frustum ()
 Generates an uninitialized (i.e in-valid) Frustum. More...
 
OPENVDB_DEPRECATED Frustum (const Frustum &other)
 Simple copy constructor. More...
 
OPENVDB_DEPRECATED Frustum (const Transform &t)
 
OPENVDB_DEPRECATED Frustum (const PlaneType &front, const PlaneType &back, const PlaneType &left, const PlaneType &right, const PlaneType &up, const PlaneType &down)
 
OPENVDB_DEPRECATED Frustum (const Point &position, const Vector &direction, const Vector &up, const Vector &left, Real zNear, Real zFar)
 Contructor from a Camera Frustum. More...
 
OPENVDB_DEPRECATED Frustum (const NonlinearFrustumMap &frustum)
 Constructor for a Frustum from a NonlinearFrustumMap. More...
 
void rescaleLerp (const Point &unit_min, const Point &unit_max)
 
void rescaleSlerp (const Point &unit_min, const Point &unit_max)
 
bool operator== (const Frustum &other) const
 
bool operator!= (const Frustum &other) const
 
bool isInside (const Point &pt) const
 
bool isOutside (const Point &pt) const
 
bool isValid () const
 
PlaneType getFace (int n) const
 
PlaneType getPlane (int n) const
 
void setFace (int n, const PlaneType &P)
 
void setPlane (int n, const PlaneType &P)
 
PlaneTypeface (int n)
 
PlaneTypeplane (int n)
 
int intersects (const Ray< Real > &ray, Real &t0, Real &t1) const
 Intersection test against ray. More...
 
bool intersects (const Ray< Real > &ray) const
 
bool isInside (const Ray< Real > &ray) const
 

Static Public Member Functions

static std::string getFaceName (int i)
 

Detailed Description

template<typename Real>
class openvdb::v0_104_0::math::Frustum< Real >

Frustum GeClass.

Member Typedef Documentation

typedef Plane<Real> PlaneType
typedef Vec3<Real> Point
typedef Vec3<Real> Vector

Constructor & Destructor Documentation

Generates an uninitialized (i.e in-valid) Frustum.

OPENVDB_DEPRECATED Frustum ( const Frustum< Real > &  other)
inline

Simple copy constructor.

OPENVDB_DEPRECATED Frustum ( const Transform t)
inline

Constructs a Frustum from the indexToWorld transfrom in a Grid. GridType (or TransformType) is assumed to have a indexToWorld(Vector) method! A complicating aspect is that linear- and frustrum-transforms employ different handedness!

OPENVDB_DEPRECATED Frustum ( const PlaneType front,
const PlaneType back,
const PlaneType left,
const PlaneType right,
const PlaneType up,
const PlaneType down 
)
inline

Constructor takes the six planes of the Frustum. Note the ordering: front,back,left,right,up,down

OPENVDB_DEPRECATED Frustum ( const Point position,
const Vector direction,
const Vector up,
const Vector left,
Real  zNear,
Real  zFar 
)
inline

Contructor from a Camera Frustum.

Parameters
positionis the tip of the frustum (i.e. the camera's position).
directionis a unit vector pointing from the center toward the near plane.
up,lefttwo non-unit vectors describing the direction and extent of the frustum's intersection on the near plane. Together, direction, up and left should form an orthogonal basis for the frustum.
zNear,zFarthe distance from position along direction to the near and far planes of the frustum.
OPENVDB_DEPRECATED Frustum ( const NonlinearFrustumMap frustum)
inline

Constructor for a Frustum from a NonlinearFrustumMap.

Member Function Documentation

PlaneType& face ( int  n)
inline
Returns
reference to one of the 6 half-planes defined by n
PlaneType getFace ( int  n) const
inline
Returns
copy of one of the 6 half-planes defined by n
static std::string getFaceName ( int  i)
inlinestatic
PlaneType getPlane ( int  n) const
inline
int intersects ( const Ray< Real > &  ray,
Real t0,
Real t1 
) const
inline

Intersection test against ray.

Note
Assumes (six) planes of the frustum forms a convex polyhedron!
Parameters
ray,t0,t1t0 = near, t1 = far
Returns
0 if ray does not intersect the frustum at all, i.e. is completely outside!
-1 if ray is completely inside and never intersects the planes of the frustum, i.e. origin is inside and back-face is beyond ray.tmax
1 if ray intersects once. There are two such cases: 1) origin is outside and ray hits front face once (i.e. t0>ray.tmin && t1==ray.tmax) 2) origin is inside and ray hits back face once (i.e. t0==ray.tmin && t1<ray.tmax)
2 if ray intersects twice, i.e. origin outside and hitting back face (i.e t0>ray.tmin and t1<ray.tmax)
bool intersects ( const Ray< Real > &  ray) const
inline
Returns
true if ray intersects one (or more) of the six planes of the Frustum OR is completely inside
bool isInside ( const Point pt) const
inline
Returns
true if point is inside Frustum, i.e. inside all six Planes.
bool isInside ( const Ray< Real > &  ray) const
inline
Returns
true if ray is completely inside the Frustum
bool isOutside ( const Point pt) const
inline
Returns
true if point is outside Frustum, i.e. outside one of the six Planes.
bool isValid ( ) const
inline
Returns
true if the Frustum is valid, i.e. all six plane are valid.
bool operator!= ( const Frustum< Real > &  other) const
inline
bool operator== ( const Frustum< Real > &  other) const
inline
PlaneType& plane ( int  n)
inline
void rescaleLerp ( const Point unit_min,
const Point unit_max 
)
inline

rescales the Frustum to fit the unit coordinates. Note this method employs linear interpolation and clamps the unit coordinates to [0;1]!

void rescaleSlerp ( const Point unit_min,
const Point unit_max 
)
inline

rescales the Frustum to fit the unit coordinates. Note this method employs spherical interpolation and clamps the unit coordinates to [0;1]!

void setFace ( int  n,
const PlaneType P 
)
inline
Returns
defines one of the 6 half-planes defined by n
void setPlane ( int  n,
const PlaneType P 
)
inline

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