C4 Engine
C4 Engine API Documentation

class Plane3D

Defined in:  TSPlane3D.h
The Plane3D class encapsulates a 3D plane.
Definition

class Plane3D : public Antivec4D<TypePlane3D>

Member Functions
Plane3D::Set Sets all four components of a plane.
Plane3D::Unitize Unitizes the weight of a plane.
Constructor

Plane3D();

Plane3D(float a, float b, float c, float d);

Plane3D(const Bivector3D& n, float d);

Plane3D(const Bivector3D& n, const Point3D& p);

Plane3D(const Point3D& p1, const Point3D& p2, const Point3D& p3);

Parameters
a The value of the x coordinate.
b The value of the y coordinate.
c The value of the z coordinate.
d The value of the w coordinate.
n A 3D bivector whose entries are copied to the x, y, and z coordinates.
p A 3D point lying in the plane.
p1,p2,p3 Three 3D points that lie in the plane.
Description
The Plane3D class is used to store a three-dimensional plane represented as a four-dimensional trivector having floating-point components x, y, z, and w.

The default constructor leaves the components of the plane undefined. If the values a, b, c, and d are supplied, then they are assigned to the x, y, z, and w coordinates of the plane, respectively.

If the p parameter is specified, then the w coordinate is given by −(n ∧ p). If the p1, p2, and p3 parameters are specified, then the plane is set to the triple wedge product p1 ∧ p2 ∧ p3.
Overloaded Operators
floatoperator [](machine k); Returns a reference to the k-th scalar component of a plane. The value of k must be 0, 1, 2, or 3.
const floatoperator [](machine k) const; Returns a constant reference to the k-th scalar component of a plane. The value of k must be 0, 1, 2, or 3.
Plane3D& operator *=(float n); Multiplies by the scalar n.
Plane3D& operator /=(float n); Multiplies by the inverse of the scalar n.
Nonmember Operations
bool operator ==(const Plane3D& g, const Plane3D& h); Returns a boolean value indicating whether the two planes g and h are equal.
bool operator !=(const Plane3D& g, const Plane3D& h); Returns a boolean value indicating whether the two planes g and h are not equal.
const Plane3D& operator ~(const Plane3D& g); Returns the antireverse of the plane g (which is just the plane g itself).
Plane3D operator -(const Plane3D& g); Returns the negation of the plane g.
Plane3D operator *(const Plane3D& g, float n); Returns the product of the plane g and the scalar n.
Plane3D operator *(float n, const Plane3D& g); Returns the product of the plane g and the scalar n.
Plane3D operator /(const Plane3D& g, float n); Returns the product of the plane g and the inverse of the scalar n.
float operator ^(const Vector4D& v, const Plane3D& g); Returns the antiwedge product of the vector v and the plane g.
float operator ^(const Vector3D& v, const Plane3D& g); Returns the antiwedge product of the 3D vector v and the plane g. The w coordinate of v is assumed to be 0.
float operator ^(const Point3D& p, const Plane3D& g); Returns the antiwedge product of the 3D point p and the plane g. The w coordinate of p is assumed to be 1. This gives the distance from a unitized plane represented by a Plane3D object to the point p.
float operator ^(const Point2D& p, const Plane3D& g); Returns the antiwedge product of the 2D point p and the plane g. The z coordinate of p is assumed to be 0, and the w coordinate of p is assumed to be 1. This gives the distance from a unitized plane represented by a Plane3D object to the point p.
Line3D operator ^(const Plane3D& g, const Plane3D& h); Returns the antiwedge product of the planes g and h. The result represents the line where the two planes g and h intersect. The direction of the line is equal to the cross product between the normal component of g and the normal component of h.
Plane3D operator ^(const Line3D& l, const Point3D& p); Returns the wedge product of the bivector l and the point p. The w coordinate of p is assumed to be 1. The result represents the plane containing the line l and the point p, wound from the direction component of l toward the direction to p perpendicular to the line l.
Plane3D operator ^(const Point3D& p, const Line3D& l); Returns the wedge product of the point p and the bivector l, which is the same as l ∧ p. The w coordinate of p is assumed to be 1.
Plane3D operator ^(const Line3D& l, const Vector3D& v); Returns the wedge product of the bivector l and the direction v. The w coordinate of v is assumed to be 0. The result represents the plane containing the line l and the direction v, wound from the direction component of l toward the direction v.
Plane3D operator ^(const Vector3D& v, const Line3D& l); Returns the wedge product of the direction v and the bivector l, which is the same as l ∧ v. The w coordinate of v is assumed to be 0.
Vector4D operator ^(const Line3D& l, const Plane3D& g); Returns the antiwedge product of the bivector L and the plane g. The result represents the homogeneous point where the line and plane intersect. The x, y, and z must be divided by the w coordinate to produce a 3D point.
Vector4D operator ^(const Plane3D& g, const Line3D& l); Returns the antiwedge product of the plane g and the bivector l, which is the same as l ∨ g.
float BulkNorm(const Plane3D& g); Returns the bulk norm of the plane g.
float WeightNorm(const Plane3D& g); Returns the weight norm of the plane g.
Point3D Project(const Point3D& p, const Plane3D& g); Returns the projection of the point p onto the plane g under the assumption that the plane is unitized.
Line3D Project(const Line3D& l, const Plane3D& g); Returns the projection of the line l onto the plane g under the assumption that the plane is unitized.
Plane3D Antiproject(const Plane3D& g, const Point3D& p); Returns the antiprojection of the plane g onto the point p (where p is always unitized because it has an implicit w coordinate of 1).
Plane3D Antiproject(const Plane3D& g, const Line3D& l); Returns the antiprojection of the plane g onto the line l under the assumption that the line is unitized.
Base Classes
Antivec4D Antivectors use a generic base class to store their components.
See Also

Vector4D

Point3D

Point2D