Added a Graph datastructure and refactored the Line/Vertex classes

This commit is contained in:
Quinn
2023-05-02 09:49:38 -05:00
parent 9b0acbe34c
commit 3321e77061
18 changed files with 859 additions and 68 deletions

View File

@@ -1,3 +1,4 @@
import Vector.Vector;
import processing.core.PApplet;
import java.util.ArrayList;
@@ -16,7 +17,7 @@ public class Processing extends PApplet {
processing = this;
car = new Car(processing, 100,100,50,40);
size(1000, 1000);
car.addView(180,90);
car.addView(360,180);
for(int i = 0; i < 15; i++){
Wall wall = new Wall(processing, new Vector((int)random(50, 950), (int)random(50, 950)), new Vector((int)random(50, 950), (int)random(50, 950)));
objects.add(wall);
@@ -24,10 +25,16 @@ public class Processing extends PApplet {
}
public void draw(){
background(0);
for(Wall object : objects){
object.drawWall();
}
// for(Wall object : objects){
// object.drawWall();
// }
car.drawCar(objects);
View view = car.views.get(0);
view.look(objects);
ArrayList<Vector> points = view.getPoints();
for(Vector point: points){
circle(point.x, point.y, 5);
}
strokeWeight(2);
stroke(255);
//car.drive(new int[] {0, 0});