Permalink
Cannot retrieve contributors at this time
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?
compgeoproject/main/main.pde
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
96 lines (94 sloc)
2.91 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(-50, 0); | |
list.addPoint(p7); | |
Point p8 = new Point(-100, 0); | |
list.addPoint(p8); | |
Point p9 = new Point(-100, 35); | |
list.addPoint(p9); | |
Point p10 = new Point(-50, 35); | |
list.addPoint(p10); | |
Point p11 = new Point(-80, 15); | |
list.addPoint(p11); | |
Point p12 = new Point(-60, 25); | |
list.addPoint(p12); | |
Point p13 = new Point (-25, 25); | |
list.addPoint(p13); | |
Point p14 = new Point (-25, 100); | |
list.addPoint(p14); | |
Point p15 = new Point(-150, -20); | |
list.addPoint(p15); | |
Point p16 = new Point (20, 50); | |
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); | |
HalfEdge h4 = new HalfEdge(p1, p5); | |
HalfEdge h5 = new HalfEdge(p3, p4); | |
HalfEdge h6 = new HalfEdge(p2, p4); | |
HalfEdge h7 = new HalfEdge(p7, p8); | |
HalfEdge h8 = new HalfEdge(p8, p9); | |
HalfEdge h9 = new HalfEdge(p9, p10); | |
HalfEdge h10 = new HalfEdge(p10, p7); | |
HalfEdge h11 = new HalfEdge(p11,p12); | |
HalfEdge h12 = new HalfEdge(p13,p14); | |
HalfEdge h13 = new HalfEdge(p7, p15); | |
HalfEdge h14 = new HalfEdge(p8, p15); | |
HalfEdge h15 = new HalfEdge(p9, p15); | |
HalfEdge h16 = new HalfEdge(p16, p17); | |
//h1.printFace(); | |
//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()); | |
//(new Face(h4, list)).printFace(); | |
(new Face(h12, list)).printFace(); | |
} | |
/*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 | |
}*/ |