diff --git a/main/CompGeo.pde b/main/CompGeo.pde index f843bb2..1663b85 100644 --- a/main/CompGeo.pde +++ b/main/CompGeo.pde @@ -28,7 +28,7 @@ public static class CompGeo { if ((CCW(a,b,c) != CCW(a,b,d)) && ((CCW(c,d,a) != CCW(c,d,b)))) { return 1; } - if ((CCW(a,b,c) == 0) & (CCW(a,b,d) == 0)) { + if ((CCW(a,b,c) == 0) && (CCW(a,b,d) == 0)) { if (between(a,c,b) || between(a,d,b) || between(c,a,d) || between(c,b,d)) { return 1; } @@ -158,4 +158,4 @@ public static class CompGeo { } return null; } -} \ No newline at end of file +} diff --git a/main/HalfEdge.pde b/main/HalfEdge.pde index f75cf79..073cd34 100644 --- a/main/HalfEdge.pde +++ b/main/HalfEdge.pde @@ -269,10 +269,15 @@ public class HalfEdge { } private boolean intersectsEventually(Point p, Point q) { - if (this.getOrigin().equals(p)) { return false; } - if (this.getOrigin().equals(q)) { return false; } - if (CompGeo.intersect(p, q, this.getOrigin(), this.gettwin().getOrigin()) == 1) { - return true; + 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 (shared == false) { + if (CompGeo.intersect(p, q, this.getOrigin(), this.gettwin().getOrigin()) == 1) { + return true; + } } if (counted == false) { counted = true; diff --git a/main/main.pde b/main/main.pde index 0be5e5d..6705e98 100644 --- a/main/main.pde +++ b/main/main.pde @@ -133,7 +133,9 @@ public void insertMode(float x, float y) { if(p.getY() - 10 < pointclicked.getY() && p.getY() + 10 > pointclicked.getY() && p.getX() - 10 < pointclicked.getX() && p.getX() + 10 > pointclicked.getX()) { } else { + if (!list.intersectsSomething(p, pointclicked)) { HalfEdge h = new HalfEdge(p, pointclicked); + } } } }