Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed memoization of ordinary sums - results unused.
  • Loading branch information
Andrew Lawson authored and Andrew Lawson committed Dec 1, 2014
1 parent 24e228d commit 4cef74d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -3,4 +3,6 @@ geometric_separators


Geometric separators project for CSE 4095 (Computational Geometry). 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:


5 changes: 0 additions & 5 deletions geometric_separators.pde
Expand Up @@ -227,18 +227,13 @@ ReturnTriple calcLastSum(int i, PVector currentPoint, PVector nextPoint, ArrayLi
// Get sums and sums of squares of distances for an input // Get sums and sums of squares of distances for an input
HashMap<PVector, Float> getSums(ArrayList<PVector> input, boolean isY) { HashMap<PVector, Float> getSums(ArrayList<PVector> input, boolean isY) {
// Memoization hash tables // Memoization hash tables
HashMap<PVector, Float> sumMemoize = new HashMap<PVector, Float>();
HashMap<PVector, Float> sumSquaresMemoize = new HashMap<PVector, Float>(); HashMap<PVector, Float> sumSquaresMemoize = new HashMap<PVector, Float>();
ReturnTriple returnTriple = new ReturnTriple(0, 0, null); ReturnTriple returnTriple = new ReturnTriple(0, 0, null);
PVector currentPoint, nextPoint; PVector currentPoint, nextPoint;
float sum, dist; float sum, dist;
for (int i = 0; i < input.size() - 1; i++) { for (int i = 0; i < input.size() - 1; i++) {
currentPoint = input.get(i); currentPoint = input.get(i);
nextPoint = input.get(i + 1); 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 // Calculate sum of squares
returnTriple = calcLastSum(i, currentPoint, nextPoint, input, sumSquaresMemoize, isY); returnTriple = calcLastSum(i, currentPoint, nextPoint, input, sumSquaresMemoize, isY);
sumSquaresMemoize = returnTriple.memoize; sumSquaresMemoize = returnTriple.memoize;
Expand Down

0 comments on commit 4cef74d

Please sign in to comment.