POV-Ray : Newsgroups : povray.general : Collision detection: will this work? Server Time
9 Aug 2024 03:18:02 EDT (-0400)
  Collision detection: will this work? (Message 1 to 4 of 4)  
From: Greg M  Johnson
Subject: Collision detection: will this work?
Date: 6 Sep 2000 11:21:46
Message: <39B65FC4.4A8EB992@my-dejanews.com>
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....



#declare CollisionVolume=
    intersection{
        object{Object_A}
        object{Object_B}
    }

#declare DiagCollVolume=
    <0,0,0>+max_extent(CollisionVolume)-min_extent(CollisionVolume);

#if(vlength(DiagCollVolume >0)
    BOOM!
#end


Post a reply to this message

From: Ron Parker
Subject: Re: Collision detection: will this work?
Date: 6 Sep 2000 11:31:09
Message: <slrn8rcpkb.1f7.ron.parker@fwi.com>
On Wed, 06 Sep 2000 11:16:20 -0400, Greg M. Johnson 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....

You are right; it will not work, and for (essentially) the reasons you 
note.  You wouldn't want it to not be lazy, by the way: it would get 
much much slower if it did.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Chris Huff
Subject: Re: Collision detection: will this work?
Date: 6 Sep 2000 12:15:35
Message: <chrishuff-42A7BC.11171806092000@news.povray.org>
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

From: Greg M  Johnson
Subject: Re: Collision detection: will this work?
Date: 6 Sep 2000 12:48:09
Message: <39B6740D.6C2354A8@my-dejanews.com>
#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

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