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
size_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_SIZE2D_H
33#define RCSC_GEOM_SIZE2D_H
34
35#include <ostream>
36#include <cmath>
37
38namespace rcsc {
39
44class Size2D {
45private:
47 double M_length;
48
50 double M_width;
51
52public:
53
58 : M_length( 0.0 )
59 , M_width( 0.0 )
60 { }
61
67 Size2D( const double & length,
68 const double & width )
69 : M_length( std::fabs( length ) )
70 , M_width( std::fabs( width ) )
71 { }
72
79 const
80 Size2D & assign( const double & length,
81 const double & width )
82 {
83 M_length = std::fabs( length );
84 M_width = std::fabs( width );
85 return *this;
86 }
87
93 const
94 Size2D & setLength( const double & length )
95 {
96 M_length = std::fabs( length );
97 return *this;
98 }
99
105 const
106 Size2D & setWidth( const double & width )
107 {
108 M_width = std::fabs( width );
109 return *this;
110 }
111
116 const
117 double & length() const
118 {
119 return M_length;
120 }
121
126 const
127 double & width() const
128 {
129 return M_width;
130 }
131
136 double diagonal() const
137 {
138 return std::sqrt( length() * length()
139 + width() * width() );
140 }
141
147 std::ostream & print( std::ostream & os ) const
148 {
149 os << "(" << length() << ", " << width() << ")";
150 return os;
151 }
152
153};
154
155} // end of namespace
156
157#endif
Size2D()
default constructor.
Definition size_2d.h:57
const double & length() const
get the value of X range
Definition size_2d.h:117
std::ostream & print(std::ostream &os) const
output values to stream.
Definition size_2d.h:147
double diagonal() const
get the length of diagonal line
Definition size_2d.h:136
const Size2D & setLength(const double &length)
set new X range
Definition size_2d.h:94
const Size2D & assign(const double &length, const double &width)
assign new range directly.
Definition size_2d.h:80
Size2D(const double &length, const double &width)
constructor with variables
Definition size_2d.h:67
const Size2D & setWidth(const double &width)
set new Y range
Definition size_2d.h:106
const double & width() const
get the value of Y range
Definition size_2d.h:127