Skip to content
Permalink
Browse files

Fixing square root miscalculation.

  • Loading branch information
Andrew Lawson
Andrew Lawson committed Dec 2, 2014
1 parent 9b72511 commit 7d872de3f6b39a076fa5d83c8cc0aa918625b13a
Showing with 5 additions and 2 deletions.
  1. +5 −2 geometric_separators.pde
@@ -145,14 +145,17 @@ CenterAndSphere getSeparator(ArrayList<PVector> input) {
// 4. Output sphere separator // 4. Output sphere separator
float[] sphereAttributes = getSphereAttr(centerPoint, unitVector, radius); float[] sphereAttributes = getSphereAttr(centerPoint, unitVector, radius);
PShape separator = createShape(ELLIPSE, sphereAttributes); PShape separator = createShape(ELLIPSE, sphereAttributes);
System.out.println(separator);
CenterAndSphere returnVals = new CenterAndSphere(centerPoint, separator); CenterAndSphere returnVals = new CenterAndSphere(centerPoint, separator);
return returnVals; return returnVals;
} }


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


0 comments on commit 7d872de

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