C4 Engine API Documentation

class Transform4D

Defined in:  `TSMatrix4D.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::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::MakeRotationX` Returns a matrix that represents a rotation about the x axis. `Transform4D::MakeRotationY` Returns a matrix that represents a rotation about the y axis. `Transform4D::MakeRotationZ` Returns a matrix that represents a rotation about the z axis. `Transform4D::MakeRotation` Returns a matrix that represents a rotation about a given axis. `Transform4D::MakeScale` Returns a matrix that represents a scale.
Constructor

`Transform4D();`

`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);`

`Transform4D(const Vector3D& a, const Vector3D& b, const Vector3D& c, const Point3D& p);`

`Transform4D(const Matrix3D& m);`

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

Parameters
 `nij` The value of the entry residing in row i and column j. `a` The values of the entries residing in first column. `b` The values of the entries residing in second column. `c` The values of the entries residing in third column. `p` The values of the entries residing in fourth column. `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.
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).
 `Vector3D& operator [](machine 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 [](machine 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 Antivector4D& v, const Transform4D& m);` Returns the product of the row antivector `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 coordinate of `v` is assumed to be 0. `Bivector3D operator *(const Bivector3D& v, const Transform4D& m);` Returns the product of the bivector `v` and the upper-left 3 × 3 portion of the matrix `m`. `Point3D operator *(const Transform4D& m, const Point3D& p);` Returns the product of the matrix `m` and the column vector `p`. The w coordinate 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 coordinates 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 coordinate of `p` is assumed to be 0, and the w coordinate 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).
`Matrix4D`
`Matrix3D`
`Vector3D`
`Point3D`