br_matrix4
It can be noted that the bottom row has a translational effect. Also note, that the matrix determinant represents the volume change effected.
typedef
matrix.h
for precise declaration and ordering)
br_scalar m[4][4] Four rows of four columns
BrActorToScreenMatrix4()
83
.
BrEulerToMatrix4()
121
, BrQuatToMatrix4()
315
, BrMatrix34Copy4()
206
.
br_matrix34
187
, br_renderbounds_cbfn
307
.
This matrix can also be thought of as an array of four Members
Each element of the matrix can be freely and individually accessed.br_scalar m[4][4]
br_vector4
365br_vector4 m[4]
. Thus m[row]
can be cast as (br_vector4*)
.
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:BrMatrix4Mul()
void BrMatrix4Mul(br_matrix4* A, const br_matrix4* B, const br_matrix4* C)
br_matrix4 * A
const br_matrix4 * B
const br_matrix4 * C
A
is equivalent to the following:
BrMatrix4Pre34()
219,
BrMatrix4PreTransform()
220
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 3D affine matrix. Equivalent to the expression:BrMatrix4Inverse()
br_scalar BrMatrix4Inverse(br_matrix4* A, const br_matrix4* B)
br_matrix4 * A
const br_matrix4 * B
br_scalar
double
precision arithmetic, this does not necessarily mean that it can using the br_scalar
332 type. This difference is most marked between fixed and floating point BRender libraries.
See Also:
BrMatrix4Adjoint()
220
, BrMatrix4Determinant()
221
.
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 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), 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.
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.
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.
A pointer to the subject matrix (may be same as
A pointer to the pre-multiplying matrix.
A pointer to the subject matrix.
The pre-multiplying generic transform.
A pointer to the destination matrix (may be same as source).
A pointer to the source matrix.
A pointer to the source matrix.
The determinant of the source matrix.
A pointer to the destination Euler angle set to receive the conversion. The Euler angle set's Euler order is used to determine each angle.
A pointer to the source matrix to convert from.
Returns
A pointer to the destination quaternion to receive the conversion.
A pointer to the source matrix to convert from.
Returns
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.
A pointer to the source 3x4 matrix.
A pointer to the destination matrix.
A pointer to the destination matrix.
Scaling component along the x axis.
Scaling component along the y axis.
Scaling component along the z axis.
A pointer to the destination matrix to receive the perspective transform.
Field of view, i.e. the angle subtended at the camera between the top and bottom of the view volume.
Scaling factor for width of viewing volume, i.e. xb1 1 in y view ordinates is mapped to the height of the output image, and xb1
z ordinate of front of view volume. The value should be less than zero.
z ordinate of back of view volume. The value should be less than
Note that the front clip plane is at a homogenous screen z ordinate of -1.
Description:
Applies a transform to a 3D point which may have non-unity homogenous co-ordinates. Equivalent to the expression:BrMatrix4Apply()
void BrMatrix4Apply(br_vector4* A, const br_vector4* B, const br_matrix4* C)
br_vector4 * A
const br_vector4 * B
const br_matrix4 * C
A
is equivalent to the following:
Description:
Applies a transform to a 3D point. Equivalent to the expression:BrMatrix4ApplyP()
void BrMatrix4ApplyP(br_vector4* A, const br_vector3* B, const br_matrix4* C)
br_vector4 * A
const br_vector3 * B
const br_matrix4 * C
A
is equivalent to the following:
Description:
Applies a transform to a 3D vector, i.e. as for a point but without translation components (a vector has no location). Equivalent to the expression:BrMatrix4ApplyV()
void BrMatrix4ApplyV(br_vector4* A, const br_vector3* B, const br_matrix4* C)
br_vector4 * A
const br_vector3 * B
const br_matrix4 * C
A
is equivalent to the following:
Description:
Applies a transform to a transposed 3D point which may have non-unity homogenous co-ordinates. Equivalent to the expression:BrMatrix4TApply()
void BrMatrix4TApply(br_vector4* A, const br_vector4* B, const br_matrix4* C)
br_vector4 * A
const br_vector4 * B
const br_matrix4 * C
A
is equivalent to the following:
Description:
Applies a transposed transform to a 3D point. Equivalent to the expression:BrMatrix4TApplyP()
void BrMatrix4TApplyP(br_vector4* A, const br_vector3* B, const br_matrix4* C)
br_vector4 * A
const br_vector3 * B
const br_matrix4 * C
A
is equivalent to the following:
Description:
Applies a transposed transform to a 3D vector, i.e. as for a point but without translation components (a vector has no location). Equivalent to the expression:BrMatrix4TApplyV()
void BrMatrix4TApplyV(br_vector4* A, const br_vector3* B, const br_matrix4* C)
br_vector4 * A
const br_vector3 * B
const br_matrix4 * C
A
is equivalent to the following:
Description:
Pre-multiply one matrix by another. Equivalent to the expression:BrMatrix4Pre34()
void BrMatrix4Pre34(br_matrix4* A, const br_matrix34* B)
br_matrix4 * A
B
).const br_matrix34 * B
A
is equivalent to the following:
BrMatrix4Mul()
215.
Description:
Pre-multiply a matrix by a generic transform. Equivalent to the expression:BrMatrix4PreTransform()
void BrMatrix4PreTransform(br_matrix4* mat, const br_transform* xform)
br_matrix4 * mat
const br_transform * xform
BrTransformToMatrix34()
343 and then applied as a pre-multiplying matrix using
BrMatrix4Pre34()
219
Description:
Find the adjoint of a matrix - the transposed matrix of co-factors. Equivalent to the expression:BrMatrix4Adjoint()
void BrMatrix4Adjoint(br_matrix4* A, const br_matrix4* B)
br_matrix4 * A
const br_matrix4 * B
BrMatrix4Inverse()
215.
Description:
Calculate the determinant of a matrix. Equivalent to the expression:BrMatrix4Determinant()
br_scalar BrMatrix4Determinant(const br_matrix4* mat)
const br_matrix4 * mat
br_scalar
BrMatrix4Inverse()
215.
Conversion
From Eulers and Quaternions
See BrEulerToMatrix4()
121,
BrQuatToMatrix4()
315 To Eulers and Quaternions
See BrMatrix4ToEuler()
221,
BrMatrix4ToQuat()
222
Description:
Convert a 3D affine matrix to a Euler angle set, that would have the same rotational effect.BrMatrix4ToEuler()
br_euler* BrMatrix4ToEuler(br_euler* euler, const br_matrix4* mat)
br_euler * euler
const br_matrix4 * mat
br_euler *
euler
for convenience.
Description:
Convert a 3D affine matrix to a quaternion, that would have the same rotational effect.BrMatrix4ToQuat()
br_quat* BrMatrix4ToQuat(br_quat* q, const br_matrix4* mat)
br_quat * q
const br_matrix4 * mat
br_quat * q
q
for convenience.
Copy/Assign
Although copy by structure assignment currently works, use BrMatrix4Copy()
222 to ensure compatibility.
Description:
Copy a matrix. Equivalent to the expression:BrMatrix4Copy()
void BrMatrix4Copy(br_matrix4* A, const br_matrix4* B)
br_matrix4 * A
const br_matrix4 * B
Description:
Copy a 3x4 matrix into a 4x4 matrix. Equivalent to the expression:BrMatrix4Copy34()
void BrMatrix4Copy34(br_matrix4* A, const br_matrix34* B)
br_matrix4 * A
const br_matrix34 * B
BrMatrix34Copy4()
206.
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, four BR_VECTOR4()
macros would serve as well. or any of the following initialisation functions.
Description:
Set the specified matrix to the identity transformation matrix. Equivalent to:BrMatrix4Identity()
void BrMatrix4Identity(br_matrix4* mat)
br_matrix4 * mat
Description:
Set the specified matrix to a matrix representing a specific scaling. Equivalent to:BrMatrix4Scale()
void BrMatrix4Scale(br_matrix4* mat, br_scalar sx, br_scalar sy, br_scalar sz)
br_matrix4 * mat
br_scalar sx
br_scalar sy
br_scalar sz
Description:
Generate a perspective transformation matrix, that can be used to convert from a camera actor's co-ordinate space into the homogenous screen space (assuming a centred projection). This maps the viewing volume into the rendering volume, a cuboid delimited by the homogenous screen co-ordinates (left, bottom, near) (1,1,+1) to (+1,+1,1). The matrix created is equivalent to the following (a=field of view).BrMatrix4Perspective()
void BrMatrix4Perspective(br_matrix4* mat, br_angle field_of_view, br_scalar aspect, br_scalar hither, br_scalar yon)
br_matrix4 * mat
br_angle field_of_view
br_scalar aspect
aspect
in x view ordinates is mapped to the width of the output image.br_scalar hither
br_scalar yon
hither
.mat
.hither
and yon
are of opposite sign to the comparable values of hither_z
and yon_z
that would be specified in br_camera
107. This is because they are ordinates as opposed to distances.
br_camera
107,
BrActorToScreenMatrix4()
83
Generated with CERN WebMaker