next up previous contents
Next: Single precision fixed size Up: Fixed size vectors Previous: Fixed size vector file   Contents

Conversion from general to fixed size vector

Functions are provided to convert a general vector Gan_Vector Gan_Vector3, provided that the general vector has actually been created with size three. So for instance
      Gan_Vector *pvx;

      pvx = gan_vec_alloc(3);
      gan_vec_fill_va ( pvx, 3, 2.0, 3.0, 4.0 );
      gan_vec3_from_vec_q ( pvx, &v3x );
      v3x = gan_vec3_from_vec_s ( pvx );
fill v3x with the same values as the general vector. Calling these functions with a general vector pvx not having the same size as the fixed size vector is an error.

Error detection: The conversion routines return the pointer to the filled fixed size vector, or NULL on failure, invoking the Gandalf error handle in the latter case.