Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. //Atul Aggarwal
  2. //Outline Circle
  3.  
  4. import javafx.application.Application;
  5. import javafx.scene.Scene;
  6. import javafx.scene.layout.Pane;
  7. import javafx.scene.paint.Color;
  8. import javafx.scene.shape.Circle;
  9. import javafx.scene.shape.Line;
  10. import javafx.stage.Stage;
  11. import java.util.ArrayList;
  12.  
  13.  
  14. public class OutlineCircle extends Circle {
  15.  
  16. //Constructor for Outline Circle
  17.  
  18. public OutlineCircle() {
  19.  
  20. super.setFill(Color.TRANSPARENT);
  21. super.setStroke(Color.GREEN);
  22.  
  23. }
  24.  
  25. //Determine if a OutlineCircle overlaps another OutlineCircle
  26.  
  27. public boolean overlaps(OutlineCircle c){
  28. boolean result = false;
  29. // see if distance between the two
  30. // circles is less than the sum of each
  31. // radius
  32.  
  33. return Math.sqrt((Math.pow((getCenterX()-c.getCenterX()),2)) +
  34.  
  35. (Math.pow(getCenterY()-c.getCenterY(),2)));
  36.  
  37. return result;
  38.  
  39. }
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement