I’m creating a number of custom shapes (4 coordinates) that are placed next to each other. I’d like to detect when the user touches one of the shapes and determine which one they’ve touched.
I already know how to register the touch and I’ve done collision detection in other apps. The problem is that if you have diamond shapes placed in a ‘lattice’ (not overlapping) then you can’t simply see if the touch point is within the x and y bounds.
Essentially I’m looking to generate a list of pixels that make the shape which I can then compare my touch point to.
Can anybody help me out?
Edit:

The dot is the user’s touch. As the touch isn’t in contact with any of the edges, I can’t use object collision. If you treat the diamonds as rectangles, then in this example, the program thinks you have touched both.
To find out if a point is inside a polygon, you can use the any of the methods outlines here, or the “PNPOLY” algorithm.
Of course – if you want to keep things simple you can use Farseer and its collision system to perform the computation for you (Box2D and Farseer have the same features, so I provided a Box2D link for the collision bit). You can also get the collision points given multiple PolygonShapes directly.