diff options
Diffstat (limited to 'src/drone_controller.cc')
-rw-r--r-- | src/drone_controller.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/drone_controller.cc b/src/drone_controller.cc index cede63d..58f0359 100644 --- a/src/drone_controller.cc +++ b/src/drone_controller.cc @@ -261,6 +261,23 @@ void DroneController::computeCollisions(double sphere_radius) { } +void DroneController::computeSpeedingViolations(double speed) { + speed_violations.clear(); + for (int i = 0; i < duration; i++) { + for (Drone &d : drones) { + d.setTo(i); + if (d.getSpeed() > speed) { + speed_violations[i].append(d.getId()); + emit speedViolation(d.getId(), d.getSpeed(), i); + } + } + } + for (Drone &d : drones) { + d.setTo(frame); + } +} + + void DroneController::displaySpheres(double sphere_radius) { draw_spheres = true; this->sphere_radius = sphere_radius; |