Full refund within 14 days of purchase date.
This class stores vertex co-ordinates in any dimension, either 2D co-ordinates, 3D coordinates, or higher dimensional co-ordinates. The class is useful for storing vertex co-ordinates for handling 3D or 2D meshes employed in games. It is ready to be included in any project with minimal refactoring, and is not dependent on any external libraries.
Example of usage :
CVertexList Array;
First it is needed to reserve enough space, in this case a 4 entry array. The second parameter is the stride, and in the example we allocate 4 vertexes each consisting of 3 co-ordinates, with 16 being the growth factor (more on that later on).
Array.Reserve( 4, 3, 16 );
Insert a vertex in the following manner:
float v[3]= { 10,10,10 };
Array.PushBack ( v );
You can add as many vertices as you wish. When the reserved size is reached, the array auto expands by the growth factor and reallocates itself, preserving the data. This is behavior is very similar to STL.
Array.ComputeBoundingBox( BMin, BMax );
Computes the bounding box of the vertex set created.
Array.ComputeCenter( Center );
Computes the the vertex set ' s centroid.
Additional helper functions are included, like positioning the entire vertex set or scaling up, a function for 'packing' the array eliminating unused space, query and 'settings' or 'gettings' functions are included as well.
Once you have created the vertex array you can get a low level access as follows:
float *ptr=Array.GetPtr();
int Vertices= Array.GetItemsCount();
for ( i=0; i
Note that the '3' factor is of vital importance because the vertex is stored in contiguous linear memory. With this class you get an STL-like rearranging vector with low level-linear memory access.
Questions & Comments