ricosjp / truck

Truck is a Rust CAD Kernel.
Apache License 2.0
1.02k stars 53 forks source link

Volume, Center of Mass #56

Closed MattFerraro closed 8 months ago

MattFerraro commented 9 months ago

Hello,

Would it be possible to implement something like solid::volume() and solid::center_of_mass()? These are very useful for CAD applications.

Cheers

ytanimura commented 8 months ago

Thank you for your comment.

We added implementation to calculate the volume and the center of gravity of PolygonMesh and Solid<Point3, PolylineCurve<Point3>, PolygonMesh>.

implementation: https://github.com/ricosjp/truck/blob/master/truck-meshalgo/src/analyzers/volume.rs test (sample code): https://github.com/ricosjp/truck/blob/master/truck-meshalgo/tests/analyzers/volume.rs#L17

MattFerraro commented 8 months ago

Excellent, thank you!