Volume of a 3D closed mesh car object

后端 未结 4 537
甜味超标
甜味超标 2021-01-13 10:07

I have a 3D closed mesh car object having a surface made up triangles. I want to calculate its volume, center of volume and inertia tensor.

Could you help me

<
4条回答
  •  太阳男子
    2021-01-13 10:46

    For volume...

    For each triangular facet, lookup its corner points. Call 'em P,Q,R.
    Compute this quantity (I call it "partial volume")

    pv =  PxQyRz + PyQzRx + PzQxRy - PxQzRy - PyQxRz - PzQyRx
    

    Add these together for all facets and divide by 6.

    Important! The P,Q,R for each facet must be arranged clockwise as seen from outside. (Or all counter-clockwise, as long as it's consistent for all facets.)

    If the mesh has any quadrilaterals, just temporarily hallucinate a diagonal joining one pair of opposite corners. That makes it into two triangles.

    Practical computationial improvement: Before doing math with P,Q and R, subtract the coordinates of some "center" point C. This can be the center of mass, a midpoint between the min/max x, y and z, or any convenient point inside or near the mesh. This helps minimize truncation errors for more accurate volumes.

提交回复
热议问题