|
|
#declare Precision=100; // sqrt( number of samples you want to take)
#declare CollisionVolume=
intersection{
object{Object_A}
object{Object_B}
}
#declare Norm=<0,0,0>;
#declare Corn1=max_extent(CollisionVolume);
#declare Corn2=min_extent(CollisionVolume);
#declare BOOM=false;
#declare nx=0;
#while(nx<Precision)
#declare ny=0;
#while(ny<Precision)
#declare Norm=<0,0,0>;
#declare
Tracer=trace(CollisionVolume,<Corn1.x+(Corn2.x-Corn1.x)*nx/Precision,Corn1.y+(Corn2.y-Corn1.y)*ny/Precision,Corn1.z-100>,z,Norm;)
#if(vlength(Norm) >0)
#declare BOOM=true;
#end
#declare ny=ny+1;
#end
#declare nx=nx+1;
#end
#if (BOOM=true)
//do something here
#end
// Yes, we need a separate function to do this for us!
// I would actually prefer a function:
#declare Volumey= volume(CollisionVolume)
#if(Volumey>0)
//do something here
#end
This would also be of use in my flocking animations where I want to avoid
collisions with objects. I propose that the best feedback for goodness of an
algorithm would be a simple measure of the volume of the intersection between
my flock and the object to be avoided. Instead, I often have to compose a
bunch of pictures and look to see if there have been any intersections. This
is of course using povray--"the Raytracer, Not a Modeller".
Chris Huff wrote:
> In article <39B65FC4.4A8EB992@my-dejanews.com>,
> gre### [at] my-dejanewscom wrote:
>
> > Would this work? I am afraid that it will not because povray (megapov),
> > I fear, is very lazy about giving true information in the min &
> > max_extent functions....
>
> It isn't "being lazy", those functions just return the min and max
> extents of the bounding box. You shouldn't expect it to give the actual
> extents of the object.
> Maybe these functions should be called min_bbox() and max_bbox()
> instead, and the *_extent() functions should attempt to find the true
> extents by tracing a bunch of rays at the object. This will be slower,
> but still useable(it is useable even when implemented in POV-Script).
> There may be portions of the objects that don't get hit, but if you need
> a bounding box that is guaranteed to enclose the whole object, you
> should use the *_bbox() functions.
>
> --
> Christopher James Huff
> Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
>
> <><
Post a reply to this message
|
|