diff --git a/main/Face.pde b/main/Face.pde index ff536a4..5c9757b 100644 --- a/main/Face.pde +++ b/main/Face.pde @@ -18,7 +18,6 @@ public class Face { float minY = 0; float maxY = y; if (outerComponent != null) { - Point p; minX = outerComponent.getOrigin().getX(); maxX = outerComponent.getOrigin().getX(); minY = outerComponent.getOrigin().getY(); @@ -33,8 +32,8 @@ public class Face { temp = temp.getnext(); } } - for (int i = minX; i < (int)maxX; i++) { - for (int j = minY; j < (int)maxY; j++) { + for (int i = (int) minX; i < (int)maxX; i++) { + for (int j = (int) minY; j < (int)maxY; j++) { p = new Point(i, j); if (inSpecificFace(p, pl)) { point(i,j); diff --git a/main/main.pde b/main/main.pde index 8074659..51db027 100644 --- a/main/main.pde +++ b/main/main.pde @@ -93,8 +93,13 @@ public void setup() { //(new Face(h12, list)).printFace(); } void draw() { - //background(255); + if(mode != 4) { + background(255); + } drawgraph.drawGraph(list.getPoints()); + if(pointclickedbool) { + line(pointclicked.getX(), pointclicked.getY(), mouseX,mouseY); + } } void keyPressed() { switch (key) { @@ -148,6 +153,20 @@ void keyPressed() { } } +public void mousePressed() { + if(mode == 0) { + float x = mouseX; + float y = mouseY; + for(Point p: list.getPoints()) { + if((p.getX() - 10 < x) && (p.getX() + 10 > x)) { + if((p.getY() - 10 < y) && (p.getY() + 10 > y)) { + pointclicked = p; + pointclickedbool = true; + } + } + } + } +} void mouseReleased() { float x = mouseX; float y = mouseY; @@ -225,6 +244,7 @@ public void colorFace(float x, float y) { } noFill(); } + public void insertMode(float x, float y) { if(pointclickedbool) { pointclickedbool = false; @@ -242,7 +262,7 @@ public void insertMode(float x, float y) { } } } - } else { + } /*else { for(Point p: list.getPoints()) { if((p.getX() - 10 < x) && (p.getX() + 10 > x)) { if((p.getY() - 10 < y) && (p.getY() + 10 > y)) { @@ -251,7 +271,7 @@ public void insertMode(float x, float y) { } } } - } + }*/ if(!pointclickedbool && !linedrawn) { Point p = new Point(x,y); list.addPoint(p); @@ -272,7 +292,7 @@ public void removePointMode(float x, float y) { } if(removePoint) { list.removePoint(removeThis); - background(255); + //background(255); } } @@ -284,7 +304,7 @@ public void removeEdgeMode(float x, float y) { HalfEdge h = list.getHalfEdge(removeEdgePoint, p); if(h != null) { h.Remove(); - background(255); + //background(255); } removeEdge = false; }