Skip to content
Permalink
53f2abb130
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
60 lines (60 sloc) 1.84 KB
public void settings() {
size(500, 500, P2D); // 2D env
}
public void setup() {
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);
list.addPoint(p2);
Point p3 = new Point(-200, -50);
list.addPoint(p3);
Point p4 = new Point(0, 150);
list.addPoint(p4);
Point p5 = new Point(200, 0);
list.addPoint(p5);
Point p6 = new Point (-20, -40);
list.addPoint(p6);
Point p7 = new Point (10000,10000);
DrawHalfEdge draw = new DrawHalfEdge();
HalfEdge h1 = new HalfEdge(p1, p2);
HalfEdge h2 = new HalfEdge(p1, p4);
HalfEdge h3 = new HalfEdge(p3, p1);
HalfEdge h4 = new HalfEdge(p1, p5);
HalfEdge h5 = new HalfEdge(p3, p4);
HalfEdge h6 = new HalfEdge(p2, p4);
float f = CompGeo.signedArea(h1.gettwin());
float f2 = CompGeo.signedArea(h1);
System.out.println("Signed Area: " + f);
System.out.println("Signed Area: " + f2);
h1.gettwin().printFace();
h1.printFace();
if (CompGeo.inside(h1.gettwin(), p6, p7)) {
System.out.println("INSIDE");
} else { System.out.println("OUTSIDE"); }
//HalfEdge h5 = new HalfEdge(p5, p2);
//h5.gettwin().printFace();
//h5.printFace();
//HalfEdge h1 = new HalfEdge(v, v1);
//h1.facePrint();
//HalfEdge h2 = new HalfEdge(v, v3);
//h1.facePrint();
//HalfEdge h3 = new HalfEdge(v, v2);
//h1.facePrint();
//HalfEdge h4 = new HalfEdge(v,v4);
//h1.facePrint();
//HalfEdge h5 = new HalfEdge(v1,v2);
//h1.facePrint();
draw.drawGraph(list.getPoints());
}
/*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
}*/