miho / JCSG

Java implementation of BSP based CSG (Constructive Solid Geometry)
Other
177 stars 52 forks source link

How can I compute centroid and volume of a CSG? #18

Closed aghasemi closed 5 years ago

aghasemi commented 8 years ago

Hello, After applying some boolean operators to a set of primitives (e.g. pyramids), is there a way to compute the centroid or the volume of the resulting 3-D shape?

Thanks

madhephaestus commented 8 years ago

Yeah, but not super easy in this fork. The features you want are part of #20 and implemented in https://github.com/NeuronRobotics/JCSG

Here is the example code from my tutorial on JCSG for measurement. Centroid and bounds are easy, but volume is another story...

https://gist.github.com/madhephaestus/21c02fc054a1a279cb16c9a6ae5a603a

miho commented 5 years ago

51 implements computeVolume().