Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | List of all members
G3D::Plane Class Reference


An infinite 2D plane in 3D space. More...

Public Member Functions

 Plane ()
 
 Plane (const class Any &a)
 Format is: More...
 
 Plane (const Point3 &point0, const Point3 &point1, const Point3 &point2)
 
Constructs a plane from three points. More...
 
 Plane (Vector4 point0, Vector4 point1, Vector4 point2)
 
Constructs a plane from three points, where at most two are at infinity (w = 0, not xyz = inf). More...
 
 Plane (const Vector3 &normal, const Point3 &point)
 
The normal will be unitized. More...
 
 Plane (class BinaryInput &b)
 
virtual ~Plane ()
 
Vector3 center () const
 Returns normal * distance from origin. More...
 
Point3 closestPoint (const Point3 &x) const
 
void deserialize (class BinaryInput &b)
 
float distance (const Vector3 &x) const
 Returns distance from point to plane. More...
 
void flip ()
 
Inverts the facing direction of the plane so the new normal is the inverse of the old normal. More...
 
bool fuzzyContains (const Point3 &point) const
 
Returns true if the point is nearly in the plane. More...
 
void getEquation (Vector3 &normal, double &d) const
 Returns the equation in the form: More...
 
void getEquation (Vector3 &normal, float &d) const
 
void getEquation (double &a, double &b, double &c, double &d) const
 ax + by + cz + d = 0 More...
 
void getEquation (float &a, float &b, float &c, float &d) const
 
bool halfSpaceContains (Point3 point) const
 
Returns true if point is on the side the normal points to or is in the plane. More...
 
bool halfSpaceContains (const Vector4 &point) const
 
Returns true if point is on the side the normal points to or is in the plane. More...
 
bool halfSpaceContainsFinite (const Point3 &point) const
 
Returns true if point is on the side the normal points to or is in the plane. More...
 
const Vector3normal () const
 
void serialize (class BinaryOutput &b) const
 
Any toAny () const
 
String toString () const
 

Static Public Member Functions

static Plane fromEquation (float a, float b, float c, float d)
 

Detailed Description


An infinite 2D plane in 3D space.

Constructor & Destructor Documentation

◆ Plane() [1/6]

G3D::Plane::Plane ( )
inline

◆ Plane() [2/6]

G3D::Plane::Plane ( const class Any a)
explicit

Format is:

  • Plane(normal, point)

◆ Plane() [3/6]

G3D::Plane::Plane ( const Point3 point0,
const Point3 point1,
const Point3 point2 
)


Constructs a plane from three points.

Counterclockwise winding direction

◆ Plane() [4/6]

G3D::Plane::Plane ( Vector4  point0,
Vector4  point1,
Vector4  point2 
)


Constructs a plane from three points, where at most two are at infinity (w = 0, not xyz = inf).

◆ Plane() [5/6]

G3D::Plane::Plane ( const Vector3 normal,
const Point3 point 
)


The normal will be unitized.

◆ Plane() [6/6]

G3D::Plane::Plane ( class BinaryInput b)

◆ ~Plane()

virtual G3D::Plane::~Plane ( )
inlinevirtual

Member Function Documentation

◆ center()

Vector3 G3D::Plane::center ( ) const
inline

Returns normal * distance from origin.

Referenced by G3D::PlaneShape::boundingSphere(), and G3D::PlaneShape::center().

◆ closestPoint()

Point3 G3D::Plane::closestPoint ( const Point3 x) const
inline

◆ deserialize()

void G3D::Plane::deserialize ( class BinaryInput b)

◆ distance()

float G3D::Plane::distance ( const Vector3 x) const
inline

Returns distance from point to plane.

Distance is negative if point is behind (not in plane in direction opposite normal) the plane.

Referenced by closestPoint().

◆ flip()

void G3D::Plane::flip ( )


Inverts the facing direction of the plane so the new normal is the inverse of the old normal.

◆ fromEquation()

static Plane G3D::Plane::fromEquation ( float  a,
float  b,
float  c,
float  d 
)
static

◆ fuzzyContains()

bool G3D::Plane::fuzzyContains ( const Point3 point) const
inline


Returns true if the point is nearly in the plane.

◆ getEquation() [1/4]

void G3D::Plane::getEquation ( Vector3 normal,
double &  d 
) const

Returns the equation in the form:

normal.Dot(Vector3(x, y, z)) + d = 0

◆ getEquation() [2/4]

void G3D::Plane::getEquation ( Vector3 normal,
float &  d 
) const

◆ getEquation() [3/4]

void G3D::Plane::getEquation ( double &  a,
double &  b,
double &  c,
double &  d 
) const

ax + by + cz + d = 0

◆ getEquation() [4/4]

void G3D::Plane::getEquation ( float &  a,
float &  b,
float &  c,
float &  d 
) const

◆ halfSpaceContains() [1/2]

bool G3D::Plane::halfSpaceContains ( Point3  point) const
inline


Returns true if point is on the side the normal points to or is in the plane.

Referenced by halfSpaceContains().

◆ halfSpaceContains() [2/2]

bool G3D::Plane::halfSpaceContains ( const Vector4 point) const
inline


Returns true if point is on the side the normal points to or is in the plane.

◆ halfSpaceContainsFinite()

bool G3D::Plane::halfSpaceContainsFinite ( const Point3 point) const
inline


Returns true if point is on the side the normal points to or is in the plane.

Only call on finite points. Faster than halfSpaceContains.

◆ normal()

const Vector3& G3D::Plane::normal ( ) const
inline

◆ serialize()

void G3D::Plane::serialize ( class BinaryOutput b) const

◆ toAny()

Any G3D::Plane::toAny ( ) const

◆ toString()

String G3D::Plane::toString ( ) const

documentation generated on Wed Nov 24 2021 08:01:59 using doxygen 1.8.15