POV-Ray : Newsgroups : povray.newusers : Collision detection Server Time
13 Nov 2024 22:22:40 EST (-0500)
  Collision detection (Message 1 to 10 of 10)  
From: Tom Melly
Subject: Collision detection
Date: 14 Jan 2000 08:19:29
Message: <387f2261@news.povray.org>
Hi, has anyone got any general advice/links/macros/whatever on collision
detection in POV?


Post a reply to this message

From: Chris Huff
Subject: Re: Collision detection
Date: 14 Jan 2000 09:55:46
Message: <chrishuff_99-43AE9F.09560714012000@news.povray.org>
In article <387f2261@news.povray.org>, "Tom Melly" 
<tom### [at] tomandluforce9couk> wrote:

> Hi, has anyone got any general advice/links/macros/whatever on collision
> detection in POV?

What do you want to detect collisions of? If it is simply two spheres, 
use something like
#if(vlength(CenterA - CenterB)<(RadiusA + RadiusB))
   // spheres are colliding
#else
   // spheres are not colliding
#end

The math is pretty simple for many other objects. I don't know of any 
macros for this.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Tom Melly
Subject: Re: Collision detection
Date: 14 Jan 2000 10:47:00
Message: <387f44f4@news.povray.org>
Chris Huff <chr### [at] yahoocom> wrote in message
news:chrishuff_99-43AE9F.09560714012000@news.povray.org...
> In article <387f2261@news.povray.org>, "Tom Melly"
> <tom### [at] tomandluforce9couk> wrote:
>
> What do you want to detect collisions of? If it is simply two spheres,
> use something like
> #if(vlength(CenterA - CenterB)<(RadiusA + RadiusB))
>    // spheres are colliding
> #else
>    // spheres are not colliding
> #end
>
> The math is pretty simple for many other objects. I don't know of any
> macros for this.
>

hmm, I was more thinking of, for example, being able to place random rocks
on the surface of a heightfield by detecting when you'd hit the y value of
the hf at a particular x and z location.


Post a reply to this message

From: Chris Huff
Subject: Re: Collision detection
Date: 14 Jan 2000 10:57:05
Message: <chrishuff_99-3A7885.10572614012000@news.povray.org>
In article <387f44f4@news.povray.org>, "Tom Melly" 
<tom### [at] tomandluforce9couk> wrote:

> hmm, I was more thinking of, for example, being able to place random rocks
> on the surface of a heightfield by detecting when you'd hit the y value of
> the hf at a particular x and z location.

For that, you need a patched version of POV that has the trace() 
function. This function lets you trace rays within the scene file, so 
you can just trace a ray straight down from the rocks xz location to get 
the right y distance. MegaPOV has this function.
http://nathan.kopp.com/patched.htm
The only other way I know of would be to use an external program to get 
the color values and calculate the correct height at each point by hand.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: TonyB
Subject: Re: Collision detection
Date: 14 Jan 2000 12:17:27
Message: <387f5a27@news.povray.org>
>The only other way I know of would be to use an external program to get
>the color values and calculate the correct height at each point by hand.


You can also use hf_height_at.


Post a reply to this message

From: Chris Huff
Subject: Re: Collision detection
Date: 14 Jan 2000 12:32:05
Message: <chrishuff_99-57DE98.12322514012000@news.povray.org>
In article <387f5a27@news.povray.org>, "TonyB" 
<ben### [at] panamaphoenixnet> wrote:

> You can also use hf_height_at.

You could, I think that patch was also included in MegaPOV. But it seems 
to just be redundant to me, and nowhere near as versatile/flexible as 
trace().

With trace(), you can easily set up your placement algorithm, and if you 
decide you want to have a box embedded into your height field, you could 
just use a union of the box and height field. With hf_height_at, you 
would have to manually check for intersection with the box, and would 
probably end up using trace() anyway. And if you decide to use an 
isosurface instead of a height field, hf_height_at is useless.

Also,  trace() can give the normal of a surface, which can be useful in 
the realistic placement of objects.

But you are right, I had forgotten about that patch, and it can be used 
if you are only using a height field and if you know you will always be 
using a height field.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

From: Phil Clute
Subject: Re: Collision detection
Date: 14 Jan 2000 14:04:31
Message: <387F7355.7B756DEE@tiac.net>
There's some info here, I'm not sure how much use it will be to you
though.
http://freespace.virgin.net/hugo.elias/
-- 
Phil
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: Peter Popov
Subject: Re: Collision detection
Date: 14 Jan 2000 16:59:00
Message: <CJd=OGp+expkMPB=3JNOI8w8f5Gg@4ax.com>
On Fri, 14 Jan 2000 13:19:24 -0000, "Tom Melly"
<tom### [at] tomandluforce9couk> wrote:

>Hi, has anyone got any general advice/links/macros/whatever on collision
>detection in POV?

It's a rather complex task and it does not have an unique non-discrete
solution. While you could work out methods for simple primitives
(spheres, planes and boxes come to mind), general objects will require
some means of tesselation. One way which pops up into my poor
insomnia-mutilated brain is to trace a bunch of rays (say a hundred)
using, for example, Nathan's jittered spiral method, save those in an
array, and then check them against the bounds of another object. This
will be useful for the rocks-on-a-height-field case you seem to be
most interested in. Of course at least one of the objects has to have
a simple insideness test (like most primatives do).

Detecting collision of two meshes (with the face- and vertex indices
known) is another thing. It is no new thing as it's done in many
commercial packages, one just has to look around and find it. Ken's
links on povray.org whould be a good starter.


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Ken
Subject: Re: Collision detection
Date: 14 Jan 2000 20:23:18
Message: <387FCC24.4770CB60@pacbell.net>
Tom Melly wrote:
> 
> Hi, has anyone got any general advice/links/macros/whatever on collision
> detection in POV?

 Check out "proxima", from Purdue, which is a C++ library for 3D
collision detection for arbitrary polyhedra.  It's a nice system;
the algorithms are sophisticated, but the code is of modest size.
ftp://ftp.cs.purdue.edu/pub/pse/PROX/prox9.1.tar.Z
  For information about the I_COLLIDE 3D collision detection system
http://www.cs.unc.edu/~geom/I_COLLIDE.html
"Fast Collision Detection of Moving Convex Polyhedra", Rich Rabbitz,
Graphics Gems IV, pages 83-109, includes source in C.
SOLID: "a library for collision detection of three-dimensional
objects undergoing rigid motion and deformation. SOLID is designed to
be used in interactive 3D graphics applications, and is especially
suited for collision detection of objects and worlds described in VRML.
Written in standard C++, compiles under GNU g++ version 2.8.1 and
Visual C++ 5.0."  See:        http://www.win.tue.nl/cs/tt/gino/solid/


-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Tom Melly
Subject: Re: Collision detection
Date: 15 Jan 2000 20:42:37
Message: <3881220d@news.povray.org>
Many thanks for all the advice - I've gone for the megaPov and be damned
with it.

Trace and bounds will probably do it - I just want to scatter some pebbles
on a hf beach.

--
Tom Melly
tom### [at] tomandluforce9couk
http://www.tomandlu.force9.co.uk


Post a reply to this message

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