POV-Ray : Newsgroups : povray.unofficial.patches : Speed of collision tests in mechsim : Re: Speed of collision tests in mechsim Server Time
28 Sep 2024 16:38:32 EDT (-0400)
  Re: Speed of collision tests in mechsim  
From: Mike Andrews
Date: 4 Jun 2004 05:15:00
Message: <web.40c03c3defaf46a7c717c9af0@news.povray.org>
"Chambers" <bdc### [at] yahoocom> wrote:
> Of course, and I never meant to imply that you could do without calculating
> it for those collisions that do occur.  I was only looking for a way to
> cull those which do not.
>
> ....Chambers

For a static area-filling I've used 'binning' to speed up intersection
checks when adding new items:

Chop one or more of the axes into bins of equal width (of about twice the
expected interaction radius), covering the extent of the items. A simple,
fast function will then tell you which bin any point belongs to. Each bin
uses a variable length array to hold a sorted list of the items in that
bin.

To add a new item check the bins which span item_pos +/-(item_radius +
max_radius) for collisions.

For non-static systems check each item against the items in each bin
spanning item_pos +/-(item_radius + max_radius + |item_vel| + |max_vel|).

Because the items in each bin are in a sorted array you can discard some of
these quickly, too.

My code is on another computer; I'll try to remember to post it later.

Hope this helps a little.

Mike Andrews.


Post a reply to this message

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