views:

105

answers:

1

Im sure if the title is exactly what I am trying to describe so sorry if it isnt.

Ok here is what i am trying to do:

alt text

What i want to do is create a function that you can enter unlimited ammount of coordinates ( the blue dots) and then it will create a shape like so and then return all coordinates the shape covers. Because this is for working with pixels, there will be no decimal coordinates.

Something that can be used like so:

print_r(get_coords(12,6, 23,13, 30,9, 37,24, 24,34, 25,24, 7,30, 6,15));

// ^ Will output an array of all x and y coordinates that the shape covers

How would i go about doing something like this?

+1  A: 

http://php.net/imagefilledpolygon

Col. Shrapnel
Daaargghh! Beat me to it. :-)
amphetamachine