Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
javascript
  • Loading branch information
cor11004 committed Dec 6, 2015
1 parent 74cd347 commit 4bed071
Showing 1 changed file with 53 additions and 15 deletions.
68 changes: 53 additions & 15 deletions main/main.pde
@@ -1,11 +1,13 @@
public void settings() {
size(500, 500, P2D); // 2D env
}
boolean pointclickedbool = false;
Point pointclicked;
PointList list = new PointList();
DrawHalfEdge drawgraph = new DrawHalfEdge();

public void setup() {
size(800, 500);
background(255);
fill(0,0);
translate(width/2, height/2);
PointList list = new PointList();
Point p1 = new Point(0, 0);
list.addPoint(p1);
Point p2 = new Point(100, 50);
Expand Down Expand Up @@ -40,7 +42,6 @@ public void setup() {
list.addPoint(p16);
Point p17 = new Point (20, 100);
list.addPoint(p17);
DrawHalfEdge draw = new DrawHalfEdge();
HalfEdge h1 = new HalfEdge(p1, p2);
HalfEdge h2 = new HalfEdge(p1, p4);
HalfEdge h3 = new HalfEdge(p3, p1);
Expand Down Expand Up @@ -81,16 +82,53 @@ public void setup() {
//h1.facePrint();
//HalfEdge h5 = new HalfEdge(v1,v2);
//h1.facePrint();
draw.drawGraph(list.getPoints());
drawgraph.drawGraph(list.getPoints());
//(new Face(h4, list)).printFace();
(new Face(h12, list)).printFace();

//(new Face(h12, list)).printFace();
print("finsihed set up");
}
void draw() {
ellipse(50,50,50,50);
if(mousePressed) {
float x = mouseX;
float y = mouseY;
Point p = new Point(x,y);
list.addPoint(p);
drawgraph.drawGraph(list.getPoints());
System.out.println("entered mousePressed");
}
}
/*public void draw() {
fill(0,0,255,40);
noStroke();
pushMatrix(); // store the default translation matrix
translate(width/2, height/2); // alter the current translation
//ellipse(0,0,100,100); //place the sphere in center of current translation
popMatrix(); // return to default translation
}*/
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);
}
}
}
} 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;
}
}
}
}
Point p = new Point(x,y);
list.addPoint(p);
if(pointclickedbool) {
System.out.println("true");
}
}
draw.drawGraph(list.getPoints());
}*/

0 comments on commit 4bed071

Please sign in to comment.