diff --git a/C&H pfp.png b/C&H pfp.png new file mode 100644 index 0000000..15a2811 Binary files /dev/null and b/C&H pfp.png differ diff --git a/Semester 2/Assignments/MP2_CalebFontenot/src/main/java/com/calebfontenot/mp2_calebfontenot/Circle2D.java b/Semester 2/Assignments/MP2_CalebFontenot/src/main/java/com/calebfontenot/mp2_calebfontenot/Circle2D.java index 00c159f..00484f7 100644 --- a/Semester 2/Assignments/MP2_CalebFontenot/src/main/java/com/calebfontenot/mp2_calebfontenot/Circle2D.java +++ b/Semester 2/Assignments/MP2_CalebFontenot/src/main/java/com/calebfontenot/mp2_calebfontenot/Circle2D.java @@ -109,16 +109,13 @@ public class Circle2D { * @param y * @return true if the specified point (x, y) is inside the circle, otherwise false. */ - public boolean contains(double x, double y) + public boolean contains(Circle2D other) { - double d = distance(x, y, this.x, this.y); - return d <= radius; - } + double dx = this.x - other.x; + double dy = this.y - other.y; + double distance = Math.sqrt(dx * dx + dy * dy); - public boolean contains(Circle2D c) - { - double d = distance(c.x, c.y, this.x, this.y); - return d <= radius; + return distance + other.radius <= this.radius; } /** @@ -127,21 +124,13 @@ public class Circle2D { * @param circle to compare for overlapping. * @return true */ - public boolean overlaps(Circle2D c) + public boolean overlaps(Circle2D other) { - // Compare this to the paremeter - double overlap = Math.sqrt((Math.pow((this.x - c.x), 2) + Math.pow((this.y + c.y), 2))); - - if (overlap <= (this.radius - c.radius)) { - return true; - } else if (overlap <= (c.radius - this.radius)) { - return true; - } else if (overlap < (this.radius + c.radius)) { - return true; - } else { - return false; - } + double dx = this.x - other.x; + double dy = this.y - other.y; + double distance = Math.sqrt(dx * dx + dy * dy); + return distance <= this.radius + other.radius; } /** @@ -183,6 +172,7 @@ public class Circle2D { public static void main(String[] args) { Circle2D c1 = new Circle2D(2, 2, 5.5); + System.out.println(c1); System.out.println("Area is " + c1.getArea()); System.out.println("Perimeter is " + c1.getPerimeter()); //System.out.println(c1.contains(3, 3)); @@ -190,7 +180,18 @@ public class Circle2D { //System.out.println(c1.overlaps(new Circle2D(3, 5, 2.3))); //System.out.println(c1.overlaps(new Circle2D(-8.7, 5, 2.3))); //System.out.println(c1.overlaps(new Circle2D(-8.7, 5, 2.3))); - System.out.println(c1.contains(new Circle2D(-1.9, 1.8, 2.3))); - System.out.println(c1.overlaps(new Circle2D(-1.9, 1.8, 2.3))); + Circle2D c2 = new Circle2D(-1.9, 1.8, 1.8); + Circle2D c3 = new Circle2D(-1.9, 1.8, 0.8); + Circle2D c4 = new Circle2D(-6.2, 1.8, 1.8); + System.out.println(c2); + System.out.println("c1.contains: " + c1.contains(c2)); + System.out.println("c1.overlaps: " + c1.overlaps(c2)); + System.out.println(c3); + System.out.println("c1.contains: " + c1.contains(c3)); + System.out.println("c1.overlaps: " + c1.overlaps(c3)); + System.out.println(c4); + System.out.println("c1.contains: " + c1.contains(c4)); + System.out.println("c1.overlaps: " + c1.overlaps(c4)); + } } diff --git a/gource_ASDV-Java.mp4 b/gource_ASDV-Java.mp4 new file mode 100644 index 0000000..8c05613 Binary files /dev/null and b/gource_ASDV-Java.mp4 differ diff --git a/gource_ASDV-Java2.mp4 b/gource_ASDV-Java2.mp4 new file mode 100644 index 0000000..fc3b465 Binary files /dev/null and b/gource_ASDV-Java2.mp4 differ