POV-Ray : Newsgroups : povray.advanced-users : Colision testing ? Server Time
1 Nov 2024 11:14:34 EDT (-0400)
  Colision testing ? (Message 1 to 6 of 6)  
From:  Light Beam 
Subject: Colision testing ?
Date: 22 Apr 2002 16:58:44
Message: <3cc47984@news.povray.org>
I must duplicate an object included in a "bounded_by" box, but how can I
make to be sure the duplicated objects (for example 5 objects) doesn't be
placed inside an other (Excuse me for my poor English).


Post a reply to this message

From: Hugo
Subject: Re: Colision testing ?
Date: 22 Apr 2002 17:24:30
Message: <3cc47f8e$1@news.povray.org>
There are many ways to do this, but you will probably have to code them
yourself, because there is no single POV-Ray "keyword" for collision
detection.

The simplest way might be the fastest: If you have 5 objects, find the size
of each object. Choose 5 locations to put your objects. Place all objects.
Check if the location of object_1 + object_1_size, is within the range of
object_2 location + object_2_size, object_3 + object_3_size ..etc.. You will
need to use a little math to check this, but I think you understand the
idea.

This idea does not consider the shape of the objects, only it's bounding
box, so it's very simple. Some people here have coded greater things, but I
don't know if they have released their code to the public.. They should
have, you know.. Heh.. ;o)

Regards,
Hugo


Post a reply to this message

From:
Subject: Re: Colision testing ?
Date: 23 Apr 2002 04:38:49
Message: <i06acu4occgp43qjftefvkfu7ct075vd59@4ax.com>
On Mon, 22 Apr 2002 23:07:46 +0200, "_Light_Beam_" <fac### [at] aolcom> wrote:
> I must duplicate an object included in a "bounded_by" box, but how can I
> make to be sure the duplicated objects (for example 5 objects) doesn't be
> placed inside an other (Excuse me for my poor English).

probably it is not the fastest but rather simplest to explain method:
1. create and set location for both sets of objects
2. perform intersection{} on them
3. use VRand_In_Obj() to find any point in object
if returned point isn't inside intersection then you can be almost sure they
not overlap

ABX


Post a reply to this message

From:  Light Beam 
Subject: Re: Colision testing ?
Date: 23 Apr 2002 05:58:41
Message: <3cc53051@news.povray.org>
I have another idea but I don't know how to use "arays" with pov...

Make a loop to put the objects only in 2 dimensionnal coords. using arrays
(for exemple : box {<rand(a[8])*10, rand(b[8])*10, 0><rand(a[8])*10,
rand(b[8])*10, 1>} -> the number inside [] are the number of the array )
then made a second loop that check all the box created before this (in this
example from 1 to 7) and restart until the random number was different from
this one... pfff, So I dont know if "arrays" makes its in PoV !?


i06acu4occgp43qjftefvkfu7ct075vd59@4ax.com...
> On Mon, 22 Apr 2002 23:07:46 +0200, "_Light_Beam_" <fac### [at] aolcom>
wrote:
> > I must duplicate an object included in a "bounded_by" box, but how can I
> > make to be sure the duplicated objects (for example 5 objects) doesn't
be
> > placed inside an other (Excuse me for my poor English).
>
> probably it is not the fastest but rather simplest to explain method:
> 1. create and set location for both sets of objects
> 2. perform intersection{} on them
> 3. use VRand_In_Obj() to find any point in object
> if returned point isn't inside intersection then you can be almost sure
they
> not overlap
>
> ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: Colision testing ?
Date: 23 Apr 2002 12:28:31
Message: <pan.2002.04.23.11.30.42.551423.823@mac.com>


> probably it is not the fastest but rather simplest to explain method: 1.
> create and set location for both sets of objects 2. perform
> intersection{} on them
> 3. use VRand_In_Obj() to find any point in object if returned point
> isn't inside intersection then you can be almost sure they not overlap

A faster way would be to write a special macro that does this:
Check if the bounding boxes overlap. If they overlap, get the
intersection of both shapes and start looking for a random point inside
the intersection's bounding box which is also inside the intersection.
If you find one, the boxes intersect. Give up after a certain (large)
number of tries. You could use the VRand_In_Obj() macro as a base for
this.
Of course, this won't work for objects which don't have insides, such as
triangles, meshes, and bezier patches. You would have to write special
macros to handle those.


-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: <chr### [at] tagpovrayorg>
WWW: http://homepage.mac.com/chrishuff/


Post a reply to this message

From: JRG
Subject: Re: Colision testing ?
Date: 23 Apr 2002 13:57:18
Message: <3cc5a07e$1@news.povray.org>
<off topic>

Does SFZ3 in your e-mail addy stand for Street Fighter Zero (Alpha) 3? Hell, I loved
that game...

<off topic>


--
Jonathan.

Home: http://digilander.iol.it/jrgpov

"_Light_Beam_" <fac### [at] aolcom> ha scritto nel messaggio
news:3cc47984@news.povray.org...
> I must duplicate an object included in a "bounded_by" box, but how can I
> make to be sure the duplicated objects (for example 5 objects) doesn't be
> placed inside an other (Excuse me for my poor English).
>
>


Post a reply to this message

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