Guest User

Untitled

a guest
Jun 18th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 0.59 KB | None | 0 0
  1. public bool PtInPoly(PointF[] Points, float X, float Y)
  2.     {
  3.         bool Result = false;
  4.         int Count = Points.Length;
  5.         int j = Count - 1;
  6.         for (int K = 0; K < Count; K++)
  7.         {
  8.             if (((Points[K].Y <= Y) &&
  9.             (Y < Points[j].Y)) | (
  10.             (Points[j].Y <= Y) &&
  11.             (Y < Points[K].Y)))
  12.             {
  13.                 if (X < (Points[j].X - Points[K].X) * (Y - Points[K].Y) / (Points[j].Y - Points[K].Y) + Points[K].X)
  14.                     Result = !(Result);
  15.             }
  16.             j = K;
  17.         }
  18.         return Result;
  19.     }
Add Comment
Please, Sign In to add comment