1use crate::math::{Rotation3D, Vec3};
4
5#[derive(Clone, Copy, Debug, Default)]
7pub struct TelemetryState {
8 pub position: Vec3,
9 pub rotation: Rotation3D,
10}
11
12impl TelemetryState {
13 pub fn new(position: Vec3, rotation: Rotation3D) -> Self {
14 Self { position, rotation }
15 }
16}
17
18#[derive(Clone, Debug)]
21pub struct TrailBuffer {
22 points: Vec<Vec3>,
23 capacity: usize,
24}
25
26impl TrailBuffer {
27 pub fn new(capacity: usize) -> Self {
28 Self { points: Vec::with_capacity(capacity), capacity }
29 }
30
31 pub fn push(&mut self, p: Vec3) {
32 if self.points.len() == self.capacity {
33 self.points.remove(0);
34 }
35 self.points.push(p);
36 }
37
38 pub fn as_slice(&self) -> &[Vec3] {
39 &self.points
40 }
41
42 pub fn clear(&mut self) {
43 self.points.clear();
44 }
45}