AI_SDB_PlaneClipper Class Reference
[Spatial Database]
#include <AI_SDB_PlaneClipper.h>
Detailed Description
Encapsulates a set of clipping planes, handling of 'active clipping AI_Plane' flags for recursive traversal of spatial data structures.This is just a simple AI_Plane clipping class, allowing you to represent various primitives such as view frustums, shadow silhouettes, and convex hulls. Objects are tested against the positive side of the AI_Plane; if the object is on the negative side of any AI_Plane, it is definitively outside the region and rejected. Thus the class implements a test where all the planes face inward; if you want to tell if the object is outside of a region you'll have to reverse the sense of the flags returned.
Objects inside the region always return a true test result, and objects outside the region always return a false test result. Objects straddling a boundary will return the test result of the flags that you passed in. In this manner, you get two sorts of tests depending on what you pass in: -If you pass in AI_SDB_VisitorFlags(false)
you will only get back a true TestResult if the object is completely within the region. -If you pass in a AI_SDB_VisitorFlags(true)
you will only get back a false TestResult if the object is completely outside the region. These two possibilities have different uses depending on whether or not you're determining potentially visible objects or completely obscured objects.
Also included is the concept of 'active planes' for recursive object testing (i.e., octrees and quadtrees). When a given tree node is determined to be fully on the positive side of a given AI_Plane X, you know all the child objects will be fully on the positive side of AI_Plane X as well, so there is no need to test any child objects against AI_Plane X since you already know the test will pass. When there are no active planes left you know the object and all its children are fully determined, so you can trivially add them all without doing any more clipping checks.
- Version:
- 2.0 AI_SDB_PlaneClipper was ripped from The Nebula Device and renamed to AI_SDB_PlaneClipper. Now it is possible to use the class inside and outside Nebula projects.
Public Member Functions | |
AI_SDB_PlaneClipper () | |
A default constructed clipper will always return true for it clipping test. | |
AI_SDB_PlaneClipper (const AI_SDB_PlaneClipper ©me) | |
copy constructor | |
AI_SDB_PlaneClipper (const AI_Plane *clipplanes, int numplanes) | |
Construct the clipper with a set of planes. | |
AI_SDB_VisitorFlags | TestBBox (const AI_BBox &boxtest, AI_SDB_VisitorFlags in) |
AI_SDB_VisitorFlags | TestSphere (const AI_Sphere &spheretest, AI_SDB_VisitorFlags in) |
AI_SDB_VisitorFlags | TestPoint (const AI_Vector3 &pointtest, AI_SDB_VisitorFlags in) |
Protected Attributes | |
AI_Plane | m_planes [AI_SDB_PLANECLIPPER_MAXPLANES] |
int | m_numplanes |
Constructor & Destructor Documentation
AI_SDB_PlaneClipper::AI_SDB_PlaneClipper | ( | ) | [inline] |
A default constructed clipper will always return true for it clipping test.
AI_SDB_PlaneClipper::AI_SDB_PlaneClipper | ( | const AI_SDB_PlaneClipper & | copyme | ) | [inline] |
copy constructor
AI_SDB_PlaneClipper::AI_SDB_PlaneClipper | ( | const AI_Plane * | clipplanes, | |
int | numplanes | |||
) | [inline] |
Construct the clipper with a set of planes.
Member Function Documentation
AI_SDB_VisitorFlags AI_SDB_PlaneClipper::TestBBox | ( | const AI_BBox & | boxtest, | |
AI_SDB_VisitorFlags | in | |||
) | [inline] |
Test a bounding box against the planes. Returns true if the geometry is completely contained within the region surrounded by the planes. Returns false if the geometry is definitively outside the region. Returns whatever TestResult() state you passed in if the geometry is not definitively inside or outside of the region, possibly with some of the active_flags turned off.
AI_SDB_VisitorFlags AI_SDB_PlaneClipper::TestSphere | ( | const AI_Sphere & | spheretest, | |
AI_SDB_VisitorFlags | in | |||
) | [inline] |
Test a bounding AI_Sphere against the planes. Returns true if the geometry is completely contained within the region surrounded by the planes. Returns false if the geometry is definitively outside the region. Returns whatever TestResult() state you passed in if the geometry is not definitively inside or outside of the region, possibly with some of the active_flags turned off.
AI_SDB_VisitorFlags AI_SDB_PlaneClipper::TestPoint | ( | const AI_Vector3 & | pointtest, | |
AI_SDB_VisitorFlags | in | |||
) | [inline] |
Test a point against the planes. Returns true if the geometry is completely or partially contained within the region surrounded by the planes.
Member Data Documentation
AI_Plane AI_SDB_PlaneClipper::m_planes[AI_SDB_PLANECLIPPER_MAXPLANES] [protected] |
int AI_SDB_PlaneClipper::m_numplanes [protected] |
The documentation for this class was generated from the following file: