Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing square root miscalculation.
  • Loading branch information
Andrew Lawson committed Dec 2, 2014
1 parent 9b72511 commit 7d872de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions geometric_separators.pde
Expand Up @@ -145,14 +145,17 @@ CenterAndSphere getSeparator(ArrayList<PVector> input) {
// 4. Output sphere separator
float[] sphereAttributes = getSphereAttr(centerPoint, unitVector, radius);
PShape separator = createShape(ELLIPSE, sphereAttributes);
System.out.println(separator);
CenterAndSphere returnVals = new CenterAndSphere(centerPoint, separator);
return returnVals;
}

// Get radius for our separator
float getRadius(PVector centerPoint, PVector unitVector) {
float num = (float)Math.sqrt(centerPoint.z - centerPoint.mag());
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));
return num / Math.abs(unitVector.z);
}

Expand Down

0 comments on commit 7d872de

Please sign in to comment.