Advertisement
Guest User

Untitled

a guest
Aug 13th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nagios 0.57 KB | None | 0 0
  1.     for (int i = 0; i < poly.Length; i++)
  2.     {
  3.         Point newPoint = new Point(poly[i].X, poly[i].Y);
  4.  
  5.         if (newPoint.X > oldPoint.X)
  6.         {
  7.             p1 = oldPoint;
  8.             p2 = newPoint;
  9.         }
  10.         else
  11.         {
  12.             p1 = newPoint;
  13.             p2 = oldPoint;
  14.         }
  15.  
  16.         if ((newPoint.X < p.X) == (p.X <= oldPoint.X)
  17.             && ((long)p.Y - (long)p1.Y) * (long)(p2.X - p1.X) < ((long)p2.Y - (long)p1.Y) * (long)(p.X - p1.X))
  18.         {
  19.             inside = !inside;
  20.         }
  21.  
  22.         oldPoint = newPoint;
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement