2

I have a 3d volume given by a binary space partition tree. Usually these are made from polygon models, and the splitted polygons already stored inside the tree nodes.

But mine is not, so I have no polygons. Every node has nothing but it's cut plane (given by normal and origin distance for example). Thus the tree still represent a solid 3d volume, defined by all the cuts made. However, for visualisation I need a polygonal mesh of this volume. How can that be reconstructed efficiently?

The crude method would be to convert the infinite half spaces of the leaves to large enough polhedrons (eg. cubes) and push every single one of them upwards the tree, cutting it by every node's plane it passes. That seems extremely costly, as the tree may be unbalanced (eg. if stupidly made from a convex polyhedra). Is there any classic solution?

tomdemuyt
  • 4,572
  • 2
  • 31
  • 60
dronus
  • 10,774
  • 8
  • 54
  • 80
  • I don't know the answer, but anyone who has worked on [a node builder for a DOOM port](http://zdoom.org/wiki/ZDBSP) probably does, at least for the 2D case. Maybe those algorithms can be extended to 3D? – finnw Jun 17 '12 at 22:46
  • I dont' think the DOOM makers do need this. The 'zones' of a DOOM map are already made as polygons in the editor, and the BSP structure thereof. So the polygons are already there before. – dronus Jun 19 '12 at 19:15
  • in the OpenGL ports (e.g. zDoom) subsectors need to be closed polygons, so although sectors are normally closed, they need to be split up and reconstructed. – finnw Jun 20 '12 at 18:58
  • Ok I got a little into DOOM, but I still think the polygons are not build from BSP but taken from the input vertices, maybe added by calculated vertices to split them to convex parts. Still, the algorithm generates new vertices by splitting the existing edges (called `linedef`'s in DOOM if I got it right) and adding `subsector`s. So only existing lines are split and connected, but no new are calculated by the split planes only. – dronus Jun 21 '12 at 21:58

1 Answers1

1

In order to recover the polygonal surface you need to intersect the planes. Where each vertex of a polygon is generated by an intersection of three planes and each edge by an intersection of 2 planes. But making this efficient and numerical stable is no trivial task. So i propose to use qhalf that is part of qhull. A documentation of the input and ouput of qhalf can be found here. Of course you can use qhull (and the functionality from qhalf) as a library.

AD-530
  • 1,059
  • 9
  • 9