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
ray_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_RAY2D_H
33#define RCSC_GEOM_RAY2D_H
34
35#include <geom/line_2d.h>
36#include <geom/vector_2d.h>
37
38namespace rcsc {
39
44class Ray2D {
45private:
47 Vector2D M_origin;
49 AngleDeg M_direction;
50
51public:
56 : M_origin( 0.0, 0.0 )
57 , M_direction( 0.0 )
58 { }
59
66 const AngleDeg & direction )
67 : M_origin( origin )
68 , M_direction( direction )
69 { }
70
76 const Vector2D & dir_point )
77 : M_origin( origin )
78 , M_direction( ( dir_point - origin ).th() )
79 { }
80
85 const
86 Vector2D & origin() const
87 {
88 return M_origin;
89 }
90
95 const
96 AngleDeg & dir() const
97 {
98 return M_direction;
99 }
100
105 Line2D line() const
106 {
107 return Line2D( origin(), dir() );
108 }
109
116 bool inRightDir( const Vector2D & point,
117 const double & thr = 10.0 ) const
118 {
119 return ( ( point - origin() ).th() - dir() ).abs() < thr;
120 }
121
128 Vector2D intersection( const Line2D & other ) const;
129
136 Vector2D intersection( const Ray2D & other ) const;
137
138};
139
140}
141
142#endif
degree wrapper class
Definition angle_deg.h:45
2d straight line class
Definition line_2d.h:47
2D ray line class
Definition ray_2d.h:44
const Vector2D & origin() const
get origin point
Definition ray_2d.h:86
Ray2D(const Vector2D &origin, const Vector2D &dir_point)
constructor with origin and other point
Definition ray_2d.h:75
const AngleDeg & dir() const
get the angle of this ray line
Definition ray_2d.h:96
Line2D line() const
get line generated from this ray
Definition ray_2d.h:105
Vector2D intersection(const Line2D &other) const
get the intersection point with 'line'
Definition ray_2d.cpp:45
Ray2D()
defalut constructor. all values are set to 0.
Definition ray_2d.h:55
bool inRightDir(const Vector2D &point, const double &thr=10.0) const
check whether p is on the direction of this Ray
Definition ray_2d.h:116
Ray2D(const Vector2D &origin, const AngleDeg &direction)
constructor with origin and direction
Definition ray_2d.h:65
2D point vector class
Definition vector_2d.h:47
2d vector class Header File.
2D straight line Header File.