utility
|
cmd_head.c,
count_tokens.c,
cp_file.c,
errmsg.c,
file_opened.c,
find_line.c,
find_string.c,
fn_base.c,
fn_dir.c,
fn_ext.c,
fn_root.c,
gchoice.c,
gdata_line.c,
gdouble.c,
gfield.c,
gint.c,
gntoken.c,
graphics_ok.c,
gstring.c,
lock.c,
lower.c,
mat_multiply.c,
mat_transform.c,
mat_transpose.c,
mv_file.c,
new_extension.c,
nolead.c,
notrail.c,
ordinal.c,
pfield.c,
squish_blanks.c,
test.c,
unlock.c,
upper.c,
utility.h,
utility.make,
valchars.c,
vec_angle.c,
vec_crossprod.c,
vec_diff.c,
vec_dotprod.c,
vec_length.c,
vec_norm.c,
|
|
|
#include "utility.h"
void mat_transform(vector1,rotation_matrix,translation_vector,vector2)
/*============================================================================*/
/* PURPOSE: APPLY THE SPECIFIED ROTATION AND TRANSLATION TO THE SUPPLIED
/* VECTOR.
/* INPUTS:
/* VECTOR1 (X,Y,Z) TRIPLET.
/* ROTATION_MATRIX THREE BY THREE ROTATION MATRIX.
/* TRANSLATION_VECTOR (X,Y,Z) TRANSLATION TRIPLET.
/* OUTPUTS:
/* VECTOR2 VECTOR1*ROTATION_MATRIX+TRANSLATION_VECTOR.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 11 JUNE 1991 MVG
*/
double vector1[3];
double rotation_matrix[3][3];
double translation_vector[3];
double vector2[3];
{
int i;
int j;
double nvector[3];
/* APPLY BOTH THE ROTATION AND TRANSLATION TO THE ORIGINAL VECTOR1. */
/* NOTE THAT WE ACCUMULATE THE RESULT IN NVECTOR SO AS NOT TO PREMATURELY */
/* CORRUPT VECTOR1 (IF SAME VECTOR WAS SUPPLIED AS BOTH VECTOR1 AND */
/* VECTOR2 ON CALL) BEFORE WE COMPLETE THE CALCULATIONS. */
for (i=0; i<3; i++)
{
nvector[i]=translation_vector[i];
for (j=0; j<3; j++)
{
nvector[i]+=vector1[j]*rotation_matrix[j][i];
}
}
for (i=0; i<3; i++)
{
vector2[i]=nvector[i]; /* RETURN COMPLETED VECTOR IN CALLING PARAMETER. */
}
return;
}
|