C4 Engine Terathon Software C4 Engine API Documentation

• Math Library

API Links
Developer Links

class Transform4D

Defined in:  C4Matrix4D.h
The Transform4D class encapsulates a 4 × 4 matrix whose fourth row is always (0, 0, 0, 1).
Definition

class Transform4D : public Matrix4D

Member Functions
Transform4D::GetMatrix3D Returns the upper-left 3 × 3 portion of a matrix.
Transform4D::SetMatrix3D Sets the entries of the upper-left 3 × 3 portion of a matrix.
Transform4D::GetTranslation Returns the fourth column of a matrix.
Transform4D::SetTranslation Sets the fourth column of a matrix.
Transform4D::SetRotationAboutX Sets a matrix to represent a rotation about the x axis.
Transform4D::SetRotationAboutY Sets a matrix to represent a rotation about the y axis.
Transform4D::SetRotationAboutZ Sets a matrix to represent a rotation about the z axis.
Transform4D::SetRotationAboutAxis Sets a matrix to represent a rotation about a given axis.
Transform4D::SetScale Sets a matrix to represent a scale.
Constructor

Transform4D();

Transform4D(const Matrix3D& m);

Transform4D(const Matrix3D& m, Vector3D& v);

Transform4D(const Vector3D& c1, const Vector3D& c2, const Vector3D& c3, const Point3D& c4);

Transform4D(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13,

float n20, float n21, float n22, float n23);

Parameters
m A 3 × 3 matrix that is copied to the upper-left 3 × 3 portion of the matrix.
v A 3D vector that is copied to the fourth column of the matrix.
c1 The values of the entries residing in first column.
c2 The values of the entries residing in second column.
c3 The values of the entries residing in third column.
c4 The values of the entries residing in fourth column.
nij The value of the entry residing in row i and column j.
Description
The Transform4D class is used to store a 4 × 4 matrix whose fourth row is always (0, 0, 0, 1).

The default constructor leaves the entries of the matrix undefined, including the fourth row. All other constructors set the fourth row to (0, 0, 0, 1).
Overloaded Operators
Vector3D& operator [](long j); Returns a reference to the j-th column of a matrix. j must be 0, 1, or 2. Use the Transform4D::GetTranslation and Transform4D::SetTranslation functions to access the fourth column.
const Vector3D& operator [](long j) const; Returns a constant reference to the j-th column of a matrix. j must be 0, 1, or 2. Use the Transform4D::GetTranslation and Transform4D::SetTranslation functions to access the fourth column.
Transform4D& operator *=(const Transform4D& m); Multiplies by the matrix m.
Transform4D& operator *=(const Matrix3D& m); Multiplies by the matrix m. The entries of the fourth row and fourth column of m are assumed to be those of the identity matrix.
Nonmember Operations
Transform4D operator *(const Transform4D& m1, const Transform4D& m2); Returns the product of the matrices m1 and m2.
Transform4D operator *(const Transform4D& m1, const Matrix4D& m2); Returns the product of the matrices m1 and m2.
Transform4D operator *(const Transform4D& m1, const Matrix3D& m2); Returns the product of the matrices m1 and m2. The entries of the fourth row and fourth column of m2 are assumed to be those of the identity matrix.
Vector4D operator *(const Transform4D& m, const Vector4D& v); Returns the product of the matrix m and the column vector v.
Vector4D operator *(const Vector4D& v, const Transform4D& m); Returns the product of the row vector v and the matrix m.
Vector3D operator *(const Transform4D& m, const Vector3D& v); Returns the product of the matrix m and the column vector v. The w component of v is assumed to be 0.
Vector3D operator *(const Vector3D& v, const Transform4D& m); Returns the product of the row vector v and the matrix m. The w component of v is assumed to be 0.
Point3D operator *(const Transform4D& m, const Point3D& p); Returns the product of the matrix m and the column vector p. The w component of p is assumed to be 1.
Point3D operator *(const Point3D& p, const Transform4D& m); Returns the product of the row vector p and the matrix m. The w component of p is assumed to be 1.
Vector2D operator *(const Transform4D& m, const Vector2D& v); Returns the product of the matrix m and the column vector v. The z and w components of v are assumed to be 0.
Vector2D operator *(const Vector2D& v, const Transform4D& m); Returns the product of the row vector v and the matrix m. The z and w components of v are assumed to be 0.
Point2D operator *(const Transform4D& m, const Point2D& p); Returns the product of the matrix m and the column vector p. The z component of p is assumed to be 0, and the w component of p is assumed to be 1.
Point2D operator *(const Point2D& p, const Transform4D& m); Returns the product of the row vector p and the matrix m. The z component of p is assumed to be 0, and the w component of p is assumed to be 1.
float Determinant(const Transform4D& m); Returns the determinant of the matrix m.
Transform4D Inverse(const Transform4D& m); Returns the inverse of the matrix m. If m is singular, then the result is undefined.
Transform4D Adjugate(const Transform4D& m); Returns the adjugate of the matrix m.
Vector3D InverseTransform(const Transform4D& m, const Vector3D& v); Returns the product of the inverse of the matrix m and the vector v. If m is singular, then the result is undefined.
Point3D InverseTransform(const Transform4D& m, const Point3D& p); Returns the product of the inverse of the matrix m and the point p. If m is singular, then the result is undefined.
Vector3D AdjugateTransform(const Transform4D& m, const Vector3D& v); Returns the product of the adjugate of the matrix m and the vector v.
Point3D AdjugateTransform(const Transform4D& m, const Point3D& p); Returns the product of the adjugate of the matrix m and the point p.
Base Classes
Matrix4D A Transform4D object behaves much like a Matrix4D object, except that the fourth row is always (0, 0, 0, 1).
See Also
Matrix4D

Matrix3D

Vector3D

Point3D