feat: render particle clouds for selected tags

This commit is contained in:
2026-05-16 22:07:18 +02:00
parent b3f199b431
commit 181dcdc30e
9 changed files with 171 additions and 43 deletions
+27 -1
View File
@@ -12,6 +12,32 @@ class Particle {
factory Particle.fromJson(Map<String, dynamic> json) => Particle(
x: (json['x'] as num).toDouble(),
y: (json['y'] as num).toDouble(),
weight: (json['weight'] as num).toDouble(),
weight: (json['w'] as num).toDouble(),
);
}
/// Position estimate from the particle filter (weighted mean).
class Estimate {
const Estimate({required this.x, required this.y});
final double x;
final double y;
factory Estimate.fromJson(Map<String, dynamic> json) => Estimate(
x: (json['x'] as num).toDouble(),
y: (json['y'] as num).toDouble(),
);
}
/// A single `particles_updated` push from the server: estimate + raw cloud.
class ParticleSnapshot {
const ParticleSnapshot({
required this.tagId,
required this.estimate,
required this.particles,
});
final String tagId;
final Estimate estimate;
final List<Particle> particles;
}