Added a Graph datastructure and refactored the Line/Vertex classes
This commit is contained in:
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user