Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Finished framework for main separator algorithm.
  • Loading branch information
Andrew Lawson authored and Andrew Lawson committed Dec 1, 2014
1 parent b1f2827 commit 517ab55
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions geometric_separators.pde
Expand Up @@ -118,6 +118,24 @@ void mousePressed() {
redraw(); redraw();
} }


// Get geometric separator
PShape getSeparator() {
// 1. Get centerpoint
PVector centerPoint = approxCenterpoint(rawInput);
// 2. Get random unit vector in 3D
PVector unitVector = PVector.Random3D();
// 3. Get radius
float radius = getRadius(centerPoint, unitVector);
// 4. Output sphere separator

}

// Get radius
float getRadius(PVector centerPoint, PVector unitVector) {
float num = (float)Math.sqrt(centerPoint.z - centerPoint.mag());
return num / Math.abs(unitVector.z);
}

// Get geometric median // Get geometric median
PVector getGeometricMedian(ArrayList<PVector> input) { PVector getGeometricMedian(ArrayList<PVector> input) {
if (input.size() == 0) { if (input.size() == 0) {
Expand Down

0 comments on commit 517ab55

Please sign in to comment.