next up previous contents index
Next: Functions on VEC3 Up: Utility Functions Previous: Functions for allocating/freeing memory

Functions on VEC2

 

VEC2 is declared as typedef double VEC2[2]; and the following functions are available:

double g_abs2 (double a, double b)
g_sqrt(a*a + b*b)
double g_vec2_abs (VEC2 v)
returns the length of v
void g_vec2_add (VEC2 u, VEC2 v, VEC2 w)
u = v + w
double g_vec2_angle (VEC2 v,VEC2 w)
returns the signed angle of v and w
void g_vec2_assign (VEC2 v, VEC2 w)
v = w
void g_vec2_dec (VEC2 v, VEC2 w)
v -= w
double g_vec2_det (VEC2 v,VEC2 w)
returns v[0]*w[1]-v[1]*w[0]
double g_vec2_dist (VEC2 v,VEC2 w)
returns the distance of the two points in R2
void g_vec2_inc (VEC2 v, VEC2 w)
v += w
void g_vec2_mult (VEC2 v,double d)
multiplies v by the number r
void g_vec2_rot90 (VEC2 v, VEC2 w)
v = w rotated by 90 degree
void g_vec2_set (VEC2 v, double a, double b)
v = (a,b)
void g_vec2_set_zero (VEC2 v)
v = (0,0)
double g_vec2_skp (VEC2 v,VEC2 w)
returns the scalar product of v and w
double g_vec2_sqrabs (VEC2 v)
returns the square length of v
double g_vec2_sqrdist (VEC2 v,VEC2 w)
returns the square distance of two points
void g_vec2_sub (VEC2 u, VEC2 v, VEC2 w)
u = v - w
double g_vec2_sub_skp (VEC2 v,VEC2 w,VEC2 n)
returns the scalar product of v - w and n



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.