Polyhedra Data Structure

From K-3D

Jump to: navigation, search

Polyhedra traversal

The relations between the different arrays in k3d::mesh::polyhedra_t and the k3d::mesh::points array are shown in the next figure:

Note that this is all the connectivity information stored in the basic mesh structure, and the entire mesh can be traversed using only these arrays. The higher level, not mentioned in the figure, is the first_faces array, which contains the first face number (index into face_first_loops) for each polyhedron in the mesh. The use of this array is only needed if it is necessary to make a distinction between the polyhedra. If you simply want to iterate over all polyhedra it can be ignored.

Sometimes, it can be useful to have some extra connectivity data, such as the "companion" edges from the legacy mesh structure. These (and other data) can be obtained through the methods declared in k3dsdk/mesh_topology_data.h. The next figure shows an example on how to traverse the edges and vertices around a vertex:


Polyhedra Data Structure in Memory

Personal tools