You can compress the QuadEdge structure quite a bit by limiting the number of features. This way you can use bytes for indices (and don't use pointers). I also recommend storing data as simple arrays. This gets around padding issues for SIMD types.
For example:
Code: Select all
struct SubEdge
{
uint8 index; // 0-3
uint8 next; // next edge in circular list for tail feature
uint8 tailFeature; // vertex or face depending on index being odd or even.
};
struct Polytope
{
int32 edgeCount;
SubEdge* edges; // 4x the number of real edges
int32 vertexCount;
Vec3* vertices;
uint8* vertexEdges; // one for each vertex
int32 faceCount;
Vec4* facePlanes;
uint8* faceEdges; // one for each face
};
A box would take:
4 + 12 * 4 * 3 + 4 + 8 * 16 + 8 + 4 + 6 * 16 + 6 = 394 bytes
Since we are likely to be limited by the edge count, we can probably combine index and tailFeature into a single byte.
4 + 12 * 4 * 2 + 4 + 8 * 16 + 8 + 4 + 6 * 16 + 6 = 346 bytes
On the other hand, having no topology takes:
4 + 8 * 16 + 4 + 6 * 16 = 232 bytes
So there is about a 50% tax for having topology.
The nice thing about the Quad-Edge structure is that you can quickly:
- find all the edges/vertices on a face
- find all the edges/faces connected to a vertex
- find all the faces adjacent to a face
- find all the vertices adjacent to a vertex
It seems that the DCEL has trouble with some of these. For example, can you quickly find all the edges attached to a vertex? For the quad-edge structure it is just traversal of a circular list.