LARS
LARS (Light Augmented Reality System) is an open-source framework for light-based interaction and real-time tracking in multi-robot experiments. Inspired by ARK, LARS extends the augmented reality paradigm to robotic collectives by projecting dynamic visual cues and environments onto the arena, enabling new experimental possibilities for collective robotics research, education, and outreach. LARS features integrated tracking, light projection, and modular experiment control with a user-friendly Qt GUI.
Loading...
Searching...
No Matches
voronoiGenerator.h
1#ifndef VORONOIGENERATOR_H
2#define VORONOIGENERATOR_H
3
4#include <vector>
5#include <boost/polygon/voronoi.hpp>
6#include <boost/polygon/polygon.hpp>
7#include <boost/polygon/segment_concept.hpp>
8
9#include <QList>
10#include <limits>
11#include <QLineF>
12#include <QRectF>
13
14#include <QDebug>
15
16using namespace boost::polygon;
17
18
19class QPoint;
20
21class voronoiGenerator {
22
23public:
24 typedef double coordinate_type;
25 typedef point_data<coordinate_type> point_type;
26
27private:
28
29
30 typedef segment_data<coordinate_type> segment_type;
31 typedef rectangle_data<coordinate_type> rect_type;
32 typedef voronoi_builder<int> VB;
33 typedef voronoi_diagram<coordinate_type> VD;
34 typedef VD::edge_type edge_type;
35 typedef VD::cell_type cell_type;
36 typedef VD::cell_type::source_index_type source_index_type;
37 typedef VD::cell_type::source_category_type source_category_type;
38 typedef VD::cell_container_type cell_container_type;
39 typedef VD::cell_container_type vertex_container_type;
40 typedef VD::edge_container_type edge_container_type;
41 typedef VD::const_cell_iterator const_cell_iterator;
42 typedef VD::const_vertex_iterator const_vertex_iterator;
43 typedef VD::const_edge_iterator const_edge_iterator;
44
45 std::vector<segment_type> segment_data_;
46
47 rect_type brect_;
48 std::vector<point_type> point_data_;
49
50public:
51 voronoiGenerator();
52 static void generateVoronoi(const QList<QPoint>& points, boost::polygon::voronoi_diagram<double>& vd);
53 static QPoint findIntersection(const QLineF& line, double rectX, double rectY, double width, double height);
54 void update_points(const QList<QPoint>& points);
55
56 void old_voronoi_plot();
57
58 void set_brect(QRectF Rect);
59
60public slots:
61 QPointF calculateIntersection(const QPointF &point, const QPointF &direction, const QRectF &bounds);
62 QPointF calculateIntersectionII(const QPointF& knownPoint, const QPointF& midPoint, const QRectF& bounds);
63 void clip_infinite_edge(const edge_type &edge, std::vector<point_type> *clipped_edge);
64 point_type retrieve_point(const cell_type &cell);
65
66 segment_type retrieve_segment(const cell_type &cell);
67};
68
69#endif // VORONOIGENERATOR_H