diff --git a/geometric_separators.pde b/geometric_separators.pde index 2d6507a..4424df9 100644 --- a/geometric_separators.pde +++ b/geometric_separators.pde @@ -12,7 +12,7 @@ int calc_h = 25; PShape reset; PShape calculate; // Input list -ArrayList input = new ArrayList(); +ArrayList input = new ArrayList(); // Setup void setup() { @@ -38,16 +38,16 @@ void mousePressed() { // Get sorted input points } else { - PShape new_ellipse = createShape(ELLIPSE, mouseX - 12.5, mouseY - 12.5, 25, 25); - input.add(new_ellipse); + PVector new_point = new PVector(mouseX, mouseY); + input.add(new_point); } redraw(); } // Estimate centerpoint -void approxCenter(ArrayList input) { +void approxCenter(ArrayList input) { if (input.size() == 1) { - return ArrayList.get(0); + //return ArrayList.get(0); } else { // Sample points @@ -57,16 +57,16 @@ void approxCenter(ArrayList input) { // Estimate the geometric median - dynamic programming void geomMedian() { - // Memoization hash tables - HashMap left = new HashMap(): - HashMap right = new HashMap(): - HashMap up = new HashMap(): - HashMap down = new HashMap(): - // Sum of squares values - ArrayList leftSq = new ArrayList(); - ArrayList rightSq = new ArrayList(); - ArrayList upSq = new ArrayList(); - ArrayList downSq = new ArrayList(); +// // Memoization hash tables +// HashMap left = new HashMap(); +// HashMap right = new HashMap(); +// HashMap up = new HashMap(); +// HashMap down = new HashMap(); +// // Sum of squares values +// ArrayList leftSq = new ArrayList(); +// ArrayList rightSq = new ArrayList(); +// ArrayList upSq = new ArrayList(); +// ArrayList downSq = new ArrayList(); } // Draw @@ -76,8 +76,8 @@ void draw() { shape(calculate); text("Reset.", reset_x + 25, reset_y - 10); text("Calculate.", calc_x + 25, calc_y - 10); - for (PShape ellipse : input) { - shape(ellipse); - fill(255); + for (PVector point : input) { + point(point.x, point.y); + strokeWeight(4); } }