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
polygon_2d.h
Go to the documentation of this file.
1// -*-c++-*-
2
7
8/*
9 *Copyright:
10
11 Copyright (C) Hiroki Shimora, 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_POLYGON2D_H
31#define RCSC_GEOM_POLYGON2D_H
32
33#include <geom/region_2d.h>
34
35#include <vector>
36
37namespace rcsc {
38
39class Vector2D;
40class Rect2D;
41
47 : public Region2D {
48private:
49 std::vector< Vector2D > M_vertices;
50
51public:
55 Polygon2D();
56
61 Polygon2D( const std::vector< Vector2D > & v );
62
66 void clear();
67
73 const Polygon2D & assign( const std::vector< Vector2D > & v );
74
79 void addVertex( const Vector2D & p )
80 {
81 M_vertices.push_back( p );
82 }
83
88 const std::vector< Vector2D > & vertices() const
89 {
90 return M_vertices;
91 }
92
98 virtual
99 bool contains( const Vector2D & p ) const
100 {
101 return contains( p, true );
102 }
103
111 bool contains( const Vector2D & p,
112 const bool allow_on_segment ) const;
113
118 Rect2D getBoundingBox() const;
119
124 Vector2D xyCenter() const;
125
138 double dist( const Vector2D & p,
139 const bool check_as_plane = true ) const;
140
145 virtual
146 double area() const;
147
155 double doubleSignedArea() const;
156
161 bool isCounterclockwise() const;
162
167 bool isClockwise() const;
168
176};
177
178}
179
180#endif
2D polygon region class
Definition polygon_2d.h:47
virtual double area() const
get area of this polygon
Definition polygon_2d.cpp:319
double dist(const Vector2D &p, const bool check_as_plane=true) const
get minimum distance between this polygon and point
Definition polygon_2d.cpp:267
const std::vector< Vector2D > & vertices() const
get list of point of this polygon
Definition polygon_2d.h:88
bool isClockwise() const
check vertexes of this polygon is placed clockwise ot not
Definition polygon_2d.cpp:367
Vector2D xyCenter() const
get centor of bounding box of this polygon
Definition polygon_2d.cpp:141
virtual bool contains(const Vector2D &p) const
check point is in this polygon or not. the point on segment lines is allowed.
Definition polygon_2d.h:99
Polygon2D getScissoredConnectedPolygon(const Rect2D &r) const
get a polygon clipped by a rectangle
Definition polygon_2d.cpp:528
void clear()
clear all data.
Definition polygon_2d.cpp:73
double doubleSignedArea() const
calculate doubled signed area value
Definition polygon_2d.cpp:329
Polygon2D()
create empty polygon
Definition polygon_2d.cpp:52
void addVertex(const Vector2D &p)
append point to polygon
Definition polygon_2d.h:79
const Polygon2D & assign(const std::vector< Vector2D > &v)
set polygon with points
Definition polygon_2d.cpp:83
bool isCounterclockwise() const
check vertexes of this polygon is placed counterclockwise ot not
Definition polygon_2d.cpp:357
Rect2D getBoundingBox() const
get bounding box of this polygon
Definition polygon_2d.cpp:94
2D rectangle regin class.
Definition rect_2d.h:59
Region2D()
accessible only from derived classes
Definition region_2d.h:49
2D point vector class
Definition vector_2d.h:47
abstract 2D region class Header File.