Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
face coloring works now
  • Loading branch information
cor11004 committed Dec 15, 2015
1 parent 7ec1037 commit feabe22
Showing 1 changed file with 52 additions and 38 deletions.
90 changes: 52 additions & 38 deletions main/main.pde
Expand Up @@ -9,6 +9,7 @@ Point removeEdgePoint;
boolean colorEdge = false;
Point colorEdgePoint;
int colorFaceColor = 1;
HalfEdge colorFaceHalfEdge;

public void setup() {
size(800, 500);
Expand Down Expand Up @@ -166,6 +167,11 @@ public void mousePressed() {
}
}
}
if(mode == 4) {
float x = mouseX;
float y = mouseY;
colorFaceHalfEdge = list.getHalfEdgeBySinglePoint(x,y,10);
}
}
void mouseReleased() {
float x = mouseX;
Expand All @@ -188,41 +194,51 @@ void mouseReleased() {


public void colorFace(float x, float y) {
HalfEdge h = list.getHalfEdgeBySinglePoint(x,y,20);
if(h != null) {
Face f = new Face(h, list);
f.printFace();
switch (colorFaceColor) {
case 0:
f.daColoring(255,255,255,list, width, height);
break;
case 1:
f.daColoring(0,0,0,list, width, height);
break;
case 2:
f.daColoring(244, 67, 54,list, width, height);
break;
case 3:
f.daColoring(76, 175, 80,list, width, height);
break;
case 4:
f.daColoring(33, 150, 243,list,width,height);
break;
case 5:
f.daColoring(156, 39, 176,list,width,height);
break;
case 6:
f.daColoring(255, 235, 59,list,width,height);
break;
case 7:
f.daColoring(103, 58, 183,list,width,height);
break;
case 8:
f.daColoring(233, 30, 99,list,width,height);
break;
case 9:
f.daColoring(63, 81, 181,list,width,height);
break;
if(colorFaceHalfEdge != null) {
HalfEdge h = CompGeo.findCWR(colorFaceHalfEdge);
h.printFace();
boolean b = CompGeo.inside(h, new Point(x,y), list.getFar());
if(b) {
h = h.gettwin();
//h = colorFaceHalfEdge;
} else {
//h = h.gettwin();
//h = colorFaceHalfEdge.gettwin();
}
if(h != null) {
Face f = new Face(h, list);
switch (colorFaceColor) {
case 0:
f.daColoring(255,255,255,list, width, height);
break;
case 1:
f.daColoring(0,0,0,list, width, height);
break;
case 2:
f.daColoring(244, 67, 54,list, width, height);
break;
case 3:
f.daColoring(76, 175, 80,list, width, height);
break;
case 4:
f.daColoring(33, 150, 243,list,width,height);
break;
case 5:
f.daColoring(156, 39, 176,list,width,height);
break;
case 6:
f.daColoring(255, 235, 59,list,width,height);
break;
case 7:
f.daColoring(103, 58, 183,list,width,height);
break;
case 8:
f.daColoring(233, 30, 99,list,width,height);
break;
case 9:
f.daColoring(63, 81, 181,list,width,height);
break;
}
}
}
noFill();
Expand Down Expand Up @@ -340,10 +356,8 @@ public void removePointMode(float x, float y) {


public void removeEdgeMode(float x, float y) {
System.out.println("entered remove edge");
HalfEdge h = list.getHalfEdgeBySinglePoint(x,y,20);
HalfEdge h = list.getHalfEdgeBySinglePoint(x,y,10);
if(h != null) {
System.out.println("h is not null");
h.Remove();
}
}
Expand Down

0 comments on commit feabe22

Please sign in to comment.