|
|
#macro Determinant( A, B, C )
(A.x * B.y * C.z + A.y * B.z * C.x + A.z * B.x * C.y -
A.x * B.z * C.x - A.y * B.x * C.z - A.z * B.y * C.x)
#end
On Fri, 10 Dec 1999 09:09:55 -0500, Greg M. Johnson wrote:
>Boy, you are a math whiz! But I'm slightly confused in your notation, it's
>almost as if you wrote three matrices instead of one. By "determinant of
>this matrix", you mean:
>
> A.x * B.y * C.z + .....
>
>Will pov or one of your macros do this calc for me?
>
>John VanSickle wrote:
>
>> 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
>
>
>
--
These are my opinions. I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html
Post a reply to this message
|
|