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
triangulation.h
Go to the documentation of this file.
1// -*-c++-*-
2
7
8/*
9 *Copyright:
10
11 Copyright (C) Hidehisa Akiyama
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
30#ifndef RCSC_GEOM_TRIANGULATION_USING_TRIANGLE_H
31#define RCSC_GEOM_TRIANGULATION_USING_TRIANGLE_H
32
33#include <geom/vector_2d.h>
34
35#include <vector>
36#include <set>
37
38namespace rcsc {
39
45public:
50 struct Triangle {
51 size_t v0_;
52 size_t v1_;
53 size_t v2_;
54
61 Triangle( const size_t v0,
62 const size_t v1,
63 const size_t v2 )
64 : v0_( v0 )
65 , v1_( v1 )
66 , v2_( v2 )
67 { }
68 };
69
70 typedef std::vector< Vector2D > PointCont;
71 typedef std::vector< Triangle > TriangleCont;
72 typedef std::pair< size_t, size_t > Segment;
73 typedef std::set< Segment > SegmentSet;
74 typedef std::vector< Segment > SegmentCont;
75
76private:
77
78 bool M_use_triangles;
79 bool M_use_edges;
80
81#ifdef TRIANGULATION_STRICT_POINT_SET
82 std::set< Vector2D, Vector2D::XYCmp > M_point_set;
83#endif
84
85 PointCont M_points;
86 SegmentSet M_constraints;
87
88 TriangleCont M_triangles;
89 SegmentCont M_edges;
90
91public:
96 : M_use_triangles( true )
97 , M_use_edges( true )
98 { }
99
103 void clear();
104
109
114 const PointCont & points() const
115 {
116 return M_points;
117 }
118
123 const SegmentSet & constraints() const
124 {
125 return M_constraints;
126 }
127
132 const TriangleCont & triangles() const
133 {
134 return M_triangles;
135 }
136
141 const SegmentCont & edges() const
142 {
143 return M_edges;
144 }
145
150 void setUseTriangles( const bool on )
151 {
152 M_use_triangles = on;
153 }
154
159 void setUseEdges( const bool on )
160 {
161 M_use_edges = on;
162 }
163
169 bool addPoint( const Vector2D & p );
170
176 size_t addPoints( const PointCont & v );
177
183 bool addConstraint( const size_t & origin_index,
184 const size_t & terminal_index );
185
189 void compute();
190
196 const Triangle * findTriangleContains( const Vector2D & point ) const;
197
203 int findNearestPoint( const Vector2D & point ) const;
204};
205
206}
207
208#endif
std::set< Segment > SegmentSet
segment edge set type.
Definition triangulation.h:73
void setUseEdges(const bool on)
set use_triangles property.
Definition triangulation.h:159
void setUseTriangles(const bool on)
set use_triangles property.
Definition triangulation.h:150
size_t addPoints(const PointCont &v)
add points to the input point container.
Triangulation()
create null triangulation object.
Definition triangulation.h:95
bool addPoint(const Vector2D &p)
add point to the input point container.
std::pair< size_t, size_t > Segment
segment edge type.
Definition triangulation.h:72
bool addConstraint(const size_t &origin_index, const size_t &terminal_index)
add constraint point indices for Constrained Delaunay triangulation.
void clear()
clear all data.
const TriangleCont & triangles() const
get result triangle set.
Definition triangulation.h:132
const SegmentCont & edges() const
get result triangle edges.
Definition triangulation.h:141
const SegmentSet & constraints() const
get constrained edges.
Definition triangulation.h:123
void clearResults()
clear result data.
const Triangle * findTriangleContains(const Vector2D &point) const
find the triangle contanes the input point.
void compute()
generates triangulation.
std::vector< Vector2D > PointCont
point container type.
Definition triangulation.h:70
std::vector< Segment > SegmentCont
segment edge container type.
Definition triangulation.h:74
const PointCont & points() const
get input point container.
Definition triangulation.h:114
std::vector< Triangle > TriangleCont
triangle container type.
Definition triangulation.h:71
int findNearestPoint(const Vector2D &point) const
find the point nearest to the input point.
2D point vector class
Definition vector_2d.h:47
2d vector class Header File.
triangle object type for Triangulation.
Definition triangulation.h:50
size_t v1_
index of second vertex
Definition triangulation.h:52
Triangle(const size_t v0, const size_t v1, const size_t v2)
construct with all indices
Definition triangulation.h:61
size_t v2_
index of third vertex
Definition triangulation.h:53
size_t v0_
index of first vertex
Definition triangulation.h:51