POV-Ray : Newsgroups : povray.general : Volume of a 3d mesh : Re: Volume of a 3d mesh Server Time
10 Aug 2024 13:22:11 EDT (-0400)
  Re: Volume of a 3d mesh  
From: John VanSickle
Date: 9 Dec 1999 17:23:12
Message: <38502D2D.3F208819@erols.com>
Greg M. Johnson wrote:
> 
> Is there an automatic way to calculate the volume of a 3d mesh?

For each triangle, take the following matrix:

[A.x  A.y  A.z]
[B.x  B.y  B.z]
[C.x  C.y  C.z]

Where A, B, and C are the vertices of the triangle.  Make sure that
the order from A to B to C goes in the same direction for each triangle
(either clockwise or counter-clockwise) when viewed from the outside
of the mesh.

Take the determinant of this matrix.  Divide it by six.  If the
determinant is negative, leave it that way.

Add up all of the determinants for all of the triangles.  Divide by
six.  If the sum is negative, make it positive.  The result is the
volume of the mesh.

Note that every edge *MUST* be shared by exactly TWO triangles, or the
sum will be entirely meaningless.

Hope this helps,
John
-- 
ICQ: 46085459


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.