comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Volume by four vectors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Volume by four vectors [message #41226] Sun, 17 October 2004 07:35
ed is currently offline  ed
Messages: 3
Registered: October 2004
Junior Member
Sander,

Uhoh! It's a volume with 5 vertices, obviously not cube-like in any
way. But I guess you can dissect it into irregular tetrahedrons and
use that Francesca formula for each one. The volume of the original
solid may not be convex in general, which might lead to negative
tetrahedral volumes, but I suspect, even then the sum of the volumes
will be correct.

Ed

Sander Roosendaal <sander@wereldraadsel.nl> wrote in message news:<kfn242-pe3.ln1@wereldraadsel.demon.nl>...
> Many thanks, Ed.
> Just the hint I needed.
>
> Ed Schmahl wrote:
>
>> Dear Sander,
>>
>> Interesting geometry problem. The volume you're talking about is an
>> irregular polyhedron--the generalization of a cube. You can dissect
>> the volume into
>> irregular tetrahedra, each bounded by 4 triangles, two triangles on
>> each face.
>> Pick an origin inside of the hexahedron, and since there are 6 faces,
>> there
>> will be 12 (irregular) tetrahedra, each with a common vertex at the
>> origin.
>> Obviously the location of the origin is irrelevant, but if it is
>> outside of
>> the hexahedron, some of the tetrahedra will have negative volumes.
>>
Re: Volume by four vectors [message #41241 is a reply to message #41226] Thu, 14 October 2004 12:11 Go to previous message
Sander Roosendaal is currently offline  Sander Roosendaal
Messages: 3
Registered: October 2004
Junior Member
Dear Ed,

I appreciate your help.

For my problem:
"Given four 3D vectors a=[a1,a2,a3] b=[b1,b2,b3] c=[c1,c2,c3] and
d=[d1,d2,d3], I want to calculate the volume defined by
i*a + j*b + k*c + l*d with i,j,k,l between 0 and 1."

You responded:

> Interesting geometry problem. The volume you're talking about is an
> irregular polyhedron--the generalization of a cube. You can dissect
> the volume into
> irregular tetrahedra, each bounded by 4 triangles, two triangles on
> each face.
> Pick an origin inside of the hexahedron, and since there are 6 faces,

There are more than 6 faces.

I calculate a 16 points. Only some of them define the polyhedron.

O(rigin),a,b,c,d,a+b,a+c,a+d,b+c,b+d,c+d, a+b+c,a+b+d,a+c+d,b+c+d, a+b+c+d

Example:
If a=[1,0,0]; b=[0,1,0]; c=[0,0,1], d=[0.01,0.01,0]
The resulting volume will be very close to 1. Actually, the 16 points are
*1: (0,0,0)
*2: (1,0,0)
*3: (0,1,0)
*4: (0,0,1)
5: (0.01,0.01,0)
6: (1,1,0)
*7: (1,0,1)
*8: (1.01,0.01,0)
*9: (0,1,1)
*10: (0.01,1.01,0)
11: (0.01,0.01,1)
12: (1,1,1)
*13: (1.01,1.01,0)
*14: (1.01,0.01,1)
*15: (0.01,1.01,1)
*16: (1.01,1.01,1)

The ones marked with * are on the outside (12 in total). This polyhedron has
8 faces.

--
hartelijke groeten,

Sander
sander@wereldraadsel.nl

If this helped, please take the time to rate the value of this post
http://rate.affero.net/sander/
Re: Volume by four vectors [message #41243 is a reply to message #41241] Thu, 14 October 2004 09:52 Go to previous message
Sander Roosendaal is currently offline  Sander Roosendaal
Messages: 3
Registered: October 2004
Junior Member
Many thanks, Ed.
Just the hint I needed.

Ed Schmahl wrote:

> Dear Sander,
>
> Interesting geometry problem. The volume you're talking about is an
> irregular polyhedron--the generalization of a cube. You can dissect
> the volume into
> irregular tetrahedra, each bounded by 4 triangles, two triangles on
> each face.
> Pick an origin inside of the hexahedron, and since there are 6 faces,
> there
> will be 12 (irregular) tetrahedra, each with a common vertex at the
> origin.
> Obviously the location of the origin is irrelevant, but if it is
> outside of
> the hexahedron, some of the tetrahedra will have negative volumes.
>


--
hartelijke groeten,

Sander
sander@wereldraadsel.nl

If this helped, please take the time to rate the value of this post
http://rate.affero.net/sander/
Re: Volume by four vectors [message #41248 is a reply to message #41243] Wed, 13 October 2004 14:02 Go to previous message
ed is currently offline  ed
Messages: 3
Registered: October 2004
Junior Member
Dear Sander,

Interesting geometry problem. The volume you're talking about is an
irregular polyhedron--the generalization of a cube. You can dissect
the volume into
irregular tetrahedra, each bounded by 4 triangles, two triangles on
each face.
Pick an origin inside of the hexahedron, and since there are 6 faces,
there
will be 12 (irregular) tetrahedra, each with a common vertex at the
origin.
Obviously the location of the origin is irrelevant, but if it is
outside of
the hexahedron, some of the tetrahedra will have negative volumes.

The volume of a general tetrahedron was calculated by Piero della
Francesca
in the 1400s. You can read about this formula at
http://www.mathpages.com/home/kmath424.htm
but it boils down to this (quoted from the above link)

...a 3-dimensional analogue
of Heron's formula for the volume of a general tetrahedron with edges
a,b,c,d,e,f, taken in opposite pairs (a,f), (b,e), (c,d). Letting
A,B,..,F denote the *squares* of these respective edge lengths, his
formula was

144 V^2 = - ABC - ADE - BDF - CEF + ACD + BCD + ABE + BCE
+ BDE + CDE + ABF + ACF + ADF + CDF + AEF + BEF
- CCD - CDD - BBE - BEE - AAF -

So from your vertex vectors, calculate A,B,C,D,E & F for each
tetrahedron, calculate V for each of the 12 tetrahedrons, and add them
up. It's as "simple" as that.

Anyone for coding this in IDL?

Ed Schmahl
University of Maryland

Sander Roosendaal <sander@wereldraadsel.nl> wrote in message news:<5rgk32-p13.ln1@wereldraadsel.demon.nl>...
> Dear readers,
>
> I have the following question, which I have to solve in PV-Wave.
>
> Given four 3D vectors a=[a1,a2,a3] b=[b1,b2,b3] c=[c1,c2,c3] and
> d=[d1,d2,d3], I want to calculate the volume defined by
>
> i*a + j*b + k*c + l*d with i,j,k,l between 0 and 1.
>
> There must be a solution somewhere, or a hint to a solution. I just couldn't
> find it, and I am too lazy to derive it :-)
>
> Thank you.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDLWAVE 5.4 -- idlwave.org
Next Topic: Good Materials

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:05:56 PDT 2025

Total time taken to generate the page: 0.41478 seconds