icosahedron.c
// Given a vector (an array of size 3) normalize to unit length.

Given a vector (an array of size 3) normalize to unit length.
Given a vector ( an array of size 3 ) normalize to unit length .
void normalize(float v[3]){
  GLfloat d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
  if (d == 0.0){
    printf("zero length vector\n");
    exit(-1);
  }
  v[0] /= d;  v[1] /= d;  v[2] /= d;
}
void normalize ( float v [ 3 ] ) { GLfloat d = sqrt ( v [ 0 ] * v [ 0 ] + v [ 1 ] * v [ 1 ] + v [ 2 ] * v [ 2 ] ) ; if ( d == 0.0 ) { printf ( " \n " ) ; exit ( -1 ) ; } v [ 0 ] /= d ; v [ 1 ] /= d ; v [ 2 ] /= d ; }
Given a vector (an array of size 3) normalize to unit length.
Given a vector ( an array of size 3 ) normalize to unit length .