br_matrix23
Note that this is effectively used as a 33 matrix, but omitting the redundant, third column for storage purposes. Thus:
It is applied to homogenous 2D co-ordinates, which similarly omit the third element for sake of economy.
It can be noted that the bottom row has a translational effect. Also note, that the matrix determinant represents the area change effected.
typedef
matrix.h
for precise declaration and ordering)
br_scalar m[3][2] Three rows of two columns
br_material
151
.
This matrix can also be thought of as an array of three Members
Each element of the matrix can be freely and individually accessed.br_scalar m[3][2]
br_vector2
349br_vector2 m[3]
. Thus m[row]
can be cast as (br_vector2*)
.
A pointer to the destination matrix (must be different from both sources).
Pointer to the left hand source matrix.
Pointer to the right hand source matrix.
Arithmetic
Description:
Multiply two matrices together and place the result in a third matrix. Equivalent to the expression:BrMatrix23Mul()
void BrMatrix23Mul(br_matrix34* A, const br_matrix34* B, const br_matrix34* C)
br_matrix23 * A
const br_matrix23 * B
const br_matrix23 * C
A
is equivalent to the following:BrMatrix23Pre()
176,
BrMatrix23Post()
179
A pointer to the destination matrix (must be different from source).
A pointer to the source matrix.
If the inverse exists, the determinant of the source matrix is returned. If there is no inverse, scalar zero is returned.
Description:
Compute the inverse of the supplied matrix. Equivalent to the expression: BrMatrix23Inverse()
br_scalar BrMatrix23Inverse(br_matrix23* A, const br_matrix23* B)
br_matrix23 * A
const br_matrix23 * B
br_scalar
A
is equivalent to the following:BrMatrix23LPInverse()
173.
Equivalent to the expression:
A pointer to the destination matrix (must be different from source).
A pointer to the source matrix.
Description:
Compute the inverse of the supplied length preserving*1 transformation matrix. The resulting matrix is undefined for non-length preserving matrices.BrMatrix23LPInverse()
void BrMatrix23LPInverse(br_matrix23* A, const br_matrix23* B)
br_matrix23 * A
const br_matrix23 * B
A
is equivalent to the following:BrMatrix23Inverse()
172.
A pointer to the destination vector (must be different from source, and not part of transform), to hold the transformed point.
A pointer to the source vector, holding the point to be transformed.
A pointer to the transform matrix to be applied.
A pointer to the destination vector (must be different from source, and not part of transform), to hold the transformed vector.
A pointer to the source vector, holding the vector to be transformed.
A pointer to the transform matrix to be applied.
A pointer to the destination vector (must be different from source, and not part of transform), to hold the transformed point.
A pointer to the source vector, holding the point to be transformed.
A pointer to the transform matrix to be applied transposed - the translation elements are presumed zero or irrelevant.
A pointer to the destination vector (must be different from source, and not part of transform), to hold the transformed vector.
A pointer to the source vector, holding the vector to be transformed.
A pointer to the transform matrix to be applied transposed - the translation elements are presumed zero or irrelevant.
A pointer to the subject matrix (may be same as
A pointer to the pre-multiplying matrix.
A pointer to the subject matrix.
The x axis component used to form the translation matrix.
The y axis component used to form the translation matrix.
A pointer to the subject matrix.
Scaling component along the x axis.
Scaling component along the y axis.
A pointer to the subject matrix.
Shear factor by which the x co-ordinate is included in the transformed y co-ordinate.
Description:
Applies a transform to a 2D point. Equivalent to the expression:BrMatrix23ApplyP()
void BrMatrix23ApplyP(br_vector2* A, const br_vector2* B, const br_matrix23* C)
br_vector2 * A
const br_vector2 * B
const br_matrix23 * C
A
is equivalent to the following:
Description:
Applies a transform to a 2D vector, i.e. as for a point but without translation components (a vector has no location). Equivalent to the expression:BrMatrix23ApplyV()
void BrMatrix23ApplyV(br_vector2* A, const br_vector2* B, const br_matrix23* C)
br_vector2 * A
const br_vector2 * B
const br_matrix23 * C
A
is equivalent to the following:
Description:
Applies a transposed transform to a 2D point. Equivalent to the expression:BrMatrix23TApplyP()
void BrMatrix23TApplyP(br_vector2* A, const br_vector2* B, const br_matrix23* C)
br_vector2 * A
const br_vector2 * B
const br_matrix23 * C
A
is equivalent to the following:
Description:
Applies a transposed transform to a 2D vector, i.e. as for a point but without translation components (a vector has no location). Equivalent to the expression:BrMatrix23TApplyV()
void BrMatrix23TApplyV(br_vector2* A, const br_vector2* B, const br_matrix23* C)
br_vector2 * A
const br_vector2 * B
const br_matrix23 * C
A
is equivalent to the following:
Description:
Pre-multiply one matrix by another. Equivalent to the expression:BrMatrix23Pre()
void BrMatrix23Pre(br_matrix23* A, const br_matrix23* B)
br_matrix23 * A
B
).const br_matrix23 * B
A
is equivalent to the following:BrMatrix23Post()
179,
BrMatrix23Mul()
172
Description:
Pre-multiply a matrix by a translation transform matrix. Equivalent to the expression:BrMatrix23PreTranslate()
void BrMatrix23PreTranslate(br_matrix23* mat, br_scalar dx, br_scalar dy)
br_matrix23 * mat
br_scalar dx
br_scalar dy
mat
is equivalent to the following:BrMatrix23PostTranslate()
179,
BrMatrix23Translate()
184
Description:
Pre-multiply a matrix by a scaling transform matrix. Equivalent to the expression:BrMatrix23PreScale()
void BrMatrix23PreScale(br_matrix23* mat, br_scalar sx, br_scalar sy)
br_matrix23 * mat
br_scalar sx
br_scalar sy
mat
is equivalent to the following:BrMatrix23PostScale()
180,
BrMatrix23Scale()
185
Description:
Pre-multiply a matrix by an x invariant shearing transform matrix. Equivalent to the expression:BrMatrix23PreShearX()
void BrMatrix23PreShearX(br_matrix23* mat, br_scalar sy)
br_matrix23 * mat
br_scalar sy
mat
is equivalent to the following:BrMatrix23PostShearX()
181,
BrMatrix23ShearX()
177
A pointer to the subject matrix.
Shear factor by which the y co-ordinate is included in the transformed x co-ordinate.
Description:
Pre-multiply a matrix by a y invariant shearing transform matrix. Equivalent to the expression:BrMatrix23PreShearY()
void BrMatrix23PreShearY(br_matrix23* mat, br_scalar sx)
br_matrix23 * mat
br_scalar sx
mat
is equivalent to the following:BrMatrix23PostShearY()
181,
BrMatrix23ShearY()
186
A pointer to the subject matrix.
The clockwise angle about the z axis used to form the rotation matrix.
Description:
Pre-multiply a matrix by a rotational transform matrix. Equivalent to the expression:BrMatrix23PreRotate()
void BrMatrix23PreRotate(br_matrix23* mat, br_angle rz)
br_matrix23 * mat
br_angle rz
mat
is equivalent to the following:BrMatrix23PostRotate()
182,
BrMatrix23Rotate()
186
A pointer to the subject matrix (may be same as
A pointer to the post-multiplying matrix.
Description:
Post-multiply one matrix by another. Equivalent to the expression:BrMatrix23Post()
void BrMatrix23Post(br_matrix23* A, const br_matrix23* B)
br_matrix23 * A
B
).const br_matrix23 * B
A
is equivalent to the following:BrMatrix23Pre()
176,
BrMatrix23Mul()
172.
A pointer to the subject matrix.
The x axis component used to form the translation matrix.
The y axis component used to form the translation matrix.
Description:
Post-multiply a matrix by a translation transform matrix. Equivalent to the expression:BrMatrix23PostTranslate()
void BrMatrix23PostTranslate(br_matrix23* mat, br_scalar dx, br_scalar dy)
br_matrix23 * mat
br_scalar dx
br_scalar dy
mat
is equivalent to the following:BrMatrix23PreTranslate()
176,
BrMatrix23Translate()
184.
A pointer to the subject matrix.
Scaling component along the x axis.
Scaling component along the y axis.
Description:
Post-multiply a matrix by a scaling transform matrix. Equivalent to the expression:BrMatrix23PostScale()
void BrMatrix23PostScale(br_matrix23* mat, br_scalar sx, br_scalar sy)
br_matrix23 * mat
br_scalar sx
br_scalar sy
mat
is equivalent to the following:BrMatrix23PreScale()
177,
BrMatrix23Scale()
185.
A pointer to the subject matrix.
Shear factor by which the x co-ordinate is included in the transformed y coordinate.
Description:
Post-multiply a matrix by an x invariant shearing transform matrix. Equivalent to the expression:BrMatrix23PostShearX()
void BrMatrix23PostShearX(br_matrix23* mat, br_scalar sy)
br_matrix23 * mat
br_scalar sy
mat
is equivalent to the following:BrMatrix23PreShearX()
177,
BrMatrix23ShearX()
185.
A pointer to the subject matrix.
Shear factor by which the y co-ordinate is included in the transformed x coordinate.
Description:
Post-multiply a matrix by a y invariant shearing transform matrix. Equivalent to the expression:BrMatrix23PostShearY()
void BrMatrix23PostShearY(br_matrix23* mat, br_scalar sx)
br_matrix23 * mat
br_scalar sx
mat
is equivalent to the following:BrMatrix23PreShearY()
181,
BrMatrix23ShearY()
186.
A pointer to the subject matrix.
The clockwise angle about the z axis used to form the rotation matrix.
Description:
Post-multiply a matrix by a rotational transform matrix. Equivalent to the expression:BrMatrix23PostRotate()
void BrMatrix23PostRotate(br_matrix23* mat, br_angle rz)
br_matrix23 * mat
br_angle rz
mat
is equivalent to the following:BrMatrix23PreRotate()
178,
BrMatrix23Rotate()
186.
BrMatrix23Copy()
182
to ensure compatibility.
A pointer to the destination matrix (may be the same as source - though redundant).
A pointer to the source matrix.
A pointer to the destination matrix, which must not point to the source matrix.
A pointer to the source matrix.
All other initialisation should use the functions
Description:
Copy a matrix. Equivalent to the expression:BrMatrix23Copy()
void BrMatrix23Copy(br_matrix23* A, const br_matrix23* B)
br_matrix23 * A
const br_matrix23 * B
Access & Maintenance
Members may be freely accessed. Maintenance is only required for length preserving matrices that have been modified.
Description:
Normalise a length preserving*2 matrix. Equivalent to the expression:BrMatrix23LPNormalise()
void BrMatrix23LPNormalise(br_matrix23* A, const br_matrix23* B)
br_matrix23 * A
const br_matrix23 * B
Referencing & Lifetime
This structure may be freely referenced, though take care if there is potential to supply the same matrix as more than one argument to the same function. Initialisation
No static initialisers are provided, however, three BR_VECTOR2()
macros would serve as well.BrMatrix23Identity()
184BrMatrix23Translate()
184BrMatrix23Scale()
185BrMatrix23Shear
[X
|Y
]()
185|186,
BrMatrix23Rotate()
186, or
BrMatrix23Copy()
182.
A pointer to the destination matrix.
A pointer to the destination matrix.
Translation component along the x axis.
Translation component along the y axis.
Description:
Set the specified matrix to the identity transformation matrix. Equivalent to:BrMatrix23Identity()
void BrMatrix23Identity(br_matrix23* mat)
br_matrix23 * mat
Description:
Set the specified matrix to a matrix representing a specific translation. Equivalent to:BrMatrix23Translate()
void BrMatrix23Translate(br_matrix23* mat, br_scalar dx, br_scalar dy)
br_matrix23 * mat
br_scalar dx
br_scalar dy
BrMatrix23PreTranslate()
176,
BrMatrix23PostTranslate()
179
A pointer to the destination matrix.
Scaling component along the x axis.
Scaling component along the y axis.
Description:
Set the specified matrix to a matrix representing a specific scaling. Equivalent to:BrMatrix23Scale()
void BrMatrix23Scale(br_matrix23* mat, br_scalar sx, br_scalar sy)
br_matrix23 * mat
br_scalar sx
br_scalar sy
BrMatrix23PreScale()
177,
BrMatrix23PostScale()
180.
A pointer to the destination matrix.
Shear factor by which the x co-ordinate is included in the transformed y co-ordinate.
Description:
Set the specified matrix to a matrix representing a shear, invariant along the x axis. Thus values of y co-ordinates will be scaled in proportion to the value of the x co-ordinate. Equivalent to:BrMatrix23ShearX()
void BrMatrix23ShearX(br_matrix23* mat, br_scalar sy)
br_matrix23 * mat
br_scalar sy
BrMatrix23PreShearX()
177,
BrMatrix23PostShearX()
181.
A pointer to the destination matrix.
Shear factor by which the y co-ordinate is included in the transformed x co-ordinate.
Description:
Set the specified matrix to a matrix representing a shear, invariant along the y axis. Thus values of x co-ordinates will be scaled in proportion to the value of the y co-ordinate. Equivalent to:BrMatrix23ShearY()
void BrMatrix23ShearX(br_matrix23* mat, br_scalar sx)
br_matrix23 * mat
br_scalar sx
BrMatrix23PreShearY()
178,
BrMatrix23PostShearY()
181.
A pointer to the destination matrix.
Clockwise rotation about the z axis.
Description:
Set the specified matrix to a matrix representing a rotation about the z axis though a specified angle. Equivalent to:BrMatrix23Rotate()
void BrMatrix23Rotate(br_matrix23* mat, br_angle rz)
br_matrix23 * mat
br_angle rz
BrMatrix23PreRotate()
178,
BrMatrix23PostRotate()
182.