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
rcsc::Polygon2D Class Reference

2D polygon region class More...

#include <polygon_2d.h>

Inheritance diagram for rcsc::Polygon2D:
rcsc::Region2D

Public Member Functions

 Polygon2D ()
 create empty polygon
 Polygon2D (const std::vector< Vector2D > &v)
 create polygon with points
void clear ()
 clear all data.
const Polygon2Dassign (const std::vector< Vector2D > &v)
 set polygon with points
void addVertex (const Vector2D &p)
 append point to polygon
const std::vector< Vector2D > & vertices () const
 get list of point of this polygon
virtual bool contains (const Vector2D &p) const
 check point is in this polygon or not. the point on segment lines is allowed.
bool contains (const Vector2D &p, const bool allow_on_segment) const
 check point is in this polygon or not
Rect2D getBoundingBox () const
 get bounding box of this polygon
Vector2D xyCenter () const
 get centor of bounding box of this polygon
double dist (const Vector2D &p, const bool check_as_plane=true) const
 get minimum distance between this polygon and point
virtual double area () const
 get area of this polygon
double doubleSignedArea () const
 calculate doubled signed area value
bool isCounterclockwise () const
 check vertexes of this polygon is placed counterclockwise ot not
bool isClockwise () const
 check vertexes of this polygon is placed clockwise ot not
Polygon2D getScissoredConnectedPolygon (const Rect2D &r) const
 get a polygon clipped by a rectangle
Public Member Functions inherited from rcsc::Region2D
virtual ~Region2D ()
 virtual destructor.

Additional Inherited Members

Protected Member Functions inherited from rcsc::Region2D
 Region2D ()
 accessible only from derived classes

Detailed Description

2D polygon region class

Constructor & Destructor Documentation

◆ Polygon2D()

rcsc::Polygon2D::Polygon2D ( const std::vector< Vector2D > & v)

create polygon with points

Parameters
varray of points

Member Function Documentation

◆ addVertex()

void rcsc::Polygon2D::addVertex ( const Vector2D & p)
inline

append point to polygon

Parameters
pnew point

◆ area()

double rcsc::Polygon2D::area ( ) const
virtual

get area of this polygon

Returns
value of area with sign.

Implements rcsc::Region2D.

◆ assign()

const Polygon2D & rcsc::Polygon2D::assign ( const std::vector< Vector2D > & v)

set polygon with points

Parameters
varray of points
Returns
const reference to itself

◆ contains() [1/2]

virtual bool rcsc::Polygon2D::contains ( const Vector2D & p) const
inlinevirtual

check point is in this polygon or not. the point on segment lines is allowed.

Parameters
ppoint for checking
Returns
true if point is in this polygon

Implements rcsc::Region2D.

◆ contains() [2/2]

bool rcsc::Polygon2D::contains ( const Vector2D & p,
const bool allow_on_segment ) const

check point is in this polygon or not

Parameters
ppoint for checking
allow_on_segmentwhen point is on outline, if this parameter is set to true, returns true
Returns
true if point is in this polygon

◆ dist()

double rcsc::Polygon2D::dist ( const Vector2D & p,
const bool check_as_plane = true ) const

get minimum distance between this polygon and point

Parameters
ppoint
check_as_planeif this parameter is set to true, handle this polygon as a plane polygon, otherwise handle this polygon as a polyline polygon. when point is inside of this polygon, distance between plane polygon and point is 0, distance between polyline polygon and point is minimum distance between each segments of this polygon.
Returns
minimum distance between this polygon and point

◆ doubleSignedArea()

double rcsc::Polygon2D::doubleSignedArea ( ) const

calculate doubled signed area value

Returns
value of doubled signed area. If vertices are placed counterclockwise order, returns positive number. If vertices are placed clockwise order, returns negative number. Otherwise, returns 0.

◆ getBoundingBox()

Rect2D rcsc::Polygon2D::getBoundingBox ( ) const

get bounding box of this polygon

Returns
bounding box of this polygon

◆ getScissoredConnectedPolygon()

Polygon2D rcsc::Polygon2D::getScissoredConnectedPolygon ( const Rect2D & r) const

get a polygon clipped by a rectangle

Parameters
rrectangle for clipping
Returns
a polygon. if polygon is separated by edges of rectangle, each separated polygon is connected to one polygon.

◆ isClockwise()

bool rcsc::Polygon2D::isClockwise ( ) const

check vertexes of this polygon is placed clockwise ot not

Returns
true if clockwise

◆ isCounterclockwise()

bool rcsc::Polygon2D::isCounterclockwise ( ) const

check vertexes of this polygon is placed counterclockwise ot not

Returns
true if counterclockwise

◆ vertices()

const std::vector< Vector2D > & rcsc::Polygon2D::vertices ( ) const
inline

get list of point of this polygon

Returns
const reference to point list

◆ xyCenter()

Vector2D rcsc::Polygon2D::xyCenter ( ) const

get centor of bounding box of this polygon

Returns
centor of bounding box of this polygon

The documentation for this class was generated from the following files: