47#define ANIM_STEER_NEW 0
48#define ANIM_STEER_END 1
50#define VSUBUNIT(a, b, c) { \
54#define FVSCAN(f, a) fscanf(f, "%lf %lf %lf", (a), (a)+1, (a)+2)
55#define FMATSCAN(f, m) { \
61#define VSCAN(a) scanf("%lf %lf %lf", (a), (a)+1, (a)+2)
62#define VPRINTS(t, a) printf("%s %f %f %f ", t, (a)[0], (a)[1], (a)[2])
63#define VPRINTN(t, a) printf("%s %f %f %f\n", t, (a)[0], (a)[1], (a)[2])
65#define MAT_MOVE(m, n) MAT_COPY(m, n)
72 int _j; for (_j=0;_j<9;_j++) m[_j]=0.0;}
75 int _j; for (_j=0;_j<9;_j++) m[_j]=0.0;\
76 m[0] = m[4] = m[8] = 1.0;}
78#define MAT3MUL(o, a, b) {\
79 (o)[0] = (a)[0]*(b)[0] + (a)[1]*(b)[3] + (a)[2]*(b)[6];\
80 (o)[1] = (a)[0]*(b)[1] + (a)[1]*(b)[4] + (a)[2]*(b)[7];\
81 (o)[2] = (a)[0]*(b)[2] + (a)[1]*(b)[5] + (a)[2]*(b)[8];\
82 (o)[3] = (a)[3]*(b)[0] + (a)[4]*(b)[3] + (a)[5]*(b)[6];\
83 (o)[4] = (a)[3]*(b)[1] + (a)[4]*(b)[4] + (a)[5]*(b)[7];\
84 (o)[5] = (a)[3]*(b)[2] + (a)[4]*(b)[5] + (a)[5]*(b)[8];\
85 (o)[6] = (a)[6]*(b)[0] + (a)[7]*(b)[3] + (a)[8]*(b)[6];\
86 (o)[7] = (a)[6]*(b)[1] + (a)[7]*(b)[4] + (a)[8]*(b)[7];\
87 (o)[8] = (a)[6]*(b)[2] + (a)[7]*(b)[5] + (a)[8]*(b)[8];}
89#define MAT3SUM(o, a, b) {\
90 int _j; for (_j=0;_j<9;_j++) (o)[_j]=(a)[_j]+(b)[_j];}
92#define MAT3DIF(o, a, b) {\
93 int _j; for (_j=0;_j<9;_j++) (o)[_j]=(a)[_j]-(b)[_j];}
95#define MAT3SCALE(o, a, s) {\
96 int _j; for (_j=0;_j<9;_j++) (o)[_j]=(a)[_j] * (s);}
98#define MAT3MOVE(o, a) {\
99 int _j; for (_j=0;_j<9;_j++) (o)[_j] = (a)[_j];}
101#define MAT3XVEC(u, m, v) {\
102 (u)[0] = (m)[0]*(v)[0] + (m)[1]*(v)[1] + (m)[2]*(v)[2];\
103 (u)[1] = (m)[3]*(v)[0] + (m)[4]*(v)[1] + (m)[5]*(v)[2];\
104 (u)[2] = (m)[6]*(v)[0] + (m)[7]*(v)[1] + (m)[8]*(v)[2];}
106#define MAT3TO4(o, i) {\
116 (o)[3]=(o)[7]=(o)[11]=(o)[12]=(o)[13]=(o)[14]=0.0;\
119#define MAT4TO3(o, i) {\
131#define MAKE_TILDE(m, v) {\
133 m[1]= -v[2]; m[2]=v[1]; m[3]= v[2];\
134 m[5]= -v[0]; m[6]= -v[1]; m[7]= v[0];}
137#define INERTIAL_MAT3(m, a, b) {\
138 (m)[0] = (a)[0]; (m)[1] = -(b)[0]; (m)[2] = -(b)[1];\
139 (m)[3] = -(b)[0]; (m)[4] = (a)[1]; (m)[5] = -(b)[2];\
140 (m)[6] = -(b)[1]; (m)[7] = -(b)[2]; (m)[8]= (a)[2];}
204 const mat_t viewrot);
Header file for the BRL-CAD common definitions.
void anim_view_rev(mat_t m)
Reverse the direction of a view matrix, keeping it right-side up.
void anim_v_unpermute(mat_t m)
Undo the mapping done by anim_v_permute().
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....
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,...
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,...
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,...
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,...
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 y...
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_mat_print(FILE *fp, const mat_t m, int s_colon)
print out 4X4 matrix, with optional colon
void anim_rotatez(fastf_t a, vect_t d)
Rotate the vector "d" through "a" radians about the z-axis.
void anim_tran(mat_t m)
Transpose matrix in place.
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,...
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 performin...
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,...
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 quaternio...
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 permutatio...
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,...
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....
int anim_mat2ypr(mat_t viewrot, vect_t angle)
Convert the rotational part of a 4x4 transformation matrix to yaw-pitch-roll form,...
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_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,...
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,...
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 ...
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 g...
void float float float * z
void int char int int double double * dx
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
double fastf_t
fastest 64-bit (or larger) floating point type
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
hvect_t quat_t
4-element quaternion
fundamental vector, matrix, quaternion math macros