Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
can now drawn lines
  • Loading branch information
cor11004 committed Dec 6, 2015
1 parent 1dc478a commit c1798e1
Showing 1 changed file with 22 additions and 31 deletions.
53 changes: 22 additions & 31 deletions main/main.pde
@@ -1,4 +1,5 @@
boolean pointclickedbool = false;
boolean linedrawn = false;
Point pointclicked;
PointList list = new PointList();
DrawHalfEdge drawgraph = new DrawHalfEdge();
Expand Down Expand Up @@ -90,41 +91,31 @@ void draw() {
drawgraph.drawGraph(list.getPoints());
}
void mouseReleased() {
Point p = new Point(mouseX,mouseY);
list.addPoint(p);
}

/*public void draw() {
if(mousePressed) {
float x = mouseX;
float y = mouseY;
if(pointclickedbool) {
pointclickedbool = false;
for(Point p: list.getPoints()) {
if(p.getX() < x-10 || p.getX() > x + 10)
{
if(p.getY() < y - 10 || p.getY() > y + 10) {
HalfEdge h = new HalfEdge(p, pointclicked);
}
float x = mouseX;
float y = mouseY;
if(pointclickedbool) {
pointclickedbool = false;
for(Point p: list.getPoints()) {
if((p.getX() - 5 < x) && (p.getX() + 5 > x)) {
if((p.getY() - 5 < y) && (p.getY() +5 > y)) {
HalfEdge h = new HalfEdge(p, pointclicked);
linedrawn = true;
}
}
} else {
for(Point p: list.getPoints()) {
if((p.getX() < x-10) && (p.getX() > x + 10))
{
if((p.getY() < y - 10) && (p.getY() > y + 10)) {
pointclickedbool = true;
pointclicked = p;
}
}
} else {
for(Point p: list.getPoints()) {
if((p.getX() - 5 < x) && (p.getX() + 5 > x)) {
if((p.getY() - 5 < y) && (p.getY() +5 > y)) {
pointclickedbool = true;
pointclicked = p;
}
}
}
}
if(!pointclickedbool && !linedrawn) {
Point p = new Point(x,y);
list.addPoint(p);
if(pointclickedbool) {
System.out.println("true");
}
}
draw.drawGraph(list.getPoints());
}*/
}
linedrawn = false;
}

0 comments on commit c1798e1

Please sign in to comment.