Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::Plane Class Reference

#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)
 
Planeoperator= (const Plane &p)
 

Public Attributes

float mA
 
float mB
 
float mC
 
float mD
 
Vector3D mPointOnPlane
 

Detailed Description

A 3d plane with a normal and distance, as well as a point on the plane.

Constructor & Destructor Documentation

◆ Plane() [1/2]

Ult::Plane::Plane ( )

Plane constructor.

◆ Plane() [2/2]

Ult::Plane::Plane ( const float a,
const float b,
const float c,
const float d )

Plane constructor with input normal/distance values.

Member Function Documentation

◆ ClassifyPoint() [1/4]

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

◆ ClassifyPoint() [2/4]

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.

◆ ClassifyPoint() [3/4]

PlaneStatus Ult::Plane::ClassifyPoint ( const Vector3D & v) const

Returns where the input point is located relative to the plane

◆ ClassifyPoint() [4/4]

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.

◆ ClipTriangle()

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.

◆ CreatePlaneFromTri()

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.

◆ GetDistance() [1/2]

float Ult::Plane::GetDistance ( const float x,
const float y,
const float z ) const

Calculates the input point's distance from the plane.

◆ GetDistance() [2/2]

float Ult::Plane::GetDistance ( const Vector3D & v) const

Calculates the input point's distance from the plane.

◆ GetNormal()

Vector3D Ult::Plane::GetNormal ( ) const
inline

Returns a vector of the plane's normal (a, b, and c values).

◆ Intersect() [1/4]

bool Ult::Plane::Intersect ( const OBB & obb)

Returns true if the input OBB intersects with the plane.

◆ Intersect() [2/4]

bool Ult::Plane::Intersect ( const Plane & pl,
Vector3D * intersectPoint ) const

Returns true if the input plane intersects with this one, and stores the point of intersection (if intersects) in intersectPoint if given.

◆ Intersect() [3/4]

bool Ult::Plane::Intersect ( const Vector3D & bbMin,
const Vector3D & bbMax ) const

Returns true if the input bounding-box (represented by its min and max points) intersects with the plane.

◆ Intersect() [4/4]

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.

◆ operator=()

Plane & Ult::Plane::operator= ( const Plane & p)
inline

Sets this plane's values to the input plane's.

◆ operator==()

bool Ult::Plane::operator== ( const Plane & p)
inline

Checks if this and the input plane are equal based on the normal (a,b,c) and distance (d) values.

◆ Reflect()

Vector3D Ult::Plane::Reflect ( const Vector3D & vec,
const float e ) const

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.

◆ SetNormal()

void Ult::Plane::SetNormal ( const Vector3D & n)
inline

Sets the plane's normal (a, b, and c values).

◆ SetPointOnPlane()

void Ult::Plane::SetPointOnPlane ( const Vector3D & p)
inline

Sets the point component of the plane.

Member Data Documentation

◆ mA

float Ult::Plane::mA

The normal (abc) and distance (d) values of the plane

◆ mB

float Ult::Plane::mB

◆ mC

float Ult::Plane::mC

◆ mD

float Ult::Plane::mD

◆ mPointOnPlane

Vector3D Ult::Plane::mPointOnPlane

A point on the plane.


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