BRL-CAD
|
Matrix and vector functionality. More...
Macros | |
#define | bn_mat_zero(_m) |
#define | bn_mat_idn(_m) |
#define | bn_mat_copy(_d, _s) |
Variables | |
const mat_t | bn_mat_identity |
Matrix and vector functionality.
A wrapper for the system atan2(). On the Silicon Graphics, and perhaps on others, x==0 incorrectly returns infinity.
Multiply matrix "a" by "b" and store the result in "o".
This is different from multiplying "b" by "a" (most of the time!) Also, "o" must not be the same as either of the inputs.
o = i * o
A convenience wrapper for bn_mat_mul() to update a matrix in place. The argument ordering is confusing either way.
o = a * b * c
The output matrix may be the same as 'b' or 'c', but may not be 'a'.
o = a * b * c * d
The output matrix may be the same as any input matrix.
Multiply the matrix "im" by the vector "iv" and store the result in the vector "ov". Note this is post-multiply, and operates on 4-tuples. Use MAT4X3VEC() to operate on 3-tuples.
The matrix pointed at by "input" is inverted and stored in the area pointed at by "output".
Calls bu_bomb if matrix is singular.
The matrix pointed at by "input" is inverted and stored in the area pointed at by "output".
Invert a 4-by-4 matrix using Algorithm 120 from ACM. This is a modified Gauss-Jordan algorithm. Note: Inversion is done in place, with 3 work vectors.
Takes a pointer to a [x, y, z] vector, and a pointer to space for a homogeneous vector [x, y, z, w], and builds [x, y, z, 1].
Takes a pointer to [x, y, z, w], and converts it to an ordinary vector [x/w, y/w, z/w]. Optimization for the case of w==1 is performed.
Compute a 4x4 rotation matrix given Azimuth and Elevation.
Azimuth is +X, Elevation is +Z, both in degrees.
Formula due to Doug Gwyn, BRL.
Find the azimuth and elevation angles that correspond to the direction (not including twist) given by a direction vector.
|
extern |
Find the azimuth, elevation, and twist from two vectors. Vec_ae is in the direction of view (+z in mged view) and vec_twist points to the viewers right (+x in mged view). Accuracy (degrees) is used to stabilize flutter between equivalent extremes of atan2(), and to snap twist to zero when elevation is near +/- 90
Find a unit vector from the origin given azimuth and elevation.
Find a vector from the origin given azimuth, elevation, and distance.
This routine builds a Homogeneous rotation matrix, given alpha, beta, and gamma as angles of rotation, in degrees.
Alpha is angle of rotation about the X axis, and is done third. Beta is angle of rotation about the Y axis, and is done second. Gamma is angle of rotation about Z axis, and is done first.
This routine builds a Homogeneous rotation matrix, given alpha, beta, and gamma as angles of rotation, in radians.
Alpha is angle of rotation about the X axis, and is done third. Beta is angle of rotation about the Y axis, and is done second. Gamma is angle of rotation about Z axis, and is done first.
|
extern |
Find the eigenvalues and eigenvectors of a symmetric 2x2 matrix. (a b) (b c)
The eigenvalue with the smallest absolute value is returned in val1, with its eigenvector in vec1.
Given a vector, create another vector which is perpendicular to it. The output vector will have unit length only if the input vector did.
|
extern |
Given two vectors, compute a rotation matrix that will transform space by the angle between the two. There are many candidate matrices.
The input 'from' and 'to' vectors need not be unit length. MAT4X3VEC(to, m, from) is the identity that is created.
Given the sin and cos of an X rotation angle, produce the rotation matrix.
Given the sin and cos of a Y rotation angle, produce the rotation matrix.
Given the sin and cos of a Z rotation angle, produce the rotation matrix.
Given a direction vector D of unit length, product a matrix which rotates that vector D onto the -Z axis. This matrix will be suitable for use as a "model2view" matrix.
XXX This routine will fail if the vector is already more or less aligned with the Z axis.
This is done in several steps.
Build a matrix to scale uniformly around a given point.
Build a matrix to apply arbitrary 4x4 transformation around a given point.
This routine is intended for detecting identity matrices read in from ascii or binary files, where the numbers are pure ones or zeros. This routine is not intended for tolerance-based "near-zero" comparisons; as such, it shouldn't be used on matrices which are the result of calculation.
Construct a transformation matrix for rotation about an arbitrary axis. The axis is defined by a point (pt) and a unit direction vector (dir). The angle of rotation is "ang"
Return a pointer to a copy of the matrix in dynamically allocated memory.
Check to ensure that a rotation matrix preserves axis perpendicularity. Note that not all matrices are rotation matrices.
Calculates the determinant of the 3X3 "rotation" part of the passed matrix.
|
extern |
Given a model-space transformation matrix "change", return a matrix which applies the change with-respect-to given "point" and "direc".
|
extern |
|
extern |