Allolib
1.0
C++ Components For Interactive Multimedia
|
Rectangular frustum. More...
Public Types | |
enum | { TOP = 0 , BOTTOM , LEFT , RIGHT , NEARP , FARP } |
enum | { OUTSIDE = 0 , INTERSECT , INSIDE } |
Public Member Functions | |
const Vec< 3, T > & | corner (int i) const |
const Vec< 3, T > & | corner (int i0, int i1, int i2) const |
template<class U > | |
Vec< 3, T > | getPoint (const Vec< 3, U > &frac) const |
Get point in frustum corresponding to fraction along edges. | |
template<class U > | |
Vec< 3, T > | getPoint (const U &fracx, const U &fracy, const U &fracz) const |
Get point in frustum corresponding to fraction along edges. | |
int | testPoint (const Vec< 3, T > &p) const |
Test whether point is in frustum. | |
int | testSphere (const Vec< 3, T > ¢er, float radius) const |
Test whether sphere is in frustum. | |
int | testBox (const Vec< 3, T > &xyz, const Vec< 3, T > &dim) const |
Test whether axis-aligned box is in frustum. More... | |
template<class V > | |
void | boundingBox (Vec< 3, V > &xyz, Vec< 3, V > &dim) const |
Get axis-aligned bounding box. | |
Vec< 3, T > | center () const |
Returns center of frustum. | |
void | computePlanes () |
Compute planes based on frustum corners (planes face to inside) More... | |
Public Attributes | |
Vec< 3, T > | ntl |
Vec< 3, T > | ntr |
Vec< 3, T > | nbl |
Vec< 3, T > | nbr |
Vec< 3, T > | ftl |
Vec< 3, T > | ftr |
Vec< 3, T > | fbl |
Vec< 3, T > | fbr |
Corners. | |
Plane< T > | pl [6] |
Faces. | |
Rectangular frustum.
A frustum has the shape of a four-sided pyramid truncated at the top. For graphics, this specifies the viewing frustum of a camera.
Source code adapted from: "OpenGL @ Lighthouse 3D - View Frustum Culling Tutorial", http://www.lighthouse3d.com/opengl/viewfrustum/index.php?intro
Definition at line 65 of file al_Frustum.hpp.
void al::Frustum< T >::computePlanes |
Compute planes based on frustum corners (planes face to inside)
The plane normals are computed assuming a right-hand coordinate system.
Definition at line 147 of file al_Frustum.hpp.
int al::Frustum< T >::testBox | ( | const Vec< 3, T > & | xyz, |
const Vec< 3, T > & | dim | ||
) | const |
Test whether axis-aligned box is in frustum.
This will always tell you if the box is in or intersects the frustum. Sometimes, boxes that are really outside will not be detected as so, thus returning a false positive.
Definition at line 178 of file al_Frustum.hpp.