Skip to main content

Volume of a closed object

12 replies [Last post]
steinsiv
Offline
Joined: 2003-08-29
Points: 0

Does anyone know of a method to determine the volume of an arbitrary closed object? The object consists of triangles and could be anywhere in space with any size and number of polygons but is always closed.

If anyone know where i can find some good starting points for this matter I would really apprechiate it.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
steinsiv
Offline
Joined: 2003-08-29
Points: 0

Thank you all for your input, i will for now pursue the formula deduced from the divergence theorem, seems to solve my problem with enough accuracy dependent on my polygon sizes.

As far as i can see (please stop me if i'm wrong) we can with this method join several polygons to increase speed (with some loss of accuracy) and it would also work for quads. Excellent!

Renoir Sewjee

Hi,

You could fill the object with tetrahedra and sum the volumes of the
individual tetra. Have a look at http://tetgen.berlios.de/ for software
that can fill an object with tetrahedra.

Regards,
Renoir

>Does anyone know of a method to determine the volume of an arbitrary closed object? The object consists of triangles and could be anywhere in space with any size and number of polygons but is always closed.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

bayblade
Offline
Joined: 2006-02-17
Points: 0

Here's a solution I devised because I've never seen someone ask that question before and a solution intrigued me.
I'm not sure this will give an exact volume because the theorem I used is unverified or may be subject to unknown constraints, but its a place to start.

In the center of your convex object, create a point P so that there is a straigt line between P and every vertex on your object, uninterrrupted by other faces or vertices. (The implication here is your object is convex, if your object isn't convex, you'll need to break the object down and apply the solution to convex sub-objects, and add the sum of them to get your final volume.)

Now I have an unverified theorem somewhere that states the volume of a tetrahedron with 4 points: A, B, C, and D is given by the equation; ( 1 / 6 ) ( AB x AC ) • AD.

So the solution to your problem is for every face add the following: calculate the non-unit vector from P to all 3 vertices on the face (denoted by PI, PJ and PK) and apply the cross and dot product calculation (PI x PJ) • PK. After you've added the calculations for all faces, divide that number by 6.

The end number will give you your volume.

Matthew Hilliard

eeep!

Where • means "dot"

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

nvaidya
Offline
Joined: 2004-08-03
Points: 0

One approach is to approximate the integral equivalent of the divergence of the position vector by noting that the divergence of the position vector is equal to 3.

[code]
Volume = 1/3 Sum_over_all_triangles[
( normal_of_triangle dot
position_vector_of_midpoint_of_triangle
) x Area_of_triangle]
[/code]
where "dot" is dot product.

I don't think there is a convexity restriction here.

Florin Herinean

Thinking back on the maths learned in school, I believe that you can decompose the solid into individual surface elements (triangles or quads). First translate the solid such that all vertexes have positive Y coordinate, then calculate the volume between each surface element and the xOz plane. After that you just sum them, considering that surface elements where the normal points downward (to the xOz plane) have negative volume.

That algorithm should give an exact result (well of course you may consider the floating point math errors) regardless if the solid is concave or convex, as long it is *closed*.

Cheers,

Florin

-----Ursprüngliche Nachricht-----
Von: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Gesendet: Dienstag, 17. August 2004 19:34
An: interest@java3d.dev.java.net
Betreff: Re: [JAVA3D-INTEREST] Re: Volume of a closed object

One approach is to approximate the integral equivalent of the divergence of the position vector by noting that the divergence of the position vector is equal to 3.

[code]
Volume = 1/3 Sum_over_all_triangles[
( normal_of_triangle dot
position_vector_of_midpoint_of_triangle
) x Area_of_triangle]
[/code]
where "dot" is dot product.

I don't think there is a convexity restriction here.
---
[Message sent by forum member 'NVaidya' (N. Vaidya)]

http://www.javadesktop.org/forums/thread.jspa?messageID=23201&#23201

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

nvaidya
Offline
Joined: 2004-08-03
Points: 0

If you calculate the signed volumes and sum them all up, the signed areas in the interior will cancel each other identically because of opposing outward-normal orientations, and the resulting formula should be the same as the one that I suggested - I think.

But it may be an interesting excercise !

--Vaidya

> Thinking back on the maths learned in school, I
> believe that you can decompose the solid into
> individual surface elements (triangles or quads).
> First translate the solid such that all vertexes have
> positive Y coordinate, then calculate the volume
> between each surface element and the xOz plane. After
> that you just sum them, considering that surface
> elements where the normal points downward (to the xOz
> plane) have negative volume.
>
> That algorithm should give an exact result (well of
> course you may consider the floating point math
> errors) regardless if the solid is concave or convex,
> as long it is *closed*.
>
> Cheers,
>
> Florin
>
> -----Ursprüngliche Nachricht-----
> Von: java3d-interest@javadesktop.org
> [mailto:java3d-interest@javadesktop.org]
> Gesendet: Dienstag, 17. August 2004 19:34
> An: interest@java3d.dev.java.net
> Betreff: Re: [JAVA3D-INTEREST] Re: Volume of a closed
> object
>
>
> One approach is to approximate the integral
> equivalent of the divergence of the position vector
> by noting that the divergence of the position vector
> is equal to 3.
>
> [code]
> Volume = 1/3 Sum_over_all_triangles[
> ( normal_of_triangle dot
>
>
>
> position_vector_of_midpoint_of_triangle
> ) x Area_of_triangle]
> [/code]
> where "dot" is dot product.
>
> I don't think there is a convexity restriction here.
> ---
> [Message sent by forum member 'NVaidya' (N. Vaidya)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageI
> D=23201媡
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net

Florin Herinean

Think again ! If you have a horizontal cube (the simplest example), then the cube volume is the volume generated by the top surface and it's projection on the reference xOz plane minus the volume generated by the bottom surface and it's projection on the same plane. The lateral surfaces generates zero volume because their projected surface on the xOz plane has a null area.

That's the standard way to compute solid volumes. Mathematicaly can be generalized to computing the volume of any arbitrary solid (including ones defined by parametric surfaces). It's similar to resolving integral equations.

Cheers,

Florin

-----Ursprüngliche Nachricht-----
Von: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Gesendet: Mittwoch, 18. August 2004 12:32
An: interest@java3d.dev.java.net
Betreff: Re: AW: [JAVA3D-INTEREST] Re: Volume of a closed object

If you calculate the signed volumes and sum them all up, the signed areas in the interior will cancel each other identically because of opposing outward-normal orientations, and the resulting formula should be the same as the one that I suggested - I think.

But it may be an interesting excercise !

--Vaidya

> Thinking back on the maths learned in school, I
> believe that you can decompose the solid into
> individual surface elements (triangles or quads).
> First translate the solid such that all vertexes have
> positive Y coordinate, then calculate the volume
> between each surface element and the xOz plane. After
> that you just sum them, considering that surface
> elements where the normal points downward (to the xOz
> plane) have negative volume.
>
> That algorithm should give an exact result (well of
> course you may consider the floating point math
> errors) regardless if the solid is concave or convex,
> as long it is *closed*.
>
> Cheers,
>
> Florin
>
> -----Ursprüngliche Nachricht-----
> Von: java3d-interest@javadesktop.org
> [mailto:java3d-interest@javadesktop.org]
> Gesendet: Dienstag, 17. August 2004 19:34
> An: interest@java3d.dev.java.net
> Betreff: Re: [JAVA3D-INTEREST] Re: Volume of a closed
> object
>
>
> One approach is to approximate the integral
> equivalent of the divergence of the position vector
> by noting that the divergence of the position vector
> is equal to 3.
>
> [code]
> Volume = 1/3 Sum_over_all_triangles[
> ( normal_of_triangle dot
>
>
>
> position_vector_of_midpoint_of_triangle
> ) x Area_of_triangle]
> [/code]
> where "dot" is dot product.
>
> I don't think there is a convexity restriction here.
> ---
> [Message sent by forum member 'NVaidya' (N. Vaidya)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageI
> D=23201媡
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net
---
[Message sent by forum member 'NVaidya' (N. Vaidya)]

http://www.javadesktop.org/forums/thread.jspa?messageID=23385&#23385

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

nvaidya
Offline
Joined: 2004-08-03
Points: 0

Well, let's consider your simple cube for example.
The lateral surfaces have identical areas and identical but opposite unit normals. Simply plug in the values in my formula, you will get 1/3(3 * Area * side_of_cube) = Volume.

And the reason why the side of the cube comes about automatically is because it is the projection of (r_e - r_w) along the unit normal, where r_e and r_w are the position vectors of the opposite lateral faces, and the projection gives the length of the cube.

I should mention that there is also a method due to O'Rourke based upon calculating the volume of a tetrahedron, IIRC, for the very same objective.

--Vaidya

> Think again ! If you have a horizontal cube (the
> simplest example), then the cube volume is the volume
> generated by the top surface and it's projection on
> the reference xOz plane minus the volume generated by
> the bottom surface and it's projection on the same
> plane. The lateral surfaces generates zero volume
> because their projected surface on the xOz plane has
> a null area.
>
> That's the standard way to compute solid volumes.
> Mathematicaly can be generalized to computing the
> volume of any arbitrary solid (including ones defined
> by parametric surfaces). It's similar to resolving
> integral equations.
>
> Cheers,
>
> Florin
>
> -----Ursprüngliche Nachricht-----
> Von: java3d-interest@javadesktop.org
> [mailto:java3d-interest@javadesktop.org]
> Gesendet: Mittwoch, 18. August 2004 12:32
> An: interest@java3d.dev.java.net
> Betreff: Re: AW: [JAVA3D-INTEREST] Re: Volume of a
> closed object
>
>
> If you calculate the signed volumes and sum them all
> up, the signed areas in the interior will cancel each
> other identically because of opposing outward-normal
> orientations, and the resulting formula should be the
> same as the one that I suggested - I think.
>
> But it may be an interesting excercise !
>
> --Vaidya
>
>
>
>
> > Thinking back on the maths learned in school, I
> > believe that you can decompose the solid into
> > individual surface elements (triangles or quads).
> > First translate the solid such that all vertexes
> have
> > positive Y coordinate, then calculate the volume
> > between each surface element and the xOz plane.
> After
> > that you just sum them, considering that surface
> > elements where the normal points downward (to the
> xOz
> > plane) have negative volume.
> >
> > That algorithm should give an exact result (well of
> > course you may consider the floating point math
> > errors) regardless if the solid is concave or
> convex,
> > as long it is *closed*.
> >
> > Cheers,
> >
> > Florin
> >
> > -----Ursprüngliche Nachricht-----
> > Von: java3d-interest@javadesktop.org
> > [mailto:java3d-interest@javadesktop.org]
> > Gesendet: Dienstag, 17. August 2004 19:34
> > An: interest@java3d.dev.java.net
> > Betreff: Re: [JAVA3D-INTEREST] Re: Volume of a
> closed
> > object
> >
> >
> > One approach is to approximate the integral
> > equivalent of the divergence of the position vector
> > by noting that the divergence of the position
> vector
> > is equal to 3.
> >
> > [code]
> > Volume = 1/3 Sum_over_all_triangles[
> > ( normal_of_triangle dot
> >
> >
> >
> >
> position_vector_of_midpoint_of_triangle
> > ) x Area_of_triangle]
> > [/code]
> > where "dot" is dot product.
> >
> > I don't think there is a convexity restriction
> here.
> > ---
> > [Message sent by forum member 'NVaidya' (N.
> Vaidya)]
> >
> >
> http://www.javadesktop.org/forums/thread.jspa?messageI
> > D=23201媡
> >
> >
> ------------------------------------------------------
> > ---------------
> > To unsubscribe, e-mail:
> > interest-unsubscribe@java3d.dev.java.net
> > For additional commands, e-mail:
> > interest-help@java3d.dev.java.net
> >
> >
> >
> ------------------------------------------------------
> > ---------------
> > To unsubscribe, e-mail:
> > interest-unsubscribe@java3d.dev.java.net
> > For additional commands, e-mail:
> > interest-help@java3d.dev.java.net
> ---

> [Message sent by forum member 'NVaidya' (N. Vaidya)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageI
> D=23385å­™
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net
>
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net

Florin Herinean

You may be right, but your formula is not so intuitive and my maths are not so advanced to be able to say if it's correct or not :) I must see it at work !

Cheers,

Florin

-----Ursprüngliche Nachricht-----
Von: java3d-interest@javadesktop.org
[mailto:java3d-interest@javadesktop.org]
Gesendet: Mittwoch, 18. August 2004 13:43
An: interest@java3d.dev.java.net
Betreff: Re: AW: AW: [JAVA3D-INTEREST] Re: Volume of a closed object

Well, let's consider your simple cube for example.
The lateral surfaces have identical areas and identical but opposite unit normals. Simply plug in the values in my formula, you will get 1/3(3 * Area * side_of_cube) = Volume.

And the reason why the side of the cube comes about automatically is because it is the projection of (r_e - r_w) along the unit normal, where r_e and r_w are the position vectors of the opposite lateral faces, and the projection gives the length of the cube.

I should mention that there is also a method due to O'Rourke based upon calculating the volume of a tetrahedron, IIRC, for the very same objective.

--Vaidya

> Think again ! If you have a horizontal cube (the
> simplest example), then the cube volume is the volume
> generated by the top surface and it's projection on
> the reference xOz plane minus the volume generated by
> the bottom surface and it's projection on the same
> plane. The lateral surfaces generates zero volume
> because their projected surface on the xOz plane has
> a null area.
>
> That's the standard way to compute solid volumes.
> Mathematicaly can be generalized to computing the
> volume of any arbitrary solid (including ones defined
> by parametric surfaces). It's similar to resolving
> integral equations.
>
> Cheers,
>
> Florin
>
> -----Ursprüngliche Nachricht-----
> Von: java3d-interest@javadesktop.org
> [mailto:java3d-interest@javadesktop.org]
> Gesendet: Mittwoch, 18. August 2004 12:32
> An: interest@java3d.dev.java.net
> Betreff: Re: AW: [JAVA3D-INTEREST] Re: Volume of a
> closed object
>
>
> If you calculate the signed volumes and sum them all
> up, the signed areas in the interior will cancel each
> other identically because of opposing outward-normal
> orientations, and the resulting formula should be the
> same as the one that I suggested - I think.
>
> But it may be an interesting excercise !
>
> --Vaidya
>
>
>
>
> > Thinking back on the maths learned in school, I
> > believe that you can decompose the solid into
> > individual surface elements (triangles or quads).
> > First translate the solid such that all vertexes
> have
> > positive Y coordinate, then calculate the volume
> > between each surface element and the xOz plane.
> After
> > that you just sum them, considering that surface
> > elements where the normal points downward (to the
> xOz
> > plane) have negative volume.
> >
> > That algorithm should give an exact result (well of
> > course you may consider the floating point math
> > errors) regardless if the solid is concave or
> convex,
> > as long it is *closed*.
> >
> > Cheers,
> >
> > Florin
> >
> > -----Ursprüngliche Nachricht-----
> > Von: java3d-interest@javadesktop.org
> > [mailto:java3d-interest@javadesktop.org]
> > Gesendet: Dienstag, 17. August 2004 19:34
> > An: interest@java3d.dev.java.net
> > Betreff: Re: [JAVA3D-INTEREST] Re: Volume of a
> closed
> > object
> >
> >
> > One approach is to approximate the integral
> > equivalent of the divergence of the position vector
> > by noting that the divergence of the position
> vector
> > is equal to 3.
> >
> > [code]
> > Volume = 1/3 Sum_over_all_triangles[
> > ( normal_of_triangle dot
> >
> >
> >
> >
> position_vector_of_midpoint_of_triangle
> > ) x Area_of_triangle]
> > [/code]
> > where "dot" is dot product.
> >
> > I don't think there is a convexity restriction
> here.
> > ---
> > [Message sent by forum member 'NVaidya' (N.
> Vaidya)]
> >
> >
> http://www.javadesktop.org/forums/thread.jspa?messageI
> > D=23201媡
> >
> >
> ------------------------------------------------------
> > ---------------
> > To unsubscribe, e-mail:
> > interest-unsubscribe@java3d.dev.java.net
> > For additional commands, e-mail:
> > interest-help@java3d.dev.java.net
> >
> >
> >
> ------------------------------------------------------
> > ---------------
> > To unsubscribe, e-mail:
> > interest-unsubscribe@java3d.dev.java.net
> > For additional commands, e-mail:
> > interest-help@java3d.dev.java.net
> ---
> [Message sent by forum member 'NVaidya' (N. Vaidya)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageI
> D=23385å­™
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net
>
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail:
> interest-help@java3d.dev.java.net
---
[Message sent by forum member 'NVaidya' (N. Vaidya)]

http://www.javadesktop.org/forums/thread.jspa?messageID=23389&#23389

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

nvaidya
Offline
Joined: 2004-08-03
Points: 0

Your intuition is good :)
A minor clarification though when I wrote "my" formula.
I'm pretty sure many people may have used it long before I was born. It's just that I used to use that formula as a convenience to greater refinements. I read that Dave Eberly has a more comprehensive discussion including some fine tunings for accuracy.

--Vaidya

Silvère Martin-Michiellot

At 16:52 17/08/2004, you wrote:
>Does anyone know of a method to determine the volume of an arbitrary
>closed object? The object consists of triangles and could be anywhere in
>space with any size and number of polygons but is always closed.

My last email was about that although it has not appeared on the list yet.

http://www.crd.ge.com/~lorensen/munc/munc.html (volume)
http://www.exaflop.org/docs/cgafaq/cga2.html (surface)

Please be nice and send us your working java code once finished.

>If anyone know where i can find some good starting points for this matter
>I would really apprechiate it.
>---
>[Message sent by forum member 'steinsiv' (Stein-Arne Sivertsen)]
>
>http://www.javadesktop.org/forums/thread.jspa?messageID=23157婵
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
>For additional commands, e-mail: interest-help@java3d.dev.java.net

__________________________________________________________________________________________

Silvere Martin-Michiellot builds the Internet future on
www.digitalbiosphere.com
__________________________________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net