Skip to content

Commit

Permalink
reachable
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyBoivie authored and JimmyBoivie committed Dec 6, 2015
1 parent 2f0ce17 commit 98ddaee
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
3 changes: 3 additions & 0 deletions main/CompGeo.pde
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ public static class CompGeo {
}
return sum;
}



}
15 changes: 15 additions & 0 deletions main/HalfEdge.pde
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,21 @@ public class HalfEdge {
System.out.println();
}

private boolean isReachable(HalfEdge h) {
if (this == h) { return true; }
if (counted == false) {
counted = true;
return (twin.isReachable(h) || next.isReachable(h) || previous.isReachable(h));
}
return false;
}

public boolean canReach(HalfEdge h) {
boolean out = isReachable(h);
reset();
return out;
}


// may not want getters, but for now they are here.
public void setprevious(HalfEdge p) {
Expand Down
2 changes: 2 additions & 0 deletions main/Point.pde
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ public class Point {
return ref.countReset();
}



}
17 changes: 17 additions & 0 deletions main/PointList.pde
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,21 @@ public class PointList {
public boolean removePoint(Point p) {
return points.remove(p);
}

public ArrayList<HalfEdge> getAllStructures() {
int num = points.size();
ArrayList<HalfEdge> struct = new ArrayList<HalfEdge>();
for (int i = 0; i < num; i++) {
if (points.get(i).getRef().getCounted() == false) {
points.get(i).getRef().count();
struct.add(points.get(i).getRef());
}
}
num = struct.size();
for (int i = 0; i < num; i++) {
struct.get(i).reset();
}
return struct;
}

}
2 changes: 1 addition & 1 deletion main/main.pde
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void setup() {
HalfEdge h2 = new HalfEdge(p1, p4);
HalfEdge h3 = new HalfEdge(p3, p1);
HalfEdge h4 = new HalfEdge(p1, p5);
HalfEdge h5 = new HalfEdge(p3, p4);
//HalfEdge h5 = new HalfEdge(p3, p4);
float f = CompGeo.signedArea(h2.gettwin());
float f2 = CompGeo.signedArea(h2);
System.out.println("Signed Area: " + f);
Expand Down

0 comments on commit 98ddaee

Please sign in to comment.