next up previous contents index
Next: Functions on VEC4 Up: Utility Functions Previous: Functions on VEC2

Functions on VEC3

 

VEC3 is declared as typedef double VEC3[3]; and the following functions are available:

void g_matrix44_mult_vec3 (MATRIX44 m, VEC3 v)
multiplies v with the matrix m

void g_matrix44_proj_vec3 (VEC3 u, MATRIX44 m, VEC3 v)
multiplies (v,1) with the matrix m, divide the first three components of the result by the fourth and return them in u

double g_vec3_abs (VEC3 v)
returns the length of v

void g_vec3_add (VEC3 vadd, VEC3 v, VEC3 w)
vadd = v + w

double g_vec3_angle (VEC3 p, VEC3 q1, VEC3 q2)
returns the angle at p in the triangle q1__p__q2

void g_vec3_assign (VEC3 v, VEC3 w)
v = w

int g_vec3_assign_triang_node (VEC3 v, TRIANG2D *t, int n)
copies the nth point of t to v

double g_vec3_circle (VEC3 center, VEC3 p[3])
calculates the center of the circle through p[0], p[1] and p[2] and returns the radius

int g_vec3_cmp (VEC3 a, VEC3 b, double eps)
returns 1 if the square distance of a and b is smaller than eps

void g_vec3_crossprod (VEC3 u, VEC3 v, VEC3 w)
u = cross product of v and w

double g_vec3_ctg (VEC3 v, VEC3 w)
returns the cotangens of the angle between v and w

void g_vec3_dec (VEC3 v, VEC3 w)
v -= w

double g_vec3_dist (VEC3 p, VEC3 q)
returns the distance of the two points in R3

int g_vec3_get_arbitr_normal (VEC3 normal, VEC3 vec)
normal = a unit vector orthogonal on vec returns 0 in case of an error

int g_vec3_get_normal (VEC3 u, VEC3 v, VEC3 w)
u = a unit vector orthogonal on v and w returns 0 in case of an error

int g_vec3_get_normal_to_plane (VEC3 u, VEC3 p, VEC3 q, VEC3 r)
u = the normal at p of the triangle p__q__r

void g_vec3_inc (VEC3 v, VEC3 w)
v += w

void g_vec3_invert (VEC3 v)
v = (1,1,1) - v

void g_vec3_list_assign (VEC3 v, VEC3 w, int nelem)
copies the vector list w to v

void g_vec3_mult (VEC3 v, double r)
multiplies v by the number r

void g_vec3_normalize (VEC3 v)
calculates a unit vector from v, replacing v, returns 0 in case of an error

int g_vec3_proj_onto_line (VEC3 v, VEC3 u)
replaces v by its projection on span (u) (if u has unit length)

int g_vec3_proj_onto_plane (VEC3 v, VEC3 u)
replaces v by its projection on the plane with normal u

void g_vec3_set (VEC3 v, double v0, double v1, double v2)
v = (v0, v1, v2)

void g_vec3_set_length (VEC3 v, double r)
calculates a vector of length r from v, replacing v

void g_vec3_set_zero (VEC3 v)
v = (0, 0, 0)

double g_vec3_skp (VEC3 v, VEC3 w)
returns the scalar product of v and w

double g_vec3_sqrabs (VEC3 v)
returns the square length of v

double g_vec3_sqrdist (VEC3 p, VEC3 q)
returns the square distance of two points

void g_vec3_sub (VEC3 vsub, VEC3 v, VEC3 w)
vsub = v - w

void g_fvec3_cv_vec3 (VEC3 v, FVEC3 w)
void g_vec3_cv_fvec3 (FVEC3 v, VEC3 w)
v = w, where typedef float FVEC3[3];


next up previous contents index
Next: Functions on VEC4 Up: Utility Functions Previous: Functions on VEC2

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.