3.4. Vectors

Vectors are mainly used in Reindeer to describe a list of numbers. They may be used to describe individual positions or directions, but more generally they may represent anything that can be described with a list of numbers. They are never used for large arrays of positions or directions, because then a RenVectorArray is used. Also, they are never used to represent colors because then RenColor is preferred.

RenVector* ren_vector_new( ren_size length,
  RenType type);
 

Define a new vector. Vector data will be internally allocated, with vector length and element type as specified.

RenVector* ren_vector_ref( RenVector* vector);
 

Increases the reference count of the Vector instance and then returns it.

void ren_vector_unref( RenVector* vector);
 

Decreases the reference count of the Vector instance. When its reference count drops to 0, it will be destroyed automatically.

void* ren_vector_begin_edit( RenVector* vector);
 

Get the internal data of the vector with the intention of modifying it. This function may lock while some other thread is already using the data.

void ren_vector_end_edit( RenVector* vector);
 

Mark an end of modifying the internal data. The pointer received with ren_vector_begin_edit must not be used anymore.