C4 Engine
C4 Engine API Documentation

class Trivector4D

Defined in:  TSTrivector4D.h
The Trivector4D class encapsulates a 4D trivector.
Definition

class Trivector4D : public Antivec4D<TypeTrivector4D>

Member Functions
Trivector4D::Set Sets all four components of a trivector.
Trivector4D::Unitize Unitizes the weight of a 4D trivector.
Constructor

Trivector4D();

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

Trivector4D(const Bivector3D& n, float d);

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

Trivector4D(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 Trivector4D class is used to store a four-dimensional trivector having floating-point components x, y, z, and w.

The default constructor leaves the components of the trivector 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 trivector, 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 trivector 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 trivector. 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 trivector. The value of k must be 0, 1, 2, or 3.
Trivector4D& operator *=(float s); Multiplies by the scalar s.
Trivector4D& operator /=(float s); Multiplies by the inverse of the scalar s.
Nonmember Operations
bool operator ==(const Trivector4D& a, const Trivector4D& b); Returns a boolean value indicating whether the two trivectors a and b are equal.
bool operator !=(const Trivector4D& a, const Trivector4D& b); Returns a boolean value indicating whether the two trivectors a and b are not equal.
const Trivector4D& operator ~(const Trivector4D& v); Returns the antireverse of the trivector v (which is just the trivector v itself).
Trivector4D operator -(const Trivector4D& v); Returns the negation of the trivector v.
Trivector4D operator *(const Trivector4D& v, float s); Returns the product of the trivector v and the scalar s.
Trivector4D operator *(float s, const Trivector4D& v); Returns the product of the trivector v and the scalar s.
Trivector4D operator /(const Trivector4D& v, float s); Returns the product of the trivector v and the inverse of the scalar s.
float operator ^(const Vector4D& v, const Trivector4D& f); Returns the antiwedge product of the vector v and the trivector f.
float operator ^(const Vector3D& v, const Trivector4D& f); Returns the antiwedge product of the 3D vector v and the trivector f. The w coordinate of v is assumed to be 0.
float operator ^(const Point3D& p, const Trivector4D& v); Returns the antiwedge product of the 3D point p and the trivector f. The w coordinate of p is assumed to be 1. This gives the distance from a unitized plane represented by a Trivector4D object to the point p.
float operator ^(const Point2D& p, const Trivector4D& f); Returns the antiwedge product of the 2D point p and the trivector f. 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 Trivector4D object to the point p.
float BulkNorm(const Trivector4D& v); Returns the bulk norm of the trivector v.
float WeightNorm(const Trivector4D& v); Returns the weight norm of the trivector v.
Point3D Project(const Point3D& p, const Trivector4D& f); Returns the projection of the point p onto the plane f under the assumption that the plane is unitized.
Trivector4D Antiproject(const Trivector4D& f, const Point3D& p); Returns the antiprojection of the plane f onto the point p (where p is always unitized because it has an implicit w coordinate of 1).
Base Classes
Antivec4D Antivectors use a generic base class to store their components.
See Also

Vector4D

Point3D

Point2D