2D polygon region class
More...
#include <polygon_2d.h>
|
|
| Polygon2D () |
| | create empty polygon
|
| | Polygon2D (const std::vector< Vector2D > &v) |
| | create polygon with points
|
|
void | clear () |
| | clear all data.
|
| const Polygon2D & | assign (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
|
|
virtual | ~Region2D () |
| | virtual destructor.
|
|
|
| Region2D () |
| | accessible only from derived classes
|
◆ Polygon2D()
| rcsc::Polygon2D::Polygon2D |
( |
const std::vector< Vector2D > & | v | ) |
|
create polygon with points
- Parameters
-
◆ addVertex()
| void rcsc::Polygon2D::addVertex |
( |
const Vector2D & | p | ) |
|
|
inline |
append point to polygon
- Parameters
-
◆ area()
| double rcsc::Polygon2D::area |
( |
| ) |
const |
|
virtual |
get area of this polygon
- Returns
- value of area with sign.
Implements rcsc::Region2D.
◆ assign()
set polygon with points
- Parameters
-
- 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
-
- 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
-
| p | point for checking |
| allow_on_segment | when 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
-
| p | point |
| check_as_plane | if 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
-
- 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: