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:24:32 EDT (-0400)
  Re: How find the volume of an object?  
From: Jellby
Date: 28 Sep 2005 11:10:02
Message: <4vql03-ejm.ln1@badulaque.unex.es>
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.