POV-Ray : Newsgroups : povray.programming : How find the volume of an object? Server Time
18 May 2024 05:07:22 EDT (-0400)
  How find the volume of an object? (Message 1 to 5 of 5)  
From: Chris Kinata
Subject: How find the volume of an object?
Date: 21 Sep 2005 14:26:52
Message: <4331a5ec@news.povray.org>
Hi all...

What is the best method in POV-Ray for finding the
volume of a simple convex (that is, no hollows or cavities)
object that is the intersection of two other objects?

One way might be to iteratively intersect this object
with a series of long thin boxes incremented
along (for example) the xy plane, and use the Extents macro
in shapes.inc to get the length of the box. Summing these
box volumes would return a total volume slightly larger
than the real volume.

Another way might be to use the Isect macro to get
the intersection points at each corner of each "box"
and calculate the volume of the resulting polyhedron.

Is there an easier way to do this?

Regards,
Chris

-- 
||||| www.kinata.net web design and hosting


Post a reply to this message

From: Warp
Subject: Re: How find the volume of an object?
Date: 21 Sep 2005 15:30:03
Message: <4331b4ba@news.povray.org>
Chris Kinata <chr### [at] kinatacom> wrote:
> What is the best method in POV-Ray for finding the
> volume of a simple convex (that is, no hollows or cavities)
> object that is the intersection of two other objects?

  Do you want the exact volume or an approximation?

> One way might be to iteratively intersect this object
> with a series of long thin boxes incremented
> along (for example) the xy plane, and use the Extents macro
> in shapes.inc to get the length of the box.

  Nope, that doesn't work because that macro simply uses min_extent()
and max_extent() which just return the corners of the bounding box of
the given object. CSG intersection does not decrement the size of the
original bounding boxes of the involved objects.

  One possibility, which works with any object with a defined interior
(not just convex ones) is to sample points inside the bounding box of
the object and use inside() to see if the points are inside the object
or not (just a triply-nested loop which goes through all the points
at even distances inside the bounding box should do it). Just count the
number of points inside the object and divide by the total number of
points you sampled and you'll get a factor. When you multiply the volume
of the bounding box with this factor you'll get an approximation of the
volume of the object.
  The problem with this method is that if you want any accuracy you will
have to sample a lot of points and it will be SLOW.

-- 
                                                          - Warp


Post a reply to this message

From: Chris Kinata
Subject: Re: How find the volume of an object?
Date: 21 Sep 2005 16:17:44
Message: <4331bfe8@news.povray.org>
Hi Warp,

Of course, an exact number would be nice, but didn't hope that
there was an exact method short of using integrals outside POV-Ray.

Concerning your point-iterated method, I seem to recall from long ago
a statistical method that gives you an approximation of the area of
a shapge given a series of points inside it...have to remember harder.

Concerning the second method in my original post, I've used Isect as
a sort of "depth-finder" to read surface coordinates over a composite object.

Incidentally, was thinking that what would be cool is a sort of
"multi-Isect" macro that could shoot a ray through an object and return a
list of vectors, one for each pair of entrance and exit points.

Regards,
Chris


-- 
||||| www.kinata.net web design and hosting

"Warp" <war### [at] tagpovrayorg> wrote in message news:4331b4ba@news.povray.org...
> Chris Kinata <chr### [at] kinatacom> wrote:
>> What is the best method in POV-Ray for finding the
>> volume of a simple convex (that is, no hollows or cavities)
>> object that is the intersection of two other objects?
>
>  Do you want the exact volume or an approximation?
>
>> One way might be to iteratively intersect this object
>> with a series of long thin boxes incremented
>> along (for example) the xy plane, and use the Extents macro
>> in shapes.inc to get the length of the box.
>
>  Nope, that doesn't work because that macro simply uses min_extent()
> and max_extent() which just return the corners of the bounding box of
> the given object. CSG intersection does not decrement the size of the
> original bounding boxes of the involved objects.
>
>  One possibility, which works with any object with a defined interior
> (not just convex ones) is to sample points inside the bounding box of
> the object and use inside() to see if the points are inside the object
> or not (just a triply-nested loop which goes through all the points
> at even distances inside the bounding box should do it). Just count the
> number of points inside the object and divide by the total number of
> points you sampled and you'll get a factor. When you multiply the volume
> of the bounding box with this factor you'll get an approximation of the
> volume of the object.
>  The problem with this method is that if you want any accuracy you will
> have to sample a lot of points and it will be SLOW.
>
> -- 
>                                                          - Warp


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: How find the volume of an object?
Date: 21 Sep 2005 16:40:36
Message: <4331c544$1@news.povray.org>
Chris Kinata wrote:
> along (for example) the xy plane, and use the Extents macro
> in shapes.inc to get the length of the box. Summing these

<snip>

This is the wrong group for this question.  This group is for discussion of
the POV-Ray source code.  Questions about using the POV-Ray should be asked
in either povray.general or povray.newusers.

     Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Chris Kinata
Subject: Re: How find the volume of an object?
Date: 21 Sep 2005 17:43:02
Message: <4331d3e6$1@news.povray.org>
wups, sorry..will repost in povray.general

--Chris

-- 
||||| www.kinata.net web design and hosting

"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:4331c544$1@news.povray.org...
> Chris Kinata wrote:
>> along (for example) the xy plane, and use the Extents macro
>> in shapes.inc to get the length of the box. Summing these
>
> <snip>
>
> This is the wrong group for this question.  This group is for discussion of
> the POV-Ray source code.  Questions about using the POV-Ray should be asked
> in either povray.general or povray.newusers.
>
>     Thorsten
>
> ____________________________________________________
> Thorsten Froehlich
> e-mail: mac### [at] povrayorg
>
> I am a member of the POV-Ray Team.
> Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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