SHARE
TWEET

Untitled

a guest Feb 15th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  *
  3.  * @author mike
  4.  */
  5. public class check {
  6.  
  7.     public static boolean lisi (int n, double x, double y, double [][] spoints)
  8.     {
  9.         int count = 0;
  10.         for (int i =0; i < n; i++){
  11.             int next = i+1;
  12.             if(i == n-1){
  13.                 next = 0;
  14.             }
  15.             if(((spoints[i][1] > y) != (spoints[next][1] > y)) && (x < (spoints[next][0] - spoints[i][0])*(y-spoints[i][1])/(spoints[next][1]-spoints[i][1])+spoints[i][0]))
  16.                 count++;
  17.         }
  18.         if((count % 2) == 0){
  19.             return false;
  20.         }
  21.         else
  22.             return true;
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top