Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. /** check if the LIC4 holds
  2. * @return true if the LIC holds, false otherwise
  3. */
  4. public boolean checkLIC4 (ABMInput input) {
  5. int qpts = input.PARAMETERS.getQPoints();
  6. int quads = input.PARAMETERS.getQuads();
  7.  
  8. if (qpts < quads || input.NUMPOINTS < quads) return false;
  9.  
  10. boolean[] qs = new boolean[4];
  11. Point p;
  12. int q;
  13. int numQuads = 0;
  14.  
  15. for (int i = 0; i <= input.NUMPOINTS - qpts; i++) {
  16. for (int j = 0; j < qpts; j++) {
  17. p = input.POINTS[j];
  18.  
  19. // mark quadrant as containing point
  20. q = p.quadrant();
  21. if (qs[q-1] == false) {
  22. qs[q-1] = true;
  23. numQuads++;
  24. }
  25. }
  26.  
  27. // check if enough quardants contains points
  28. if (numQuads > quads) return true;
  29.  
  30. // reset for trying next set of points
  31. for (int b = 0; b < 4; b++) qs[b] = false;
  32. numQuads = 0;
  33. }
  34. return false;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement