I've been thinking about this for interface stuff, avoiding making everything rectangular really.
Here's my proposed method ( technique, not even pseudo-code at this point ) and I'd be interested to hear if anyone has a better ( faster! ) method.
For each edge in the polygon, calculate a normal pointing directly outward from the center of the poly. When it comes to testing the point, calculate the dot product of the point relative to one of the edge's vertices and if it's positive, return false. If none of the edges return false, it's inside.
Perhaps coupled with some kind of basic distance check to eliminate precise testing.
How's that?
Here's my proposed method ( technique, not even pseudo-code at this point ) and I'd be interested to hear if anyone has a better ( faster! ) method.
For each edge in the polygon, calculate a normal pointing directly outward from the center of the poly. When it comes to testing the point, calculate the dot product of the point relative to one of the edge's vertices and if it's positive, return false. If none of the edges return false, it's inside.
Perhaps coupled with some kind of basic distance check to eliminate precise testing.
How's that?