Skip to content

Commit

Permalink
Add effects
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyBoivie authored and JimmyBoivie committed Dec 5, 2015
1 parent 49c7380 commit 5b9634a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
49 changes: 39 additions & 10 deletions main/HalfEdge.pde
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,34 @@ public class HalfEdge {
// SETS THE COUNTED
setCounted(false);
twin.setCounted(false);

// MAGIC METHOD
int state = -1;
if ((p.count() == 0) && (q.count() == 0)) {
// this new structure was created not connected to anything
// watchout inside a face!!!!!
state = 0;
}
else if ((p.count() == 0) || (q.count() == 0)) {
// this means that this edge was addeded such that only one point is already a connected graph
// easy fix
state = 1;
}
else {
// this means both things are connected graph if here that means
// risk of new face or connected two unconnected components;
state = -1;
}
int expected = p.count() + q.count() + 2;
connect();
twin.connect();
if (state == -1) {
if (p.count() == expected) {
// two disconnected graphs are now one!
state = 2;
} else {
state = 3;
// a face is divided in 2.
}
}



Expand All @@ -37,25 +61,26 @@ public class HalfEdge {

public int connect() {
ArrayList<HalfEdge> others = origin.getEntering();
int result = -1;
if (others == null) {
this.setprevious(gettwin());
gettwin().setnext(this);
// update vertex
makeVertexReference();
return 0;
result = 0;
}
if (others.size() == 1) {
else if (others.size() == 1) {
HalfEdge other = others.get(0);
this.setprevious(other);
other.setnext(this);
gettwin().setnext(other.gettwin());
other.gettwin().setprevious(gettwin());


// no update vertex
return 1;
result = 1;
}
return complex(this, others);
else if (others.size() > 1) {
result = complex(this, others);
}
return result;
}


Expand Down Expand Up @@ -88,7 +113,11 @@ public class HalfEdge {




public int countReset() {
int c = count();
reset();
return c;
}

public int count() {
if (counted == false) {
Expand Down
5 changes: 5 additions & 0 deletions main/Point.pde
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ public class Point {
return "(x,y) = " + x + "," + y;
}

public int count() {
if (ref == null) { return 0; }
return ref.countReset();
}

}

0 comments on commit 5b9634a

Please sign in to comment.