From 7dc679371a30b867180adcf78226c7040862f6d5 Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 21 Nov 2023 21:30:21 -0500 Subject: [PATCH] Creating scan graph. --- src/Graph/PointVertex.java | 1 + src/Processing.java | 6 +----- src/ScanGraph/PointScan.java | 40 ++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 src/ScanGraph/PointScan.java diff --git a/src/Graph/PointVertex.java b/src/Graph/PointVertex.java index 1d849a9..98f4e6a 100644 --- a/src/Graph/PointVertex.java +++ b/src/Graph/PointVertex.java @@ -4,6 +4,7 @@ import processing.core.PApplet; public class PointVertex extends Vertex { private Vector position; + private int[] color = new int[]{127, 255, 0, 0}; /** diff --git a/src/Processing.java b/src/Processing.java index 139721c..15be76e 100644 --- a/src/Processing.java +++ b/src/Processing.java @@ -23,7 +23,7 @@ public class Processing extends PApplet { processing = this; car = new Car(processing, 100,100,50,40); size(1000, 1000); - car.addView(360,360); + car.addView(90,180); // for(int i = 0; i < 10; i++){ // PointVertex vStart = new PointVertex(random(50, 950), random(50, 950)); @@ -40,7 +40,6 @@ public class Processing extends PApplet { car.drawCar(map, SLAMIsHidden); strokeWeight(2); stroke(255); - //car.drive(new int[] {0, 0}); } public void keyPressed(){ @@ -127,7 +126,4 @@ public class Processing extends PApplet { PointVertex v = new PointVertex(clickPosition); map.addVertex(v); } - - - } \ No newline at end of file diff --git a/src/ScanGraph/PointScan.java b/src/ScanGraph/PointScan.java new file mode 100644 index 0000000..423b46c --- /dev/null +++ b/src/ScanGraph/PointScan.java @@ -0,0 +1,40 @@ +package ScanGraph; + +import Graph.PointGraph; +import Graph.Vertex; +import Vector.Vector; +import processing.core.PApplet; + +import java.util.ArrayList; + +public class PointScan extends Vertex{ + + private Vector position; + private ArrayList scan; + + PointScan(Vector scanPosition, ArrayList scan){ + super(); + this.position = scanPosition; + this.scan = scan; + } + + /** + * @param x the new x position of the vertex + * @param y the new y posiiton of the vertex + */ + public void setPos(float x, float y){ + this.position = new Vector(x, y); + } + + /** + * @return a two eleement float array containing the x and y coordinates of the vertex respectively. + */ + public Vector getPos(){ + return position; + } + + public ArrayList getScan(){ + return this.scan; + } + +}