POV-Ray : Newsgroups : povray.programming : How find the volume of an object? : Re: How find the volume of an object? Server Time
1 Jun 2024 16:26:09 EDT (-0400)
  Re: How find the volume of an object?  
From: Chris Kinata
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

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