diff --git a/src/main/java/org/opennars/applications/crossing/Entity.java b/src/main/java/org/opennars/applications/crossing/Entity.java index 42a58dff2cdf8c2e9eb0807e6f573270d88d9067..85b6532a1da69becb664b869d1d779fd41066319 100755 --- a/src/main/java/org/opennars/applications/crossing/Entity.java +++ b/src/main/java/org/opennars/applications/crossing/Entity.java @@ -34,6 +34,7 @@ public class Entity { public static int entityID = 0; public String label = ""; public double posX, posY; + public double width, height; public double getPosX() { return posX; } @@ -47,11 +48,8 @@ public class Entity { public float maxSpeed = 2.0f; public static boolean pedestrianIgnoreTrafficLight = false; public static boolean carIgnoreTrafficLight = false; - public double normalness = 0.0; - public boolean isPredicted = false; - public double lastPosX = 0; public double lastPosY = 0; @@ -130,7 +128,14 @@ public class Entity { } } if(!isPredicted) { - applet.ellipse(2.5f, 2.5f, Util.discretization*scale, Util.discretization*scale); + //applet.rect((float) (0.0f-width/2.0f), (float) (0.0f-height/2.0f), (float) width, (float) height); + float mul2 = 2.0f; + if(RealCrossing.running) { + applet.ellipse(2.5f, 2.5f, Util.discretization*scale*mul2, Util.discretization*scale*mul2); + } else { + applet.ellipse(2.5f, 2.5f, Util.discretization*scale, Util.discretization*scale); + } + } if(RealCrossing.running) { diff --git a/src/main/java/org/opennars/applications/crossing/RealCrossing/RealCrossing.java b/src/main/java/org/opennars/applications/crossing/RealCrossing/RealCrossing.java index 7cf2c87856dc71ddde6437aef61dd5c9a1881912..3288ce09eff7c50836e864399abf95845035efe3 100755 --- a/src/main/java/org/opennars/applications/crossing/RealCrossing/RealCrossing.java +++ b/src/main/java/org/opennars/applications/crossing/RealCrossing/RealCrossing.java @@ -218,6 +218,9 @@ public class RealCrossing extends PApplet { } Integer X = Integer.valueOf(unwrap(props[3])); Integer Y = Integer.valueOf(unwrap(props[4])); + + Integer width = Integer.valueOf(unwrap(props[5])); + Integer height = Integer.valueOf(unwrap(props[6])); Integer X2 = Integer.valueOf(unwrap(props[19])); //7 6 Integer Y2 = Integer.valueOf(unwrap(props[20])); @@ -229,26 +232,37 @@ public class RealCrossing extends PApplet { if(Y < Y2) { id += 1; } - + + double angle = Math.atan2(Y - Y2, X - X2); + double movement = Math.sqrt((X-X2)*(X-X2) + (Y - Y2)*(Y - Y2)); if(props[0].equals("0")) { //person or vehicle for now if(movement < (double)movementThresholdPedestrian) { continue; } - Pedestrian toAdd = new Pedestrian(id, X, Y, 0, 0, label); + Pedestrian toAdd = new Pedestrian(id, X2, Y2, 0, 0, label); + toAdd.width = width; + toAdd.height = height; + //toAdd.angle = angle; entities.add(toAdd); } else { if(!props[0].equals("1")) { if(movement < (double)movementThresholdCar) { continue; } - Car toAdd = new Car(id, X, Y, 0, 0, label); + Car toAdd = new Car(id, X2, Y2, 0, 0, label); + toAdd.width = width; + toAdd.height = height; + //toAdd.angle = angle; entities.add(toAdd); } else { if(movement < (double)movementThresholdBike) { continue; } - Bike toAdd = new Bike(id, X, Y, 0, 0, label); + Bike toAdd = new Bike(id, X2, Y2, 0, 0, label); + toAdd.width = width; + toAdd.height = height; + //toAdd.angle = angle; entities.add(toAdd); } } @@ -329,7 +343,7 @@ public class RealCrossing extends PApplet { //</editor-fold> System.out.println("args: videopath trackletpath [discretization movementThreshold]"); System.out.println("example: java -cp \"*\" org.opennars.applications.crossing.RealCrossing /mnt/sda1/Users/patha/Downloads/Test/Test/Test001/ /home/tc/Dateien/CROSSING/Test001/ 100 10"); - Util.discretization = 100; + Util.discretization = 50; if(args.length == 2) { RealCrossing.videopath = args[0]; RealCrossing.trackletpath = args[1];