diff --git a/main/CompGeo.pde b/main/CompGeo.pde index 1663b85..7c3058a 100644 --- a/main/CompGeo.pde +++ b/main/CompGeo.pde @@ -3,6 +3,7 @@ public static class CompGeo { public static 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; diff --git a/main/HalfEdge.pde b/main/HalfEdge.pde index 113791a..97eebed 100644 --- a/main/HalfEdge.pde +++ b/main/HalfEdge.pde @@ -274,10 +274,10 @@ public class HalfEdge { private boolean intersectsEventually(Point p, Point q) { boolean shared = false; - if (this.getOrigin().equals(p)) { shared = true; } - if (this.getOrigin().equals(q)) { shared = true; } - if (this.gettwin().getOrigin().equals(p)) { shared = true; } - if (this.gettwin().getOrigin().equals(q)) { shared = true; } + if (this.getOrigin() == p) { shared = true; } + if (this.getOrigin() == q) { shared = true; } + if (this.gettwin().getOrigin() == p) { shared = true; } + if (this.gettwin().getOrigin() == q) { shared = true; } if (shared == false) { if (CompGeo.intersect(p, q, this.getOrigin(), this.gettwin().getOrigin()) == 1) { return true; diff --git a/main/Point.pde b/main/Point.pde index 57ca54c..ba5aa9e 100644 --- a/main/Point.pde +++ b/main/Point.pde @@ -30,10 +30,6 @@ public class Point { ref = h; } - public boolean equals(float a, float b) { - return ((a == x) && (b == y)); - } - public ArrayList getLeaving() { if (ref == null) { return null; } return ref.getAllLeaving(); diff --git a/main/main.pde b/main/main.pde index 68a300c..7beb2cb 100644 --- a/main/main.pde +++ b/main/main.pde @@ -13,7 +13,7 @@ public void setup() { background(255); fill(0,0); translate(width/2, height/2); - Point p1 = new Point(300, 300); + /*Point p1 = new Point(300, 300); list.addPoint(p1); Point p2 = new Point(400, 350); list.addPoint(p2); @@ -63,7 +63,7 @@ public void setup() { HalfEdge h14 = new HalfEdge(p8, p15); HalfEdge h15 = new HalfEdge(p9, p15); HalfEdge h16 = new HalfEdge(p16, p17); - + */ //h1.printFace(); //float f = CompGeo.signedArea(h1.gettwin()); //float f2 = CompGeo.signedArea(h1);