POV-Ray : Newsgroups : povray.unofficial.patches : MegaPov collision detection Server Time
1 Jun 2024 04:02:56 EDT (-0400)
  MegaPov collision detection (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: Daniel Jungmann
Subject: MegaPov collision detection
Date: 16 Mar 2004 06:29:22
Message: <4056e512@news.povray.org>
Hi, 
 
collision detection in MegaPov is a cool feature, but it is verry slow,
especialy mass-face collision. MegaPov spend most of it's time in the
function func_triangle (file mechsim.cpp). A bounding system coud speed up
the mass-face and mass-mass collision.
What do you think of this idea?


Post a reply to this message

From: Christoph Hormann
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 07:15:02
Message: <c36qv0$4ng$1@chho.imagico.de>
Daniel Jungmann wrote:
> Hi, 
>  
> collision detection in MegaPov is a cool feature, but it is verry slow,
> especialy mass-face collision. MegaPov spend most of it's time in the
> function func_triangle (file mechsim.cpp). A bounding system coud speed up
> the mass-face and mass-mass collision.
> What do you think of this idea?

Do you think recalculating a bounding tree after every simulation step 
will be faster in the end?

It would be possible to speed up the triangle function a bit since we 
don't actually need its value if it exceeds the mass radius of course.

To speed up collision calculations the mechsim patch has the possibility 
to group masses and only enable collisions between masses of different 
groups.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 07 Mar. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Nicolas Calimet
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 07:53:14
Message: <4056f8b9@news.povray.org>
> Do you think recalculating a bounding tree after every simulation step
> will be faster in the end?

        I don't know how collision detection is performed in MegaPOV for now: does
it account for all particles at once ?  (i.e. O(N^2) time complexity ?)

        From my experience in biomolecular simulations, there is in principle no
need to recalculate the interaction list (or bounding tree) at every step
of the simulation.  Simple heuristics can be used to recalculate it when
the particule moves away by more than a certain distance from the position
at which the bounding tree was calculated.  Of course the efficiency then
depends on the velocity of the fastest particle at a given time step, but
typically the tree could be updated only every 5-10 steps.  Speed up is
considerable with respect to O(N^2) anyway (especially for short "cutoff"
distance when calculating the interaction list).

        - NC


Post a reply to this message

From: Christoph Hormann
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 08:35:02
Message: <c36vod$5ft$1@chho.imagico.de>
Nicolas Calimet wrote:
>>Do you think recalculating a bounding tree after every simulation step
>>will be faster in the end?
> 
> 
>         I don't know how collision detection is performed in MegaPOV fo
r now: does
> it account for all particles at once ?  (i.e. O(N^2) time complexity ?)


That depends on your settings, if you do full collision detection you of 

course need to check every topology feature against every other one - O(n


>         From my experience in biomolecular simulations, there is in pri
nciple no
> need to recalculate the interaction list (or bounding tree) at every st
ep
> of the simulation.  [...]

I am not sure what you mean by 'interaction list' but this is not like a 

molecular simulation where you have very high number of molecules and 
are only interested in the statistical outcome.  A mass not correctly 
colliding where it should will ruin the whole simulation.  The idea of 
using techniques known from bounding (i.e. min/max metric to determine 
the possibility of a collision) is surely not bad but this will not 
change the order of complexity.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 07 Mar. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Nicolas Calimet
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 09:03:30
Message: <40570932@news.povray.org>
> That depends on your settings, if you do full collision detection you of
> course need to check every topology feature against every other one -


        Okay so if a full collision detection requires O(N^2) operations,
then it definitely means that there is no "smart" mechanism to "cut away"
all possible cases where collisions cannot happen at that particular
time step.  Such a partitioning scheme can be as simple as a cubic space
division.

> I am not sure what you mean by 'interaction list'

        This list stores all possible pairs of particles that are seperated
by less than a threshold distance.  Building such a list is basically in
O(N) operations -- devide the space into cubes and assign each particle
to a given cube, then for each cube check the particles in the 26 neigh-
bours and the current cube.  The later collision detection remains in
O(N'^2) but with N' << N.  Overall you should get something like O(N log N)
but I'm good enough in maths to tell whether it's the case  :-(
        The trick comes from what should be the size of the cube depending
on the particle shape in particular.  In case of only spheres or any simple
shape for the particles, it's very straightforward of course.

> where you have very high number of molecules and
> are only interested in the statistical outcome.  A mass not correctly
> colliding where it should will ruin the whole simulation.

        The simulations I'm talking about do consider much more than
just the mass and shape of the particles (here atoms) to evalulate
their interactions at a given time.  So I don't think there would be
any problem applying similar rules when you are interested in collision
detection.  The only difference is that all particules have the same
shape, so I don't know how to handle situations such as a sphere
colliding a plane or an isosurface (the former could be most likely
treated efficiently, but I suspect the second should require some sort
of tesselated model of the isosurface first).
        Or maybe I don't understand what you mean -- it's often a problem
of mine... you know :-)

        - NC


Post a reply to this message

From: Nicolas Calimet
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 09:05:35
Message: <405709af@news.povray.org>
> but I'm good enough in maths to tell whether it's the case  :-(

        ... "I'm _NOT_ good enough" is what I meant  :-( :-( :-(

        - NC


Post a reply to this message

From: Christoph Hormann
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 09:55:02
Message: <c3749l$68c$1@chho.imagico.de>
Nicolas Calimet wrote:
  >
>>I am not sure what you mean by 'interaction list'
> 
> 
>         This list stores all possible pairs of particles that are seper
ated
> by less than a threshold distance.  Building such a list is basically i
n
> O(N) operations -- devide the space into cubes and assign each particle

> to a given cube, then for each cube check the particles in the 26 neigh
-
> bours and the current cube.  The later collision detection remains in
> O(N'^2) but with N' << N.  Overall you should get something like O(N lo
g N)
> but I'm good enough in maths to tell whether it's the case  :-(

I think i understand your point but this will only be useful if you have 

a high number of particles that fill a bounded area and do not change 
their distribution in space very fast.  If this is not the case you will 

spent most of your time doing the list building.

The technique i outlined in my last post would not require any 

possible collision (which would just be a number of coordinate 
comparisons) and the rest would be the same O(N'^2) as in your method.

And as you already said your space division grid will only work if you 
have only point masses with all the same radius.  The original topic of 
this discussion was mass-triangle collisions with varying radii.

Christoph.

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 07 Mar. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Daniel Jungmann
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 14:39:54
Message: <4057580a@news.povray.org>
Christoph Hormann wrote:

> Do you think recalculating a bounding tree after every simulation step
> will be faster in the end?
> 
> It would be possible to speed up the triangle function a bit since we
> don't actually need its value if it exceeds the mass radius of course.
> 
> To speed up collision calculations the mechsim patch has the possibility
> to group masses and only enable collisions between masses of different
> groups.
> 
> Christoph
> 

Yes, I think bounding would speed up the hole thing. Building a bounding box
or sphere tree is too slow, but using a hash function is fast enough.

Daniel


Post a reply to this message

From: Christoph Hormann
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 15:00:02
Message: <c37m8n$9lp$1@chho.imagico.de>
Daniel Jungmann wrote:
> 
> Yes, I think bounding would speed up the hole thing. Building a bounding box
> or sphere tree is too slow, but using a hash function is fast enough.

I am not sure what you are trying to suggest here.  If you have a 
technique in mind you think that would speed up the collision tests 
please make a more elaborate description.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 07 Mar. 2004 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Daniel Jungmann
Subject: Re: MegaPov collision detection
Date: 16 Mar 2004 15:23:29
Message: <40576241@news.povray.org>
Christoph Hormann wrote:

> Daniel Jungmann wrote:
>> 
>> Yes, I think bounding would speed up the hole thing. Building a bounding
>> box or sphere tree is too slow, but using a hash function is fast enough.
> 
> I am not sure what you are trying to suggest here.  If you have a
> technique in mind you think that would speed up the collision tests
> please make a more elaborate description.
> 
> Christoph
> 

Using a hash function that maps 3D boxes (cells) to a 1D hash table index.
http://graphics.ethz.ch/~brunoh/download/CollisionDetectionHashing_VMV03.pdf


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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