youse_libe
asked on
Need an algorithm
I need an algorithm to find out if a point is inside a shape defined by a bunch of coordinate points. The shape might not be a standard polygon - it might be a star or similar shape that turns in on itself.
Any help appreciated.
Any help appreciated.
Count how many times a ray from the point to infinity intersects a side of polygon.
ozo is a bit short here, but he mentioned the usual approach:
1) create a vector from the given point and a point which is guaranteed to lie outside the polygon (direction doesn't matter
2) go through all edges in the polygon and check if they cross the vector created in 1)
3) if the number of intersections is equal then the given point is not in the polygon otherwise it is
Ciao, Mike
1) create a vector from the given point and a point which is guaranteed to lie outside the polygon (direction doesn't matter
2) go through all edges in the polygon and check if they cross the vector created in 1)
3) if the number of intersections is equal then the given point is not in the polygon otherwise it is
Ciao, Mike
Oops, it should read:
3) if the number of intersections is even then...
Ciao, Meike
3) if the number of intersections is even then...
Ciao, Meike
ASKER
ok, I see.
Now, could you just tell me what kind of math I need to know to do this calculation. I've only had through calculus, long ago. I don't think I've had anything that will do geometry like this.
Now, could you just tell me what kind of math I need to know to do this calculation. I've only had through calculus, long ago. I don't think I've had anything that will do geometry like this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you