Find relationships amongst points

Discussion in 'PHP' started by Tipem, Nov 1, 2007.

  1. #1
    Hi guys,

    Here's my little project. I'm trying to find relationships (or "constellations") amongst points (x, y coordinates). I do have all of the "deltas" of the constellations here with me... here's what a delta would look like:

    $mydelta = array(
    	'name' => 'Constellation name here',
    	'deltas' => array(
    				'10,-50',
    				'90,-80',
    				'0,140',
    				'90,-60',
    				'10,50'
    	)
    )
    PHP:
    Then I would have an array of about 1000 points (see below of what it might look like) and I what I need to do is find this "constellation" based upon the delta. Any math geniuses here who would know how to do this? Thanks...

    Array of points:

    Array
    (
        [0] => Array
            (
                [x] => 339
                [y] => 884
            )
    
        [1] => Array
            (
                [x] => 339
                [y] => -761
            )
    
        [2] => Array
            (
                [x] => 34
                [y] => 757
            )
    )
    Code (markup):
    Btw, somebody has made a script like this, but in Perl. I want to do this in PHP... here is the link to the Perl script: http://hacks.atrus.org/neopets/findConstellations.txt
     
    Tipem, Nov 1, 2007 IP