I have a constructive solid geometry of ellipsoids that cut a cube. I need to compute the volume of the porous cube. How can I do this?
Asked
Active
Viewed 440 times
1 Answers
0
There is always the dumb approximating solution. For that you need only a decision function whether a point is inside an ellipsoid.
Keep a Cube
- Dimension (maybe only once outside the class, the outer dimension)
- filling: with state: empty, filled, mixed
- if mixed 8 sub-Cube-s
- there is a minimal block size
Then filling with an ellipsoid will split cubes, where mixed cubes (a bit filled) will need splitting for more precise calculation.
The algorithm itself can vary. Rescaling to (0, 0, 0) - (2”, 2”, 2”) might be usefull, as the blocks do a ²log division of the space.
At the end of this computation one has an approximation and even knows the error range (sum of filled + half of sum of mixed).
One way would be to recurse with that from the entire Cube, checking overlaps with the 8 sub-cubes:
- When all 8 corners of a cube are inside the ellipsoid the it is filled, and you need not recurse further to the minimal block size.
- When all 8 corners are outside and the center of the ellipsoid does not lie inside, it is empty, end of recursion.

Peter O.
- 32,158
- 14
- 82
- 96

Joop Eggen
- 107,315
- 7
- 83
- 138
-
Hi Joop I did not completely understand your proposed algorithm. What do you mean by " dimension (maybe only once outside the class)". How do you check robustly if the state is empty, filled, mixed? If I take for instance the center of the box and check against the ellipsoid it might be the case that I get empty but the box still shares a volume with the ellipsoid. – user3528789 Feb 21 '15 at 11:16
-
The dimension of a Cube instance need not be stored as field, but can be calculated when recursing from the top cube. as parameter to a recursive method. Diminishes data size. – Joop Eggen Feb 21 '15 at 11:21
-
Hi Joop I thought now quite a lot about building and octree but I still don 't know how to check if a cube from the octree is empty/filled or mixed. The tool I have is to check if a point is inside an ellipsoid or not. Now if I want to get the state of an octree-cube (e.g. cube A) I thought of introducing a point grid in cube A with and equal distance of the global minimal block size between the points. Now I would check all points if inside an ellipsoid or not. But this is then the same approach as a voxel discretized geometry. So where am I thinking wrong? – user3528789 Feb 22 '15 at 17:53
-
Fine that you know the common datastructures i.e. octree. I did not want to beat a beginner with datastructures that are just a bit feature heavy on the technical side, without goal oriented usages, – Joop Eggen Feb 23 '15 at 01:09
-
Hi Joop thanks for the enhanced description but still with this approach one would miss a lot of cubes with only a little volume inside the ellipsoid. Consider the situation where the tip of an ellipsoid of revolution intersects with the cube in the middle of a cube face, where the tip itself is not yet at the cube center. So I would have to use small cubes again to circumvent this which brings me back to the voxels. I guess it is better to do something like ellipsoid-box intersection test. This would then be computationally expensive. So again back to the voxels :( or am I missing something. – user3528789 Feb 23 '15 at 09:36
-
Entirely inside (ellipsoid center inside) and entirely outside is fast. Yes, the remaining cases require inventive handling. Take the bounding box of the ellipsoid, and process the intersections with larger and smaller cubes. A different bottom-up approach is to pick a min. cube on the ellipsoid surface and add to any of the 8 corners a surface cube, recurse till the entire surface is covered. The inner then is a projection on one dimension, iterating through all coordinates of that dimension and marking inner blocks, and maybe making a larger cube from 4 alligned smaller cubes. – Joop Eggen Feb 23 '15 at 15:29