Skip to content
Permalink
Browse files

Removed memoization of ordinary sums - results unused.

  • Loading branch information
Andrew Lawson Andrew Lawson
Andrew Lawson authored and Andrew Lawson committed Dec 1, 2014
1 parent 24e228d commit 4cef74d116731c9d6b88cfe82e3c5e29e1540090
Showing with 3 additions and 6 deletions.
  1. +3 −1 README.md
  2. +0 −5 geometric_separators.pde
@@ -3,4 +3,6 @@ geometric_separators

Geometric separators project for CSE 4095 (Computational Geometry).

Click anywhere to create a circle. The left button will reset the workspace / input. The right button does nothing... for now :)
###About:


@@ -227,18 +227,13 @@ ReturnTriple calcLastSum(int i, PVector currentPoint, PVector nextPoint, ArrayLi
// Get sums and sums of squares of distances for an input
HashMap<PVector, Float> getSums(ArrayList<PVector> input, boolean isY) {
// Memoization hash tables
HashMap<PVector, Float> sumMemoize = new HashMap<PVector, Float>();
HashMap<PVector, Float> sumSquaresMemoize = new HashMap<PVector, Float>();
ReturnTriple returnTriple = new ReturnTriple(0, 0, null);
PVector currentPoint, nextPoint;
float sum, dist;
for (int i = 0; i < input.size() - 1; i++) {
currentPoint = input.get(i);
nextPoint = input.get(i + 1);
// Calculate sum
returnTriple = calcLastSum(i, currentPoint, nextPoint, input, sumMemoize, isY);
sumMemoize = returnTriple.memoize;
sumMemoize.put(nextPoint, returnTriple.sum + (i * returnTriple.dist));
// Calculate sum of squares
returnTriple = calcLastSum(i, currentPoint, nextPoint, input, sumSquaresMemoize, isY);
sumSquaresMemoize = returnTriple.memoize;

0 comments on commit 4cef74d

Please sign in to comment.
You can’t perform that action at this time.