Biomechanical Joint Model
 Author: Anderson Maciel

VCOLLIDE/demos/rings/quatlib/quat.h File Reference

#include <stdio.h>
#include <math.h>
#include <cm_macros.h>
#include <pdefs.h>

Include dependency graph for VCOLLIDE/demos/rings/quatlib/quat.h:

Go to the source code of this file.

Classes

struct  q_xyz_quat_struct

Defines

#define Q_X   0
#define Q_Y   1
#define Q_Z   2
#define Q_W   3
#define Q_EPSILON   (1e-10)
#define Q_MAX(x, y)   ( ((x) > (y)) ? (x) : (y) )
#define Q_MIN(x, y)   ( ((x) < (y)) ? (x) : (y) )
#define Q_ABS(x)   ( ((x) > 0 ) ? (x) : (-(x)) )
#define Q_PI   3.14159265358979323846
#define Q_ID_QUAT   { 0.0, 0.0, 0.0, 1.0 }
#define Q_ID_MATRIX
#define QP_ID_MATRIX
#define Q_NULL_VECTOR   { 0.0, 0.0, 0.0 }
#define Q_DEG_TO_RAD(deg)   ( ((deg)*Q_PI)/180.0 )
#define Q_RAD_TO_DEG(rad)   ( (((rad)*180.0)/Q_PI) )
#define q_vec_set   q_set_vec

Typedefs

typedef double q_type [4]
typedef double q_vec_type [3]
typedef double q_matrix_type [4][4]
typedef float qgl_matrix_type [4][4]
typedef double qogl_matrix_type [16]
typedef q_xyz_quat_struct q_xyz_quat_type

Functions

 CM_EXTERN_FUNCTION (void q_print,(q_type quat))
 CM_EXTERN_FUNCTION (void q_make,(q_type destQuat, double x, double y, double z, double angle))
 CM_EXTERN_FUNCTION (void q_copy,(q_type destQuat, q_type srcQuat))
 CM_EXTERN_FUNCTION (void q_mult,(q_type destQuat, q_type qLeft, q_type qRight))
 CM_EXTERN_FUNCTION (void q_slerp,(q_typedestQuat, q_type startQuat, q_type endQuat, doublet))
 CM_EXTERN_FUNCTION (void q_from_euler,(q_type destQuat, double yaw, double pitch, double roll))
 CM_EXTERN_FUNCTION (void q_xform,(q_vec_type destVec, q_type q, q_vec_type vec))
 CM_EXTERN_FUNCTION (void q_from_two_vecs,(q_type destQuat, q_vec_type v1, q_vec_type v2))
 CM_EXTERN_FUNCTION (void q_from_vec,(q_type destQuat, q_vec_type srcVec))
 CM_EXTERN_FUNCTION (void q_to_vec,(q_vec_type destVec, q_type srcQuat))
 CM_EXTERN_FUNCTION (void q_from_row_matrix,(q_type destQuat, q_matrix_type matrix))
 CM_EXTERN_FUNCTION (void q_to_row_matrix,(q_matrix_type destMatrix, q_type srcQuat))
 CM_EXTERN_FUNCTION (void qp_to_matrix,(Q_MatrixType destMatrix, q_type srcQuat))
 CM_EXTERN_FUNCTION (void qp_from_matrix,(q_type destQuat, Q_MatrixType srcMatrix))
 CM_EXTERN_FUNCTION (void q_to_ogl_matrix,(qogl_matrix_type matrix, q_type srcQuat))
 CM_EXTERN_FUNCTION (void q_vec_print,(q_vec_typevec))
 CM_EXTERN_FUNCTION (void q_set_vec,(q_vec_type vec, double x, double y, double z))
 CM_EXTERN_FUNCTION (void q_vec_copy,(q_vec_type destVec, q_vec_type srcVec))
 CM_EXTERN_FUNCTION (void q_vec_add,(q_vec_type destVec, q_vec_type aVec, q_vec_type bVec))
 CM_EXTERN_FUNCTION (void q_vec_subtract,(q_vec_typedestVec, q_vec_type v1, q_vec_type v2))
 CM_EXTERN_FUNCTION (double q_vec_dot_product,(q_vec_type v1, q_vec_type v2))
 CM_EXTERN_FUNCTION (void q_vec_scale,(q_vec_typedestVec, doublescaleFactor, q_vec_typesrcVec))
 CM_EXTERN_FUNCTION (double q_vec_magnitude,(q_vec_typevec))
 CM_EXTERN_FUNCTION (double q_vec_distance,(q_vec_type vec1, q_vec_type vec2))
 CM_EXTERN_FUNCTION (void q_vec_cross_product,(q_vec_typedestVec, q_vec_type aVec, q_vec_type bVec))
 CM_EXTERN_FUNCTION (void qp_vec_copy,(Q_VectorType destVec, Q_VectorType srcVec))
 CM_EXTERN_FUNCTION (void qp_pvec_to_vec,(q_vec_type destVec, Q_VectorType srcVec))
 CM_EXTERN_FUNCTION (void qp_vec_to_pvec,(Q_VectorType destVec, q_vec_type srcVec))
 CM_EXTERN_FUNCTION (void q_matrix_copy,(q_matrix_type destMatrix, q_matrix_type srcMatrix))
 CM_EXTERN_FUNCTION (void qp_matrix_copy,(Q_MatrixType destMatrix, Q_MatrixType srcMatrix))
 CM_EXTERN_FUNCTION (void qogl_matrix_copy,(qogl_matrix_type dest, qogl_matrix_type src))
 CM_EXTERN_FUNCTION (void q_matrix_mult,(q_matrix_type resultMatrix, q_matrix_type leftMatrix, q_matrix_type rightMatrix))
 CM_EXTERN_FUNCTION (void qp_matrix_mult,(Q_MatrixType result, Q_MatrixType A, Q_MatrixType B))
 CM_EXTERN_FUNCTION (void qogl_matrix_mult,(qogl_matrix_type result, qogl_matrix_type left, qogl_matrix_type right))
 CM_EXTERN_FUNCTION (double qp_matrix_3x3_determinant,(Q_MatrixType mat))
 CM_EXTERN_FUNCTION (void q_euler_to_col_matrix,(q_matrix_type destMatrix, double yaw, double pitch, double roll))
 CM_EXTERN_FUNCTION (void q_col_matrix_to_euler,(q_vec_typeangles, q_matrix_type colMatrix))
 CM_EXTERN_FUNCTION (void q_print_matrix,(q_matrix_type matrix))
 CM_EXTERN_FUNCTION (void qp_print_matrix,(Q_MatrixType matrix))
 CM_EXTERN_FUNCTION (void qogl_print_matrix,(qogl_matrix_type))
 CM_EXTERN_FUNCTION (void qp_file_print_matrix,(FILE *filePtr, Q_MatrixType matrix))
 CM_EXTERN_FUNCTION (void qp_row_to_pmatrix,(Q_MatrixTypepMatrix, q_matrix_type rowMatrix))
 CM_EXTERN_FUNCTION (void qp_pmatrix_to_row_matrix,(q_matrix_type rowMatrix, Q_MatrixType pMatrix))
 CM_EXTERN_FUNCTION (void qp_invert_matrix,(Q_MatrixType invertedMatrix, Q_MatrixType srcMatrix))
 CM_EXTERN_FUNCTION (void q_xyz_quat_invert,(q_xyz_quat_type *destPtr, q_xyz_quat_type *srcPtr))
 CM_EXTERN_FUNCTION (void q_row_matrix_to_xyz_quat,(q_xyz_quat_type *xyzQuatPtr, q_matrix_typerowMatrix))
 CM_EXTERN_FUNCTION (void q_xyz_quat_to_row_matrix,(q_matrix_typerowMatrix, q_xyz_quat_type *xyzQuatPtr))
 CM_EXTERN_FUNCTION (void qp_pmatrix_to_xyz_quat,(q_xyz_quat_type *xyzQuatPtr, Q_MatrixType pMatrix))
 CM_EXTERN_FUNCTION (void qp_xyz_quat_to_pmatrix,(Q_MatrixTypepMatrix, q_xyz_quat_type *xyzQuatPtr))
 CM_EXTERN_FUNCTION (void q_ogl_matrix_to_xyz_quat,(q_xyz_quat_type *xyzQuatPtr, qogl_matrix_type matrix))
 CM_EXTERN_FUNCTION (void q_xyz_quat_to_ogl_matrix,(qogl_matrix_type matrix, q_xyz_quat_type *xyzQuatPtr))
 CM_EXTERN_FUNCTION (void q_xyz_quat_compose,(q_xyz_quat_type *C_from_A_ptr, q_xyz_quat_type *C_from_B_ptr, q_xyz_quat_type *B_from_A_ptr))
 CM_EXTERN_FUNCTION (void qgl_to_matrix,(qgl_matrix_typedestMatrix, q_typesrcQuat))
 CM_EXTERN_FUNCTION (void qgl_from_matrix,(q_typedestQuat, qgl_matrix_typesrcMatrix))
 CM_EXTERN_FUNCTION (void qgl_print_matrix,(qgl_matrix_typematrix))


Define Documentation

#define Q_ABS  )     ( ((x) > 0 ) ? (x) : (-(x)) )
 

Definition at line 135 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_DEG_TO_RAD deg   )     ( ((deg)*Q_PI)/180.0 )
 

Definition at line 159 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_EPSILON   (1e-10)
 

Definition at line 129 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_ID_MATRIX
 

Value:

{ {1.0, 0.0, 0.0, 0.0}, \
                      {0.0, 1.0, 0.0, 0.0}, \
                      {0.0, 0.0, 1.0, 0.0}, \
                      {0.0, 0.0, 0.0, 1.0} }

Definition at line 145 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_ID_QUAT   { 0.0, 0.0, 0.0, 1.0 }
 

Definition at line 143 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_MAX x,
 )     ( ((x) > (y)) ? (x) : (y) )
 

Definition at line 132 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_MIN x,
 )     ( ((x) < (y)) ? (x) : (y) )
 

Definition at line 133 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_NULL_VECTOR   { 0.0, 0.0, 0.0 }
 

Definition at line 154 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_PI   3.14159265358979323846
 

Definition at line 141 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_RAD_TO_DEG rad   )     ( (((rad)*180.0)/Q_PI) )
 

Definition at line 160 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define q_vec_set   q_set_vec
 

Definition at line 163 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_W   3
 

Definition at line 126 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_X   0
 

Definition at line 123 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_Y   1
 

Definition at line 124 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define Q_Z   2
 

Definition at line 125 of file VCOLLIDE/demos/rings/quatlib/quat.h.

#define QP_ID_MATRIX
 

Value:

{ {1.0, 0.0, 0.0, 0.0}, \
                       {0.0, 1.0, 0.0, 0.0}, \
                       {0.0, 0.0, 1.0, 0.0} }

Definition at line 150 of file VCOLLIDE/demos/rings/quatlib/quat.h.


Typedef Documentation

typedef double q_matrix_type[4][4]
 

Definition at line 179 of file VCOLLIDE/demos/rings/quatlib/quat.h.

typedef double q_type[4]
 

Definition at line 173 of file VCOLLIDE/demos/rings/quatlib/quat.h.

typedef double q_vec_type[3]
 

Definition at line 176 of file VCOLLIDE/demos/rings/quatlib/quat.h.

typedef struct q_xyz_quat_struct q_xyz_quat_type
 

typedef float qgl_matrix_type[4][4]
 

Definition at line 182 of file VCOLLIDE/demos/rings/quatlib/quat.h.

typedef double qogl_matrix_type[16]
 

Definition at line 187 of file VCOLLIDE/demos/rings/quatlib/quat.h.


Function Documentation

CM_EXTERN_FUNCTION void  qgl_print_matrix,
(qgl_matrix_typematrix) 
 

CM_EXTERN_FUNCTION void  qgl_from_matrix,
(q_typedestQuat, qgl_matrix_typesrcMatrix) 
 

CM_EXTERN_FUNCTION void  qgl_to_matrix,
(qgl_matrix_typedestMatrix, q_typesrcQuat) 
 

CM_EXTERN_FUNCTION void  q_xyz_quat_compose,
(q_xyz_quat_type *C_from_A_ptr, q_xyz_quat_type *C_from_B_ptr, q_xyz_quat_type *B_from_A_ptr) 
 

CM_EXTERN_FUNCTION void  q_xyz_quat_to_ogl_matrix,
(qogl_matrix_type matrix, q_xyz_quat_type *xyzQuatPtr) 
 

CM_EXTERN_FUNCTION void  q_ogl_matrix_to_xyz_quat,
(q_xyz_quat_type *xyzQuatPtr, qogl_matrix_type matrix) 
 

CM_EXTERN_FUNCTION void  qp_xyz_quat_to_pmatrix,
(Q_MatrixTypepMatrix, q_xyz_quat_type *xyzQuatPtr) 
 

CM_EXTERN_FUNCTION void  qp_pmatrix_to_xyz_quat,
(q_xyz_quat_type *xyzQuatPtr, Q_MatrixType pMatrix) 
 

CM_EXTERN_FUNCTION void  q_xyz_quat_to_row_matrix,
(q_matrix_typerowMatrix, q_xyz_quat_type *xyzQuatPtr) 
 

CM_EXTERN_FUNCTION void  q_row_matrix_to_xyz_quat,
(q_xyz_quat_type *xyzQuatPtr, q_matrix_typerowMatrix) 
 

CM_EXTERN_FUNCTION void  q_xyz_quat_invert,
(q_xyz_quat_type *destPtr, q_xyz_quat_type *srcPtr) 
 

CM_EXTERN_FUNCTION void  qp_invert_matrix,
(Q_MatrixType invertedMatrix, Q_MatrixType srcMatrix) 
 

CM_EXTERN_FUNCTION void  qp_pmatrix_to_row_matrix,
(q_matrix_type rowMatrix, Q_MatrixType pMatrix) 
 

CM_EXTERN_FUNCTION void  qp_row_to_pmatrix,
(Q_MatrixTypepMatrix, q_matrix_type rowMatrix) 
 

CM_EXTERN_FUNCTION void  qp_file_print_matrix,
(FILE *filePtr, Q_MatrixType matrix) 
 

CM_EXTERN_FUNCTION void  qogl_print_matrix,
(qogl_matrix_type
 

CM_EXTERN_FUNCTION void  qp_print_matrix,
(Q_MatrixType matrix) 
 

CM_EXTERN_FUNCTION void  q_print_matrix,
(q_matrix_type matrix) 
 

CM_EXTERN_FUNCTION void  q_col_matrix_to_euler,
(q_vec_typeangles, q_matrix_type colMatrix) 
 

CM_EXTERN_FUNCTION void  q_euler_to_col_matrix,
(q_matrix_type destMatrix, double yaw, double pitch, double roll) 
 

CM_EXTERN_FUNCTION double  qp_matrix_3x3_determinant,
(Q_MatrixType mat) 
 

CM_EXTERN_FUNCTION void  qogl_matrix_mult,
(qogl_matrix_type result, qogl_matrix_type left, qogl_matrix_type right) 
 

CM_EXTERN_FUNCTION void  qp_matrix_mult,
(Q_MatrixType result, Q_MatrixType A, Q_MatrixType B) 
 

CM_EXTERN_FUNCTION void  q_matrix_mult,
(q_matrix_type resultMatrix, q_matrix_type leftMatrix, q_matrix_type rightMatrix) 
 

CM_EXTERN_FUNCTION void  qogl_matrix_copy,
(qogl_matrix_type dest, qogl_matrix_type src) 
 

CM_EXTERN_FUNCTION void  qp_matrix_copy,
(Q_MatrixType destMatrix, Q_MatrixType srcMatrix) 
 

CM_EXTERN_FUNCTION void  q_matrix_copy,
(q_matrix_type destMatrix, q_matrix_type srcMatrix) 
 

CM_EXTERN_FUNCTION void  qp_vec_to_pvec,
(Q_VectorType destVec, q_vec_type srcVec) 
 

CM_EXTERN_FUNCTION void  qp_pvec_to_vec,
(q_vec_type destVec, Q_VectorType srcVec) 
 

CM_EXTERN_FUNCTION void  qp_vec_copy,
(Q_VectorType destVec, Q_VectorType srcVec) 
 

CM_EXTERN_FUNCTION void  q_vec_cross_product,
(q_vec_typedestVec, q_vec_type aVec, q_vec_type bVec) 
 

CM_EXTERN_FUNCTION double  q_vec_distance,
(q_vec_type vec1, q_vec_type vec2) 
 

CM_EXTERN_FUNCTION double  q_vec_magnitude,
(q_vec_typevec) 
 

CM_EXTERN_FUNCTION void  q_vec_scale,
(q_vec_typedestVec, doublescaleFactor, q_vec_typesrcVec) 
 

CM_EXTERN_FUNCTION double  q_vec_dot_product,
(q_vec_type v1, q_vec_type v2) 
 

CM_EXTERN_FUNCTION void  q_vec_subtract,
(q_vec_typedestVec, q_vec_type v1, q_vec_type v2) 
 

CM_EXTERN_FUNCTION void  q_vec_add,
(q_vec_type destVec, q_vec_type aVec, q_vec_type bVec) 
 

CM_EXTERN_FUNCTION void  q_vec_copy,
(q_vec_type destVec, q_vec_type srcVec) 
 

CM_EXTERN_FUNCTION void  q_set_vec,
(q_vec_type vec, double x, double y, double z) 
 

CM_EXTERN_FUNCTION void  q_vec_print,
(q_vec_typevec) 
 

CM_EXTERN_FUNCTION void  q_to_ogl_matrix,
(qogl_matrix_type matrix, q_type srcQuat) 
 

CM_EXTERN_FUNCTION void  qp_from_matrix,
(q_type destQuat, Q_MatrixType srcMatrix) 
 

CM_EXTERN_FUNCTION void  qp_to_matrix,
(Q_MatrixType destMatrix, q_type srcQuat) 
 

CM_EXTERN_FUNCTION void  q_to_row_matrix,
(q_matrix_type destMatrix, q_type srcQuat) 
 

CM_EXTERN_FUNCTION void  q_from_row_matrix,
(q_type destQuat, q_matrix_type matrix) 
 

CM_EXTERN_FUNCTION void  q_to_vec,
(q_vec_type destVec, q_type srcQuat) 
 

CM_EXTERN_FUNCTION void  q_from_vec,
(q_type destQuat, q_vec_type srcVec) 
 

CM_EXTERN_FUNCTION void  q_from_two_vecs,
(q_type destQuat, q_vec_type v1, q_vec_type v2) 
 

CM_EXTERN_FUNCTION void  q_xform,
(q_vec_type destVec, q_type q, q_vec_type vec) 
 

CM_EXTERN_FUNCTION void  q_from_euler,
(q_type destQuat, double yaw, double pitch, double roll) 
 

CM_EXTERN_FUNCTION void  q_slerp,
(q_typedestQuat, q_type startQuat, q_type endQuat, doublet) 
 

CM_EXTERN_FUNCTION void  q_mult,
(q_type destQuat, q_type qLeft, q_type qRight) 
 

CM_EXTERN_FUNCTION void  q_copy,
(q_type destQuat, q_type srcQuat) 
 

CM_EXTERN_FUNCTION void  q_make,
(q_type destQuat, double x, double y, double z, double angle) 
 

CM_EXTERN_FUNCTION void  q_print,
(q_type quat) 
 


Generated on Thu Dec 1 10:14:12 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5