Utilize model slicing as a method to simplify the issue from 3D to 2D.
STEP 1 - segment the model using N horizontal planes → resulting in N shapes in 2D space, each with its own Z height.
STEP 2 - for each slice:
- Determine the inner extreme lines (highlighted in red and green).
- Intersect the extreme lines to construct the inner rectangle at the specified Z height.
https://i.sstatic.net/CiJed.png
STEP 3 - Once you have a collection of rectangles, merge them to form the inner volume:
The inner volume will take the shape of the smallest common rectangle.
Analyze which rectangles contribute to determine the min(Z)
and max(Z)
of the given shape.
https://i.sstatic.net/0XMTs.png
OPTIMIZING to achieve maximum volume
The inner volume can be expanded by excluding certain slices or introducing new ones. For instance, if we have an inner diamond shape, calculating max(Z) and min(Z) could result in a narrow column that may not yield the optimal volume in this scenario.
Eliminating slices from the top and bottom can enhance the outcomes. Hopefully, you grasp the concept despite my limited artistic abilities!
https://i.sstatic.net/xrbP4.png