Files | |
file | tabdata.c |
Routines for processing tables (curves) of data with one independent parameter which is common to many sets of dependent data values. | |
Functions | |
void | anim_v_permute (mat_t m) |
Pre-multiply a rotation matrix by a matrix which maps the z-axis to the negative x-axis, the y-axis to the z-axis and the x-axis to the negative y-axis. | |
void | anim_v_unpermute (mat_t m) |
Undo the mapping done by anim_v_permute(). | |
void | anim_tran (mat_t m) |
Transpose matrix in place. | |
int | anim_mat2zyx (const mat_t viewrot, vect_t angle) |
Convert the rotational part of a 4x4 transformation matrix to zyx form, that is to say, rotations carried out in the order z, y, and then x. The angles are stored in radians as a vector in the order x, y, z. A return value of ERROR1 means that arbitrary assumptions were necessary. ERROR2 means that the conversion failed. | |
int | anim_mat2ypr (mat_t viewrot, vect_t angle) |
Convert the rotational part of a 4x4 transformation matrix to yaw-pitch-roll form, that is to say, +roll degrees about the x-axis, -pitch degrees about the y-axis, and +yaw degrees about the z-axis. The angles are stored in radians as a vector in the order y, p, r. A return of ERROR1 means that arbitrary assumptions were necessary. ERROR2 means that the conversion failed. | |
int | anim_mat2quat (quat_t quat, const mat_t viewrot) |
This interprets the rotational part of a 4x4 transformation matrix in terms of unit quaternions. The result is stored as a vector in the order x, y, z, w. The algorithm is from Ken Shoemake, Animating Rotation with Quaternion Curves, 1985 SIGGraph Conference Proceeding, p.245. | |
void | anim_ypr2mat (mat_t m, const vect_t a) |
Create a premultiplication rotation matrix to turn the front of an object (its x-axis) to the given yaw, pitch, and roll, which is stored in radians in the vector a. | |
void | anim_ypr2vmat (mat_t m, const vect_t a) |
Create a post-multiplication rotation matrix, which could be used to move the virtual camera to the given yaw, pitch, and roll, which are stored in radians in the given vector a. The following are equivalent sets of commands: | |
void | anim_y_p_r2mat (mat_t m, double y, double p, double r) |
Make matrix to rotate an object to the given yaw, pitch, and roll. (Specified in radians.). | |
void | anim_dy_p_r2mat (mat_t m, double y, double p, double r) |
Make matrix to rotate an object to the given yaw, pitch, and roll. (Specified in degrees.). | |
void | anim_dy_p_r2vmat (mat_t m, double yaw, double pch, double rll) |
Make a view rotation matrix, given desired yaw, pitch and roll. (Note that the matrix is a permutation of the object rotation matrix). | |
void | anim_x_y_z2mat (mat_t m, double x, double y, double z) |
Make a rotation matrix corresponding to a rotation of "x" radians about the x-axis, "y" radians about the y-axis, and then "z" radians about the z-axis. | |
void | anim_dx_y_z2mat (mat_t m, double x, double y, double z) |
Make a rotation matrix corresponding to a rotation of "x" degrees about the x-axis, "y" degrees about the y-axis, and then "z" degrees about the z-axis. | |
void | anim_zyx2mat (mat_t m, const vect_t a) |
Make a rotation matrix corresponding to a rotation of "z" radians about the z-axis, "y" radians about the y-axis, and then "x" radians about the x-axis. | |
void | anim_z_y_x2mat (mat_t m, double x, double y, double z) |
Make a rotation matrix corresponding to a rotation of "z" radians about the z-axis, "y" radians about the y-axis, and then "x" radians about the x-axis. | |
void | anim_dz_y_x2mat (mat_t m, double x, double y, double z) |
Make a rotation matrix corresponding to a rotation of "z" degrees about the z-axis, "y" degrees about the y-axis, and then "x" degrees about the x-axis. | |
void | anim_quat2mat (mat_t m, const quat_t qq) |
Make 4x4 matrix from the given quaternion Note: these quaternions are the conjugates of the quaternions used in the librt/qmath.c quat_quat2mat(). | |
void | anim_dir2mat (mat_t m, const vect_t d, const vect_t d2) |
make a matrix which turns a vehicle from the x-axis to point in the desired direction, staying "right-side up" (ie the y-axis never has a z-component). A second direction vector is consulted when the given direction is vertical. This is intended to represent the the direction from a previous frame. | |
void | anim_dirn2mat (mat_t m, const vect_t dx, const vect_t dn) |
make a matrix which turns a vehicle from the x-axis to point in the desired direction, staying "right-side up". In cases where the direction is vertical, the second vector is consulted. The second vector defines a normal to the the vertical plane into which the vehicle's x and z axes should be put. A good choice to put here is the direction of the vehicle's y-axis in the previous frame. | |
int | anim_steer_mat (mat_t mat, vect_t point, int end) |
given the next frame's position, remember the value of the previous frame's position and calculate a matrix which points the x-axis in the direction defined by those two positions. Return new matrix, and the remembered value of the current position, as arguments; return 1 as the normal value, and 0 when there is not yet information to remember. | |
void | anim_add_trans (mat_t m, const vect_t post, const vect_t pre) |
Add pre- and post- translation to a rotation matrix. The resulting matrix has the effect of performing the first translation, followed by the rotation, followed by the second translation. | |
void | anim_rotatez (fastf_t a, vect_t d) |
Rotate the vector "d" through "a" radians about the z-axis. | |
void | anim_mat_print (FILE *fp, const mat_t m, int s_colon) |
print out 4X4 matrix, with optional colon | |
void | anim_mat_printf (FILE *fp, const mat_t m, const char *formstr, const char *linestr, const char *endstr) |
print out 4X4 matrix. formstr must be less than twenty chars | |
void | anim_view_rev (mat_t m) |
Reverse the direction of a view matrix, keeping it right-side up. | |
int | bn_decode_mat (mat_t m, const char *str) |
int | bn_decode_quat (quat_t q, const char *str) |
int | bn_decode_vect (vect_t v, const char *str) |
int | bn_decode_hvect (hvect_t v, const char *str) |
void | bn_encode_mat (struct bu_vls *vp, const mat_t m) |
void | bn_encode_quat (struct bu_vls *vp, const quat_t q) |
void | bn_encode_vect (struct bu_vls *vp, const vect_t v) |
void | bn_encode_hvect (struct bu_vls *vp, const hvect_t v) |
void | bn_tcl_setup () |
int | Bn_Init () |
void | bn_tcl_mat_print () |
void anim_v_permute | ( | mat_t | m | ) |
Pre-multiply a rotation matrix by a matrix which maps the z-axis to the negative x-axis, the y-axis to the z-axis and the x-axis to the negative y-axis.
Routines useful in animation programs.
Orientation conventions: The default object orientation is facing the positive x-axis, with the positive y-axis to the object's left and the positive z-axis above the object.
The default view orientation for rt and mged is facing the negative z-axis, with the negative x-axis leading to the left and the positive y-axis going upwards. This has the effect of twisting an object in the default view orientation into the default object orientation before applying the matrix. Given a matrix designed to operate on an object, yield a matrix which operates on the view.
void anim_v_unpermute | ( | mat_t | m | ) |
Undo the mapping done by anim_v_permute().
This has the effect of twisting an object in the default object orientation into the default view orientation before applying the matrix. Given a matrix designed to operate on the view, yield a matrix which operates on an object.
Convert the rotational part of a 4x4 transformation matrix to zyx form, that is to say, rotations carried out in the order z, y, and then x. The angles are stored in radians as a vector in the order x, y, z. A return value of ERROR1 means that arbitrary assumptions were necessary. ERROR2 means that the conversion failed.
Definition at line 89 of file anim.c.
References ERROR1, ERROR2, M_PI, NORMAL, VDIVIDE_TOL, and ZERO.
Convert the rotational part of a 4x4 transformation matrix to yaw-pitch-roll form, that is to say, +roll degrees about the x-axis, -pitch degrees about the y-axis, and +yaw degrees about the z-axis. The angles are stored in radians as a vector in the order y, p, r. A return of ERROR1 means that arbitrary assumptions were necessary. ERROR2 means that the conversion failed.
Definition at line 149 of file anim.c.
References ERROR1, ERROR2, M_PI, NORMAL, VDIVIDE_TOL, and ZERO.
This interprets the rotational part of a 4x4 transformation matrix in terms of unit quaternions. The result is stored as a vector in the order x, y, z, w. The algorithm is from Ken Shoemake, Animating Rotation with Quaternion Curves, 1985 SIGGraph Conference Proceeding, p.245.
Create a post-multiplication rotation matrix, which could be used to move the virtual camera to the given yaw, pitch, and roll, which are stored in radians in the given vector a. The following are equivalent sets of commands:
ypr2vmat(matrix, a); -- or -- ypr2mat(matrix, a); v_permute(matrix); transpose(matrix;
void anim_y_p_r2mat | ( | mat_t | m, | |
double | y, | |||
double | p, | |||
double | r | |||
) |
void anim_dy_p_r2mat | ( | mat_t | m, | |
double | y, | |||
double | p, | |||
double | r | |||
) |
void anim_dy_p_r2vmat | ( | mat_t | m, | |
double | yaw, | |||
double | pch, | |||
double | rll | |||
) |
void anim_x_y_z2mat | ( | mat_t | m, | |
double | x, | |||
double | y, | |||
double | z | |||
) |
void anim_dx_y_z2mat | ( | mat_t | m, | |
double | x, | |||
double | y, | |||
double | z | |||
) |
void anim_z_y_x2mat | ( | mat_t | m, | |
double | x, | |||
double | y, | |||
double | z | |||
) |
void anim_dz_y_x2mat | ( | mat_t | m, | |
double | x, | |||
double | y, | |||
double | z | |||
) |
make a matrix which turns a vehicle from the x-axis to point in the desired direction, staying "right-side up" (ie the y-axis never has a z-component). A second direction vector is consulted when the given direction is vertical. This is intended to represent the the direction from a previous frame.
Definition at line 580 of file anim.c.
References VDIVIDE_TOL, VMOVE, and VSET.
make a matrix which turns a vehicle from the x-axis to point in the desired direction, staying "right-side up". In cases where the direction is vertical, the second vector is consulted. The second vector defines a normal to the the vertical plane into which the vehicle's x and z axes should be put. A good choice to put here is the direction of the vehicle's y-axis in the previous frame.
Definition at line 624 of file anim.c.
References dx, MAGNITUDE, VDIVIDE_TOL, VMOVE, and VSET.
Referenced by anim_steer_mat().
given the next frame's position, remember the value of the previous frame's position and calculate a matrix which points the x-axis in the direction defined by those two positions. Return new matrix, and the remembered value of the current position, as arguments; return 1 as the normal value, and 0 when there is not yet information to remember.
Definition at line 693 of file anim.c.
References anim_dirn2mat(), ASM_EMPTY, ASM_FIRST, ASM_FULL, VINIT_ZERO, VMOVE, and VSET.
void anim_rotatez | ( | fastf_t | a, | |
vect_t | d | |||
) |
void anim_mat_print | ( | FILE * | fp, | |
const mat_t | m, | |||
int | s_colon | |||
) |
void anim_mat_printf | ( | FILE * | fp, | |
const mat_t | m, | |||
const char * | formstr, | |||
const char * | linestr, | |||
const char * | endstr | |||
) |
void anim_view_rev | ( | mat_t | m | ) |
int bn_decode_mat | ( | mat_t | m, | |
const char * | str | |||
) |
Referenced by bn_math_cmd().
int bn_decode_quat | ( | quat_t | q, | |
const char * | str | |||
) |
Referenced by bn_math_cmd().
int bn_decode_vect | ( | vect_t | v, | |
const char * | str | |||
) |
Referenced by bn_math_cmd().
int bn_decode_hvect | ( | hvect_t | v, | |
const char * | str | |||
) |
Referenced by bn_math_cmd().
void bn_encode_mat | ( | struct bu_vls * | vp, | |
const mat_t | m | |||
) |
void bn_encode_quat | ( | struct bu_vls * | vp, | |
const quat_t | q | |||
) |
Referenced by bn_math_cmd().
void bn_encode_vect | ( | struct bu_vls * | vp, | |
const vect_t | v | |||
) |
void bn_encode_hvect | ( | struct bu_vls * | vp, | |
const hvect_t | v | |||
) |
void bn_tcl_setup | ( | ) |
Referenced by Bn_Init().
int Bn_Init | ( | ) |
void bn_tcl_mat_print | ( | ) |