From 4dd14dc2dbc0a829eb77b2ccbfe469dae08c1f0b Mon Sep 17 00:00:00 2001 From: Andrew Lawson Date: Mon, 1 Dec 2014 20:33:59 -0500 Subject: [PATCH] Need to add case for 4 input points. --- geometric_separators.pde | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/geometric_separators.pde b/geometric_separators.pde index e5404b5..bb9e558 100644 --- a/geometric_separators.pde +++ b/geometric_separators.pde @@ -128,6 +128,7 @@ void mousePressed() { // Lift to 3D with the squared magnitude of the original point PVector final_point = new PVector(prelim_point.x, prelim_point.y, (float)Math.pow(prelim_point.mag(), 2)); + System.out.println(final_point); rawInput.add(final_point); } redraw(); @@ -151,11 +152,9 @@ CenterAndSphere getSeparator(ArrayList input) { // Get radius for our separator float getRadius(PVector centerPoint, PVector unitVector) { - System.out.println(centerPoint.mag()); - System.out.println(centerPoint.z); - System.out.println(centerPoint.z - centerPoint.mag()); PVector centerPoint2D = new PVector(centerPoint.x, centerPoint.y); - float num = (float)Math.sqrt(centerPoint.z - Math.pow(centerPoint2D.mag(), 2)); + float num = (float)Math.sqrt(Math.abs(centerPoint.z - Math.pow(centerPoint2D.mag(), 2))); + System.out.println(num); return num / Math.abs(unitVector.z); } @@ -181,6 +180,12 @@ PVector getGeometricMedian(ArrayList input) { else if (input.size() == 1) { return input.get(0); } + else if (input.size() == 2) { + // Nothing yet + } + else if (input.size() == 4) { + // Nothing yet + } else { // Get the point HashMap total = new HashMap();