# 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.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Count how many times a ray from the point to infinity intersects a side of polygon.
0
Commented:
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
0
Commented:
Oops, it should read:

3) if the number of intersections is even then...

Ciao, Meike
0
Author Commented:
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.
0
Commented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
thank you
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.