POV-Ray : Newsgroups : povray.general : How find the volume of an object? : Re: How find the volume of an object? Server Time
1 Aug 2024 18:28:45 EDT (-0400)
  Re: How find the volume of an object?  
From: Chris Kinata
Date: 28 Sep 2005 14:26:23
Message: <433ae04f$1@news.povray.org>
Hi all,

I experimented with finding the area of a circle, based on a suggestion
in response to my original post, mistakenly placed in povray.programming.

I did 1000 samples, calculated Ni/Nt (see below), and then averaged 100 runs.
After 100K iterations, the error was ~1%, which didn't seem accurate enough.
I dimly recall that there's a statistical method for developing a weighted
average based on the mean of the samples. After searching for about
an hour, moved on to Mike Williams method (the first response to my
original post in povray.general), which pretty much nailed it for my purposes.
Working on coding a generalized macro that sets the initial bounding box to
the extents of the object, and can (hopefully) handle simple concavities,
internal voids, and rejects internal surfaces.

>>>Concerning this last issue, I had a question: when you do a union of
two objects that results in an internal surface, would trace() stop at the
internal surface? Using a 2D example, if you do a union of two overlapping circles,
you get two arcs that are inside the combined object. Probably should just
do the test rather than asking a general question...but would it be necessary
to use merge rather than union?

--Chris

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

"Jellby" <me### [at] privacynet> wrote in message news:4vq### [at] badulaqueunexes...
> Among other things, Tom York saw fit to write:
>
>> Will scanning the object (in X, Y and Z) with the inside() function do
>> what you want? I've used that approach to compute the centre of mass for
>> things, I don't think it's much different. You can easily modify it to do
>> the adaptive subdivision thing as well.
>
> Sometimes, some kind of "Monte Carlo integration" could work better. It's
> basically the same, but you scan the volume randomly. In the limit, if the
> bounding shape is scanned homegeneously:
>
> Ni/Nt = Vo/Vs
>
> Nt -> Number of points tested
> Ni -> Number of points inside the object
> Vo -> Volume of the object
> Vs -> Volume of the bounding shape
>
> The good thing is you can stop testing points when you want (based on time,
> precision, number of points), instead of being "constrained" to sweeping
> the whole grid you set up at the beginning.
>
> -- 
> light_source{9+9*x,1}camera{orthographic look_at(1-y)/4angle 30location
> 9/4-z*4}light_source{-9*z,1}union{box{.9-z.1+x clipped_by{plane{2+y-4*x
> 0}}}box{z-y-.1.1+z}box{-.1.1+x}box{.1z-.1}pigment{rgb<.8.2,1>}}//Jellby


Post a reply to this message

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