C4 Engine Terathon Software C4 Engine API Documentation

• Math Library

API Links
Developer Links

class Point3D

Defined in:  C4Vector3D.h
The Point3D class encapsulates a 3D point.
Definition

class Point3D : public Vector3D

Constructor

Point3D();

Point3D(float r, float s, float t);

Parameters
r The value of the x coordinate.
s The value of the y coordinate.
t The value of the z coordinate.
Description
The Point3D class is used to store a three-dimensional point having floating-point components x, y, and z. The difference between a point and a vector is that a point is assumed to have a w coordinate of 1 whenever it needs to be converted to a four-dimensional representation, whereas a vector is assumed to have a w coordinate of 0. Such a conversion occurs when a vector or point is assigned to a Vector4D object or is multiplied by a Transform4D object.

The default constructor leaves the components of the vector undefined. If the values r, s, and t are supplied, then they are assigned to the x, y, and z components of the base vector object, respectively.

The difference between two points produces a direction vector. A three-dimensional direction vector is converted to a point by adding it to the identifier Origin3D.
Overloaded Operators
Point3D& operator *=(float t); Multiplies by the scalar t.
Point3D& operator /=(float t); Divides by the scalar t.
Nonmember Operations
Point3D operator -(const Point3D& p); Returns the negation of the point p.
Point3D operator +(const Point3D& p1, const Point3D& p2); Returns the sum of the points p1 and p2.
Point3D operator +(const Point3D& p, const Vector3D& v); Returns the sum of the point p and the vector v.
Vector3D operator -(const Point3D& p1, const Point3D& p2); Returns the difference of the points p1 and p2.
Point3D operator -(const Point3D& p, const Vector3D& v); Returns the difference of the point p and the vector v.
Point3D operator -(const Vector3D& v, const Point3D& p); Returns the difference of the vector v and the point p.
Point3D operator *(const Point3D& p, float t); Returns the product of the point p and the scalar t.
Point3D operator *(float t, const Point3D& p); Returns the product of the point p and the scalar t.
Point3D operator /(const Point3D& p, float t); Returns the product of the point p and the inverse of the scalar t.
float operator *(const Point3D& p1, const Point3D& p2); Returns the dot product of the points p1 and p2.
float operator *(const Point3D& p, const Vector3D& v); Returns the dot product of the point p and the vector v.
float operator *(const Vector3D& v, const Point3D& p); Returns the dot product of the vector v and the point p.
float operator *(const Point3D& p, const Vector2D& v); Returns the dot product of the point p and the vector v.
float operator *(const Vector2D& v, const Point3D& p); Returns the dot product of the vector v and the point p.
Vector3D operator %(const Point3D& p1, const Point3D& p2); Returns the cross product of the points p1 and p2.
Vector3D operator %(const Point3D& p, const Vector3D& v); Returns the cross product of the point p and the vector v.
Vector3D operator %(const Vector3D& v, const Point3D& p); Returns the cross product of the vector v and the point p.
Point3D operator &(const Point3D& p1, const Point3D& p2); Returns the componentwise product of the points p1 and p2.
Point3D operator &(const Point3D& p, const Vector3D& v); Returns the componentwise product of the point p and the vector v.
Point3D operator &(const Vector3D& v, const Point3D& p); Returns the componentwise product of the vector v and the point p.
Base Classes
Vector3D A Point3D object behaves much like a Vector3D object, but some properties are altered.
See Also

Vector3D

Vector4D