[comp.lang.c] Need help with an algorithm

gjschmidt@crocus.uwaterloo.ca (Crazy 2B CS student) (01/03/91)

Here's one for all you math wizards out there.

I need an algorithm that will take a predetermined series of (x,y)
coordinates defining an area (call it A), and another (x,y) coordinate
(call it P), and figure out whether or not P is contained within, or lies
on one of the edges of, A.

The edges of A may not all be vertical/horizantal, so I imagine that
slopes will be involved.

Any help with this would be much appreciated (C source code would be the
best, but the algorithm, or even a book to look it up in, would help).
I can come up with any needed functions based on the data, such as
min/max x/y, slope between two points, etc. if need be.  Also, I have an
algorithm for determining whether a point is inside a triangle, so that
may help.

Thanks in advance...

Greg Schmidt

P.S.  Please reply via email to one of the following accounts (I won't
have this account for much longer --> no rn access either):
uunet!attcan!heron!gregs  or  uunet!attcan!heron!bruce
(Sorry, no xxx@yyy addressing to where I am)