Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
|
#include <Plane.h>
Public Member Functions | |
Plane () | |
Plane (const float a, const float b, const float c, const float d) | |
void | CreatePlaneFromTri (const Vector3D &t1, const Vector3D &t2, const Vector3D &t3) |
bool | Intersect (const Plane &pl, Vector3D *intersectPoint) const |
bool | Intersect (const Vector3D &bbMin, const Vector3D &bbMax) const |
bool | Intersect (const Vector3D &position, const float radius) const |
bool | Intersect (const OBB &obb) |
PlaneStatus | ClassifyPoint (const Vector3D &v) const |
PlaneStatus | ClassifyPoint (const Vector3D &v, float *dist) const |
PlaneStatus | ClassifyPoint (const float x, const float y, const float z) const |
PlaneStatus | ClassifyPoint (const float x, const float y, const float z, float *dist) const |
float | GetDistance (const Vector3D &v) const |
float | GetDistance (const float x, const float y, const float z) const |
Vector3D | Reflect (const Vector3D &vec, const float e) const |
bool | ClipTriangle (Vector3D *inVerts, const int totalInVerts, Vector3D *outFrontVerts, int *totalOutFrontVerts, Vector3D *outBackVerts, int *totalOutBackVerts) |
Vector3D | GetNormal () const |
void | SetNormal (const Vector3D &n) |
void | SetPointOnPlane (const Vector3D &p) |
bool | operator== (const Plane &p) |
Plane & | operator= (const Plane &p) |
Public Attributes | |
float | mA |
float | mB |
float | mC |
float | mD |
Vector3D | mPointOnPlane |
A 3d plane with a normal and distance, as well as a point on the plane.
Ult::Plane::Plane | ( | ) |
Plane constructor.
Ult::Plane::Plane | ( | const float | a, |
const float | b, | ||
const float | c, | ||
const float | d ) |
Plane constructor with input normal/distance values.
PlaneStatus Ult::Plane::ClassifyPoint | ( | const float | x, |
const float | y, | ||
const float | z ) const |
Returns where the input point is located relative to the plane
PlaneStatus Ult::Plane::ClassifyPoint | ( | const float | x, |
const float | y, | ||
const float | z, | ||
float * | dist ) const |
Returns where the input point is located relative to the plane, and stores the point's distance from the plane in 'dist' if given.
PlaneStatus Ult::Plane::ClassifyPoint | ( | const Vector3D & | v | ) | const |
Returns where the input point is located relative to the plane
PlaneStatus Ult::Plane::ClassifyPoint | ( | const Vector3D & | v, |
float * | dist ) const |
Returns where the input point is located relative to the plane, and stores the point's distance from the plane in 'dist' if given.
bool Ult::Plane::ClipTriangle | ( | Vector3D * | inVerts, |
const int | totalInVerts, | ||
Vector3D * | outFrontVerts, | ||
int * | totalOutFrontVerts, | ||
Vector3D * | outBackVerts, | ||
int * | totalOutBackVerts ) |
Splits the input points between those in front of and behind the plane.
void Ult::Plane::CreatePlaneFromTri | ( | const Vector3D & | t1, |
const Vector3D & | t2, | ||
const Vector3D & | t3 ) |
Initializes the plane from three triangle points. Also sets the mPointOnPlane member to t1.
float Ult::Plane::GetDistance | ( | const float | x, |
const float | y, | ||
const float | z ) const |
Calculates the input point's distance from the plane.
float Ult::Plane::GetDistance | ( | const Vector3D & | v | ) | const |
Calculates the input point's distance from the plane.
|
inline |
Returns a vector of the plane's normal (a, b, and c values).
bool Ult::Plane::Intersect | ( | const OBB & | obb | ) |
Returns true if the input OBB intersects with the plane.
Returns true if the input plane intersects with this one, and stores the point of intersection (if intersects) in intersectPoint if given.
Returns true if the input bounding-box (represented by its min and max points) intersects with the plane.
bool Ult::Plane::Intersect | ( | const Vector3D & | position, |
const float | radius ) const |
Returns true if the input sphere (at the given position and radius) intersects with the plane.
Sets this plane's values to the input plane's.
|
inline |
Checks if this and the input plane are equal based on the normal (a,b,c) and distance (d) values.
Calculates the input point's reflection through the plane and returns the result. Input e is a scalar of the plane normal for the reflect calculation.
|
inline |
Sets the plane's normal (a, b, and c values).
|
inline |
Sets the point component of the plane.
float Ult::Plane::mA |
The normal (abc) and distance (d) values of the plane
float Ult::Plane::mB |
float Ult::Plane::mC |
float Ult::Plane::mD |
Vector3D Ult::Plane::mPointOnPlane |
A point on the plane.