Functions in util.c
The following functions are provided to
support 3D vector operations in the (x, y, z) Cartesian
system. All vectors are
of length of 3, and store the x, y, and z
coordinates.
VTXadd( )
Prototype:
void VTXadd(double *Buff1, double *Buff2,
double *Buff)
Description: To add vector Buff1
and Buff2, put result to vector Buff
Input value:
- double *Buff1, *Buff2, *Buff --- three
vectors.
Return value: none
Click to go back to Table of
Contents.
VTXadd2( )
Prototype:
void VTXadd2(double *Buff1, double
*Buff2, double *Buff3, double *Buff )
Description: To add vector
Buff1,Buff2 and Buff3, put result to vector Buff
Input value:
- double *Buff1, *Buff2, *Buff3, *Buff ----
four vectors
Return value: none
Click to go back to Table of
Contents.
VTXcross( )
Prototype:
void VTXcross(double *Buff1, double
*Buff2, double *Buff)
Description: To get the
cross product of vector Buff1 and Buff2, store the results
in vector Buff
. If Buff1=(x1, y1,
z1),
Buff2=(x2, y2, z2), Buff= (y1z2-y2z1, z1x2-z2x1,
x1y2-x2y1)
Input value:
- double *Buff1, *Buff2, *Buff ---three vectors
Return value: none
Click to go back to Table of
Contents.
VTXcross1( )
Prototype:
void VTXcross1(int j, int k, double
Buff[][3], double *Buff1)
Description: To get the cross
product of two vectors Buff[j] and Buff[k], store the
results in Buff1.
Input value:
- int j, k --- row index of the two vectors
- double **Buff --- a vector array. Buff[i] &
Buff[j] are two vectors
- double *Buff1 --- where to store the results.
Return value: none
Click to go back to Table of
Contents.
VTXdot( )
Prototype:
double VTXdot( double *Buff1, double
*Buff2)
Description: To get the dot
product of two vectors Buff1 and Buff2.
Input value: double *Buff1,
* Buff2 --- two vectors
Return value: If
Buff1=(x1,y1, z1), Buff2=(x2, y2, z2), return
(x1x2+y1y2+z1z2)
Click to go back to Table of
Contents.
VTXmag( )
Prototype:
double VTXmag(double *Buff1, double
*Buff2)
Description: To return the
Euclid distance between two vectors.
Input value:
- double *Buff1, *Buff2 --- two vectors
Return value: If
Buff1=(x1,y1, z1), Buff2=(x2, y2, z2), return sqrt(
(x1-x2)^2+(y1-y2)^2+(z1-z2)^2 ).
Click to go back to
Table of Contents.
VTXsub( )
Prototype:
void VTXsub( double *Buff1, double
*Buff2, double *Buff)
Description: To subtract
vector Buff2 from vector Buff1, put the results in vector
Buff
Input value:
- double *Buff, *Buff1, *Buff2 --- three
vectors.
Return value: none
Click to go back to Table of
Contents.
VTXsub1( )
Prototype:
void VTXsub1(int row_i, int row_k, double
Buff[ ][3], double *Buff1)
Description: To subtract row_k
from row_i in vector array Buff[][3], store result in
Buff1
Input value:
- int row_i, row_k --- row number
- double *Buff[3] --- a vector array, each element is
a vector.
- double *Buff1 --- where to store the
results
Return value: none
Click to go back to Table of
Contents.