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
sector_2d.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
31
32#ifndef RCSC_GEOM_SECTOR2D_H
33#define RCSC_GEOM_SECTOR2D_H
34
35#include <geom/region_2d.h>
36#include <geom/vector_2d.h>
37
38namespace rcsc {
39
44class Sector2D
45 : public Region2D {
46private:
48 Vector2D M_center;
49
51 double M_min_radius;
53 double M_max_radius;
54
56 AngleDeg M_angle_left_start;
58 AngleDeg M_angle_right_end;
59
61 Sector2D();
62public:
63
72 Sector2D( const Vector2D & c,
73 const double & min_r,
74 const double & max_r,
75 const AngleDeg & start,
76 const AngleDeg & end );
77
86 const
87 Sector2D & assign( const Vector2D & c,
88 const double & min_r,
89 const double & max_r,
90 const AngleDeg & start,
91 const AngleDeg & end );
92
97 const
98 Vector2D & center() const
99 {
100 return M_center;
101 }
102
107 const
108 double & radiusMin() const
109 {
110 return M_min_radius;
111 }
112
117 const
118 double & radiusMax() const
119 {
120 return M_max_radius;
121 }
122
127 const
129 {
130 return M_angle_left_start;
131 }
132
137 const
139 {
140 return M_angle_right_end;
141 }
142
147 virtual
148 double area() const;
149
155 virtual
156 bool contains( const Vector2D & point ) const
157 {
158 Vector2D rel = point - center();
159 double d2 = rel.r2();
160 return ( M_min_radius * M_min_radius <= d2
161 && d2 <= M_max_radius * M_max_radius
162 && rel.th().isWithin( M_angle_left_start,
163 M_angle_right_end ) );
164 }
165
170 double getCircumferenceMin() const
171 {
172 double div = ( M_angle_right_end - M_angle_left_start ).degree();
173 if ( div < 0.0 )
174 {
175 div += 360.0;
176 }
177 return ( 2.0 * M_min_radius * M_PI ) * ( div / 360.0 );
178 }
179
184 double getCircumferenceMax() const
185 {
186 double div = ( M_angle_right_end - M_angle_left_start ).degree();
187 if ( div < 0.0 )
188 {
189 div += 360.0;
190 }
191 return ( 2.0 * M_max_radius * M_PI ) * ( div / 360.0 );
192 }
193};
194
195}
196
197#endif
#define M_PI
PI value macro.
Definition angle_deg.cpp:43
degree wrapper class
Definition angle_deg.h:45
bool isWithin(const AngleDeg &left, const AngleDeg &right) const
check if this angle is within [left, right] (turn clockwise).
Definition angle_deg.cpp:60
Region2D()
accessible only from derived classes
Definition region_2d.h:49
double getCircumferenceMin() const
get smaller side circumference(ENSYUU NO NAGASA)
Definition sector_2d.h:170
virtual double area() const
calculate the area of this region
Definition sector_2d.cpp:106
const double & radiusMax() const
get the big side radius
Definition sector_2d.h:118
const Vector2D & center() const
get the center point
Definition sector_2d.h:98
const Sector2D & assign(const Vector2D &c, const double &min_r, const double &max_r, const AngleDeg &start, const AngleDeg &end)
assign new value
Definition sector_2d.cpp:73
virtual bool contains(const Vector2D &point) const
check if point is within this region
Definition sector_2d.h:156
const double & radiusMin() const
get the small side radius
Definition sector_2d.h:108
double getCircumferenceMax() const
get bigger side circumference(ENSYUU NO NAGASA)
Definition sector_2d.h:184
const AngleDeg & angleLeftStart() const
get the left start angle
Definition sector_2d.h:128
const AngleDeg & angleRightEnd() const
get the right end angle
Definition sector_2d.h:138
2D point vector class
Definition vector_2d.h:47
AngleDeg th() const
get the angle of vector.
Definition vector_2d.h:194
double r2() const
get the squared length of vector.
Definition vector_2d.h:139
2d vector class Header File.
abstract 2D region class Header File.