Ali
Ali

Reputation: 11

Volume of Complex objects

How can I calculate the volume of complex objects based on vector product. I have list of triangles that construct the object mesh.

I have a :

Upvotes: 1

Views: 990

Answers (1)

fdermishin
fdermishin

Reputation: 3706

You can select one point P (for example, origin) and then calculate volumes of all tetrahedrons PABC, where A, B and C are vertices of a triangle from a list. The volume of each such tetrahedron equals abs(((PA x PB) . PC) / 2), where "x" and "." are cross product and dot product respectively and abs is an absolute value. To calculate the volume of the entire object you can sum up all volumes but without taking the absolute value of each. Thus, volumes of some tetrahedrons will be taken with the plus in the sum, and some with the minus. So, the volume of the entire object will be abs(sum(((PAi x PBi) . PCi) / 2)), where Ai, Bi, Ci are vertices of the ith triangle and sum is taken for all i.

Upvotes: 3

Related Questions