-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JimmyBoivie
authored and
JimmyBoivie
committed
Dec 5, 2015
1 parent
33c8b61
commit b2277de
Showing
6 changed files
with
46 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
public static class CompGeo { | ||
|
||
public int CCW(Vertex a, Vertex b, Vertex c) { | ||
public int CCW(Point a, Point b, Point c) { | ||
// Return 1 if turn abc is ccw -1 if turn abc is cw 0 if no turn | ||
float f = (b.getX() - a.getX())*(c.getY() - a.getY()) - (c.getX() - a.getX())*(b.getY()-a.getY()); | ||
if (f < 0) { return -1; } | ||
if (f > 0) { return 1; } | ||
return 0; | ||
} | ||
|
||
public int immediateCCW(Vertex parent, Vertex child, Vertex v1, Vertex v2) { | ||
public int immediateCCW(Point parent, Point child, Point v1, Point v2) { | ||
// returns 1 if v1 is more immediate CCW of parent, child than v2 | ||
// returns -1 if v2 is more immediate CCW of parent, child than v1 | ||
if (CCW(parent, child, v1) > CCW(parent, child, v2)) { return 1; } | ||
if (CCW(parent, child, v1) < CCW(parent, child, v2)) { return -1; } | ||
return CCW(parent, v1, v2); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
public class PointList { | ||
|
||
private ArrayList<Point> points; | ||
|
||
public PointList() { | ||
points = new ArrayList<Point>(); | ||
} | ||
|
||
public boolean contains(Point p) { | ||
return points.contains(p); | ||
} | ||
|
||
public void addPoint(Point p) { | ||
points.add(p); | ||
} | ||
|
||
public boolean removePoint(Point p) { | ||
return points.remove(p); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters