Skip to content

Commit

Permalink
Remove added (not tested)
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyBoivie authored and JimmyBoivie committed Dec 5, 2015
1 parent 5b9634a commit a2ef991
Showing 1 changed file with 48 additions and 8 deletions.
56 changes: 48 additions & 8 deletions main/HalfEdge.pde
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,48 @@ public class HalfEdge {

// MAKE SURE ALL HALF EDGES ARE INITIALIZED TO FALSE

public HalfEdge(){}
public void Remove() {
Point p = getOrigin();
Point q = twin.getOrigin();
int state = -1;
if ((p.count() == 1) && (q.count() == 1)) {
// STRUCTURE IS DISSAPREAING WHAT SHOULD I DO
p.setRef(null);
q.setRef(null);
state = 0;
} else if (p.count() == 1) {
p.setRef(null);
q.setRef(twin.getAnotherLeaving());
this.getnext().setprevious(twin.getprevious());
twin.getprevious().setnext(this.getnext());
// NOTHING SPECIAL MUST BE DONE
state = 1;
} else if (q.count() == 1) {
p.setRef(this.getAnotherLeaving());
q.setRef(null);
this.getprevious().setnext(twin.getnext());
twin.getnext().setprevious(this.getprevious());
// NOTHING SPECIAL MUST BE DONE
state = 1;
} else {
int expected = p.count() - 2;
p.setRef(this.getAnotherLeaving());
q.setRef(twin.getAnotherLeaving());
this.getnext().setprevious(twin.getprevious());
twin.getprevious().setnext(this.getnext());
this.getprevious().setnext(twin.getnext());
twin.getnext().setprevious(this.getprevious());
if (p.count() == expected) {
// was not broken faces merge!
state = 2;
} else {
// structure broken
state = 3;
}
}
}

public HalfEdge(){}
public HalfEdge(Point p, Point q) {
// SETS THE TWIN
settwin(new HalfEdge());
Expand All @@ -35,6 +75,7 @@ public class HalfEdge {
// this means both things are connected graph if here that means
// risk of new face or connected two unconnected components;
state = -1;
// we don't know state yet :(
}
int expected = p.count() + q.count() + 2;
connect();
Expand All @@ -44,15 +85,10 @@ public class HalfEdge {
// two disconnected graphs are now one!
state = 2;
} else {
state = 3;
// a face is divided in 2.
state = 3;
}
}





}
}
public void makeVertexReference() {
origin.setRef(this);
Expand Down Expand Up @@ -169,6 +205,10 @@ public class HalfEdge {
}
return result;
}
public HalfEdge getAnotherLeaving() {
return getprevious().gettwin();
}

public ArrayList<HalfEdge> getAllLeaving() {
ArrayList<HalfEdge> others = getOtherLeaving();
others.add(this);
Expand Down

0 comments on commit a2ef991

Please sign in to comment.