anim.c File Reference

Routines useful in animation programs. More...

#include "common.h"
#include <stdio.h>
#include <math.h>
#include "machine.h"
#include "bu.h"
#include "vmath.h"
#include "bn.h"
#include "anim.h"

Include dependency graph for anim.c:

Go to the source code of this file.

Defines

#define M_PI   3.14159265358979323846
#define NORMAL   0
#define ERROR1   1
#define ERROR2   2
#define ASM_EMPTY   0
#define ASM_FIRST   1
#define ASM_FULL   2

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: 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)
 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)
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)
void anim_dir2mat (mat_t m, const vect_t d, const vect_t d2)
void anim_dirn2mat (mat_t m, const vect_t dx, const vect_t dn)
int anim_steer_mat (mat_t mat, vect_t point, int end)
void anim_add_trans (mat_t m, const vect_t post, const vect_t pre)
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)


Detailed Description

Routines useful in animation programs.

Author:
Carl J. Nuzman
Source -
The U. S. Army Research Laboratory
Aberdeen Proving Ground, Maryland 21005-5068 USA
This file includes the following routines:

Definition in file anim.c.


Generated on Mon Sep 18 01:25:02 2006 for BRL-CAD by  doxygen 1.4.6