Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool PtInPoly(PointF[] Points, float X, float Y)
- {
- bool Result = false;
- int Count = Points.Length;
- int j = Count - 1;
- for (int K = 0; K < Count; K++)
- {
- if (((Points[K].Y <= Y) &&
- (Y < Points[j].Y)) | (
- (Points[j].Y <= Y) &&
- (Y < Points[K].Y)))
- {
- if (X < (Points[j].X - Points[K].X) * (Y - Points[K].Y) / (Points[j].Y - Points[K].Y) + Points[K].X)
- Result = !(Result);
- }
- j = K;
- }
- return Result;
- }
Add Comment
Please, Sign In to add comment