next up previous contents index
Next: Matrix Functions Up: Utility Functions Previous: Functions on VEC3

Functions on VEC4

 

VEC4 is declared as typedef double VEC4[4];

Some of the functions for 4-dimensional vectors depend on signature. Signature is a VEC4 vector describing a metric, e.g.:

euclidian R4: ( 1., 1., 1., 1.)
minkowski R4: (-1., 1., 1., 1.)

The following functions are available in GRAPE:

void g_matrix44_mult_vec4 (MATRIX44 m, VEC4 v)
multiplies v by the matrix m, replacing v

void g_matrix44_mult_vec4_vec4 (MATRIX44 m, VEC4 v, VEC4 w)
multiplies v by m and stores the result in w

double g_vec4_abs (VEC4 v)
returns the length of v

double g_vec4_abs_sign (VEC4 v, VEC4 sign)
returns the length of v (depending on signature)

void g_vec4_add (VEC4 vadd, VEC4 v, VEC4 w)
vadd = v + w

double g_vec4_angle (VEC4 p, VEC4 q1, VEC4 q2, VEC4 sign)
returns the angle at p in the triangle q1-p-q2 (depending on signature)

void g_vec4_assign (VEC4 v, VEC4 w)
v = w

double g_vec4_ctg (VEC4 p, VEC4 q1, VEC4 q2, VEC4 sign)
returns the cotangens of the angle at p in the triangle q1-p-q2 (depending on signature)

double g_vec4_dist (VEC4 p, VEC4 q)
returns the distance of the two points

double g_vec4_dist_sign (VEC4 p, VEC4 q, VEC4 sign)
returns the distance of two points (depending on signature)

void g_vec4_list_assign (VEC4 *v, VEC4 *w, int nelem)
copies the list of vectors w to the list v

void g_vec4_mult (VEC4 v, double r)
multiplies each coordinate of v by r, replacing v

int g_vec4_normalize (VEC4 v)
creates a unit vector from v, replacing v

int g_vec4_normalize_sign (VEC4 v, VEC4 sign)
creates a unit vector from v (depending on signature)

int g_vec4_set_length (VEC4 v, double r)
creates a vector of length r from v, replacing v

int g_vec4_set_length_sign (VEC4 v, double r, VEC4 sign)
creates a vector of length r from v (depending on signature)

double g_vec4_skp (VEC4 v, VEC4 w)
returns the scalar product of v with w

double g_vec4_skp_sign (VEC4 v, VEC4 w, VEC4 sign)
returns the scalar product of v and w (depending on signature)

double g_vec4_sqrabs (VEC4 v)
returns the square of the length of v

double g_vec4_sqrabs_sign (VEC4 v, VEC4 sign)
returns the square length of v (depending on signature)

double g_vec4_sqrdist (VEC4 p, VEC4 q)
returns the square of the distance of the two points

double g_vec4_sqrdist_sign (VEC4 p, VEC4 q, VEC4 sign)
returns the square distance of two points (depending on signature)

void g_vec4_sub (VEC4 vsub, VEC4 v, VEC4 w)
vsub = v - w


next up previous contents index
Next: Matrix Functions Up: Utility Functions Previous: Functions on VEC3

SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.