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
circle_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_CIRCLE2D_H
33#define RCSC_GEOM_CIRCLE2D_H
34
35#include <iostream>
36
37#include <geom/region_2d.h>
38#include <geom/vector_2d.h>
39
40namespace rcsc {
41
42class Line2D;
43class Ray2D;
44class Segment2D;
45
51 : public Region2D {
52private:
53
55 Vector2D M_center;
56
58 double M_radius;
59
60 static const double EPSILON;
61
62
63public:
68 : M_center( 0.0, 0.0 )
69 , M_radius( 0.0 )
70 { }
71
77 Circle2D( const Vector2D & c,
78 const double & r )
79 : M_center( c )
80 , M_radius( r )
81 {
82 if ( r < 0.0 )
83 {
84 std::cerr << "Circle2D::Circle2D(). radius must be positive value."
85 << std::endl;
86 M_radius = 0.0;
87 }
88 }
89
96 const
97 Circle2D & assign( const Vector2D & c,
98 const double & r )
99 {
100 M_center = c;
101 M_radius = r;
102 if ( r < 0.0 )
103 {
104 std::cerr << "Circle2D::assign(). radius must be positive value."
105 << std::endl;
106 M_radius = 0.0;
107 }
108 return *this;
109 }
110
115 virtual
116 double area() const
117 {
118 return AngleDeg::PI * M_radius * M_radius;
119 }
120
126 virtual
127 bool contains( const Vector2D & point ) const
128 {
129 return M_center.dist2( point ) < M_radius * M_radius;
130 }
131
136 const
137 Vector2D & center() const
138 {
139 return M_center;
140 }
141
146 const
147 double & radius() const
148 {
149 return M_radius;
150 }
151
159 int intersection( const Line2D & line,
160 Vector2D * sol1,
161 Vector2D * sol2 ) const;
162
170 int intersection( const Ray2D & ray,
171 Vector2D * sol1,
172 Vector2D * sol2 ) const;
173
181 int intersection( const Segment2D & segment,
182 Vector2D * sol1,
183 Vector2D * sol2 ) const;
184
192 int intersection( const Circle2D & circle,
193 Vector2D * sol1,
194 Vector2D * sol2 ) const;
195
196 // static utility
197
205 static
206 Circle2D circumcircle( const Vector2D & p0,
207 const Vector2D & p1,
208 const Vector2D & p2 );
209
218 static
219 bool contains( const Vector2D & point,
220 const Vector2D & p0,
221 const Vector2D & p1,
222 const Vector2D & p2 );\
228 bool HasIntersection( Line2D line);
229\
235 bool HasIntersection( Line2D line , float SF);
236\
242 bool HasIntersection( Segment2D Seg);
243\
249 bool HasIntersection( Segment2D Seg , float SF);
250
251
252
259
260};
261
262}
263
264#endif
static const double PI
pi valur
Definition angle_deg.h:63
2d circle class
Definition circle_2d.h:51
const double & radius() const
get the radius value
Definition circle_2d.h:147
virtual bool contains(const Vector2D &point) const
check if point is within this region
Definition circle_2d.h:127
virtual double area() const
get the area value of this circle
Definition circle_2d.h:116
bool HasIntersection(Line2D line)
HasIntersection : check that this Line2D Has Intersection with circle or not.
Definition circle_2d.cpp:363
int intersection(const Line2D &line, Vector2D *sol1, Vector2D *sol2) const
caluclate the intersection with straight line
Definition circle_2d.cpp:114
Circle2D(const Vector2D &c, const double &r)
construct with center point and radius value.
Definition circle_2d.h:77
static Circle2D circumcircle(const Vector2D &p0, const Vector2D &p1, const Vector2D &p2)
get the circle through three points (circumcircle of the triangle).
Definition circle_2d.cpp:312
const Vector2D & center() const
get the center point
Definition circle_2d.h:137
Vector2D nearestpoint(Vector2D pnt)
Intersect : If HasIntersection, return intersec point.
Definition circle_2d.cpp:391
const Circle2D & assign(const Vector2D &c, const double &r)
assign new value.
Definition circle_2d.h:97
Circle2D()
create a zero area circle at (0,0)
Definition circle_2d.h:67
2d straight line class
Definition line_2d.h:47
2D ray line class
Definition ray_2d.h:44
Region2D()
accessible only from derived classes
Definition region_2d.h:49
2d segment line class
Definition segment_2d.h:46
2D point vector class
Definition vector_2d.h:47
2d vector class Header File.
abstract 2D region class Header File.