Heya, I just uploaded Collision::Util 0.01 to CPAN. Like Kartik mentioned, it is still available only in pure-perl form, but it should do the trick for a while. Please report any bugs and/or feature requests you may have.
It currently expects any object with ->x, ->y, ->w, ->h value accessors (it only checks values and will never change anything), treating them as simple rectangles (y and x being top-left values). Functions are NOT exported by default. They are: check_contains() to see if the first rect contains the other rects check_collision() to see if the first rect is colliding with the other rects here, "other rects" can be either a single rect, an array reference of rects or a hash reference. The Pod documentation includes some examples and a much better description :-) Hope you find this useful! Cheers, breno On Tue, Jan 26, 2010 at 10:23 AM, Kartik Thakore <thakore.kar...@gmail.com> wrote: > Hi Dan, > > Breno is working on a Collision::Util > (http://github.com/garu/Collision-Util/) module to do Collision detection. > It is still early. I will help Breno move some of the core of this module to > XS for speed later. > > I am actually also interested in bringing a physics engine to Perl via some > good C libraries ( http://ode.org/) . I haven't done anything yet but if > there is interest I will be willing to start porting one. > > Cheers, > Kartik Thakore > > On Tue, Jan 26, 2010 at 12:32 AM, Dan Kortschak > <dan.kortsc...@adelaide.edu.au> wrote: >> >> Hi Kartik, >> >> I'm wanting to do some GA work with some spatial objects in Perl - >> basically some evolutionary biology research looking at group selection >> dynamics, so I need to figure out a really simple physics engine - >> basically just collision detection (no problem) and position adjustment. >> All the objects are circular for convenience. I've never done any >> physics simulations, so this is all new to me. I've done some thinking >> about it and 2 bodies is easy - any more is quite difficult and >> potentially time consuming which is a no-no for the GA. >> >> Since you've been doing lots of work on SDL, I thought you would be a >> good person to ask for advice on whether there are either good places to >> read up on this or already written modules that are reasonably light >> weight - I couldn't find anything that looked right on CPAN. I don't >> need any graphics, just positions. >> >> thanks for your time >> Dan >> -- >> Dan Kortschak <dan.kortsc...@adelaide.edu.au> >> > >