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.
|