Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author mike
- */
- public class check {
- public static boolean lisi (int n, double x, double y, double [][] spoints)
- {
- int count = 0;
- for (int i =0; i < n; i++){
- int next = i+1;
- if(i == n-1){
- next = 0;
- }
- 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]))
- count++;
- }
- if((count % 2) == 0){
- return false;
- }
- else
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement