POV-Ray : Newsgroups : povray.advanced-users : collision detection Server Time
26 Nov 2024 04:25:56 EST (-0500)
  collision detection (Message 1 to 10 of 30)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Paul Jones
Subject: collision detection
Date: 22 Feb 2001 09:57:47
Message: <3A9528ED.EE6FFF0C@psu.edu>
How can I create a collision detection routine? More specifically, what
do I look at to determine if two objects have collided in pov-space ? I
can figure it out with...say... unit spheres, that is easy, but what
about rotated cubes and more oddly shaped objects??

thank you


paul
-- 



--------------------------------------------------}
Paul Daniel Jones
The Pennslyvania State University

pdj### [at] psuedu
http://research.chem.psu.edu/glassgrp/paul

       C            The way is near, but men
     // \           seek it afar. It is in the
    N    N          easy things, but men seek it
    |    ||         in the difficult things.
    C    C          -Menicius
     \\  /
       C
--------------------------------------------------}


Post a reply to this message

From: Christoph Hormann
Subject: Re: collision detection
Date: 22 Feb 2001 10:27:46
Message: <3A952FF1.C3480B75@gmx.de>
Paul Jones wrote:
> 
> How can I create a collision detection routine? More specifically, what
> do I look at to determine if two objects have collided in pov-space ? I
> can figure it out with...say... unit spheres, that is easy, but what
> about rotated cubes and more oddly shaped objects??
> 

In general that's a very difficult task, one method would be doing a lot
of tests with 'trace'.  

Finding out whether two boxes collide could for example be done by
'tracing' along all their edges.  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Ron Parker
Subject: Re: collision detection
Date: 22 Feb 2001 10:36:08
Message: <slrn99acfa.qbu.ron.parker@fwi.com>
On Thu, 22 Feb 2001 16:27:45 +0100, Christoph Hormann wrote:
>In general that's a very difficult task, one method would be doing a lot
>of tests with 'trace'.  

In general, it's an impossible task.  The best you can do is an 
approximation.  For example, try to determine whether the intersection 
of two complex CSG objects is nonempty.

>Finding out whether two boxes collide could for example be done by
>'tracing' along all their edges.  

Even that wouldn't see the special case where one box is entirely enclosed
by the other box.

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


Post a reply to this message

From: Francois Labreque
Subject: Re: collision detection
Date: 22 Feb 2001 10:46:26
Message: <3A9533B0.CDE4E377@videotron.ca>
Christoph Hormann wrote:
> 
> Paul Jones wrote:
> >
> > How can I create a collision detection routine? More specifically, what
> > do I look at to determine if two objects have collided in pov-space ? I
> > can figure it out with...say... unit spheres, that is easy, but what
> > about rotated cubes and more oddly shaped objects??
> >
> 
> In general that's a very difficult task, one method would be doing a lot
> of tests with 'trace'.
> 
> Finding out whether two boxes collide could for example be done by
> 'tracing' along all their edges.

You can limit the number of traces necessary if you first find the
min_extent and max_extent of your objects.  If these don't overlap, then
your objects don't touch one another.  If they do, then you have to
start tracing along the side(s) where the bounding boxes overlap.

Note: You need MegaPOV to do this.

-- 
Francois Labreque |   //\\    Wear an ASCII ribbon!
    flabreque     |  ||  ||   
        @         |   \\//    Support the campain
   videotron.ca        \\     against HTML e-mail
                      //\\    and news!


Post a reply to this message

From: Chris Huff
Subject: Re: collision detection
Date: 22 Feb 2001 11:07:27
Message: <chrishuff-67E254.11063222022001@news.povray.org>
In article <slr### [at] fwicom>, ron### [at] povrayorg 
wrote:

> Even that wouldn't see the special case where one box is entirely enclosed
> by the other box.

But you could use eval_pattern() with the object pattern to catch this 
case...you would still need to use trace() though, because there are 
cases when two boxes intersect but all of their corners are outside.

And if you use a similar method to do collision with meshes, you could 
tesselate (almost) any object with the tesselation patch and use the 
resulting mesh for collision testing. It would be slow (a patch might be 
needed to get a useable speed, like a "objects_intersect(ObjectA, 
ObjectB, ...ObjectX) function), but you could speed it up a little by 
using low-resolution meshes, either as a bounds test or for the actual 
collision detection.

-- 
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: Christoph Hormann
Subject: Re: collision detection
Date: 22 Feb 2001 11:19:18
Message: <3A953C06.F7A4B59D@gmx.de>
Ron Parker wrote:
> 
> In general, it's an impossible task.  The best you can do is an
> approximation.  For example, try to determine whether the intersection
> of two complex CSG objects is nonempty.

As long as the shapes are basic mathematical objects (like sphere,
cylinder, box, etc.) it is possible to find an precise solution.  Of
course if the objects are approximated themselves (like isosurfaces) it is
not.

> 
> >Finding out whether two boxes collide could for example be done by
> >'tracing' along all their edges.
> 
> Even that wouldn't see the special case where one box is entirely enclosed
> by the other box.
> 

All right, as Chris Huff mentioned you could use eval_pattern and the
object pattern (maybe it would be a good idea to make the Inside_Object()
function available in POV script just like trace()).

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Ron Parker
Subject: Re: collision detection
Date: 22 Feb 2001 11:27:01
Message: <slrn99afen.qd0.ron.parker@fwi.com>
On Thu, 22 Feb 2001 11:06:32 -0500, Chris Huff wrote:
>And if you use a similar method to do collision with meshes, you could 
>tesselate (almost) any object with the tesselation patch and use the 
>resulting mesh for collision testing. It would be slow (a patch might be 

But that is, as I said, an approximation.

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


Post a reply to this message

From: Ron Parker
Subject: Re: collision detection
Date: 22 Feb 2001 11:31:51
Message: <slrn99afnp.qd0.ron.parker@fwi.com>
On Thu, 22 Feb 2001 17:19:18 +0100, Christoph Hormann wrote:
>As long as the shapes are basic mathematical objects (like sphere,
>cylinder, box, etc.) it is possible to find an precise solution.  Of
>course if the objects are approximated themselves (like isosurfaces) it is
>not.

Isosurfaces can be viewed as basic mathematical objects for the sake of
this exercise, since the approximation is purely visual.  The problem
of determining whether two "basic mathematical objects" overlap reduces
to a simple matter of solving a set of simultaneous equations and looking
for solutions within given ranges.  Unfortunately, the equations you're
solving aren't necessarily linear or even polynomial.  Presumably it's
possible to solve such a system for any given combination of objects
(though not necessarily) but it's either impossible or ridiculously 
difficult to automate the process for any two arbitrary objects.

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


Post a reply to this message

From: Christoph Hormann
Subject: Re: collision detection
Date: 22 Feb 2001 11:56:28
Message: <3A9544B5.F763E135@gmx.de>
Ron Parker wrote:
> 
> Isosurfaces can be viewed as basic mathematical objects for the sake of
> this exercise, since the approximation is purely visual.  The problem
> of determining whether two "basic mathematical objects" overlap reduces
> to a simple matter of solving a set of simultaneous equations and looking
> for solutions within given ranges.  Unfortunately, the equations you're
> solving aren't necessarily linear or even polynomial.  Presumably it's
> possible to solve such a system for any given combination of objects
> (though not necessarily) but it's either impossible or ridiculously
> difficult to automate the process for any two arbitrary objects.
> 

Seems you are right if you want to make it work for any CSG.  Anyway if
you only need the objects themselves (or unions) it could be reduced to a
set of independent equations.  

After all, whether you need a numerical approximation to solve the problem
is not important in this case.  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Christoph Hormann
Subject: Re: collision detection
Date: 22 Feb 2001 11:57:42
Message: <3A954507.F4A1D04@gmx.de>
Chris Huff wrote:
> 
> And if you use a similar method to do collision with meshes, you could
> tesselate (almost) any object with the tesselation patch and use the
> resulting mesh for collision testing. It would be slow (a patch might be
> needed to get a useable speed, like a "objects_intersect(ObjectA,
> ObjectB, ...ObjectX) function), but you could speed it up a little by
> using low-resolution meshes, either as a bounds test or for the actual
> collision detection.
> 

One could also use the brute force method using eval_pattern on the object
patterns of the two objects in a fine parallel raster...

I'm not even sure if that's slower, because tesselation is not needed.  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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