Reputation: 139
I am trying to load an STL mesh file and store its triangles an in octree data structures for some scientific analysis (not for gaming).
as shown in the image, Triangle 1 is stored in octree nodes NE, SE, SW and NW while triangle 2 is stored in octree nodes NW and SW. (2d representation but it's the same story in 3d).
it would be pointless to divided nodes NW and SW the since the two triangles shares the red edge. and this problem becomes more troublesome if I have more than two triangles spanning over several cells.
so, what is the correct way of storing triangles in octree?
ps- I don't want to clip triangles.
Upvotes: 3
Views: 791
Reputation: 438
I have used two most common approaches:
The first approach was useful for rough, axis-aligned, estimate of object's shape - to solve tight packing problem. Basically it was non-uniform voxelization. The second approach was quite good for collision detection. Each triangle needed to be collided with other triangles in the same node and its children. The second approach produced quite lightweight implementation (you can add linked-list next-pointer directly to triangle).
Upvotes: 2