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.
60 lines (60 sloc)
1.84 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 (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 | |
}*/ |