#include <polygon_2d.h>
Public メソッド | |
Polygon2D () | |
create empty polygon | |
Polygon2D (const std::vector< Vector2D > &v) | |
create polygon with points | |
const Polygon2D & | assign () |
set polygon to empty polygon | |
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 > & | vertex () const |
get list of point of this polygon | |
std::vector< Vector2D > & | vertex () |
get list of point of this polygon | |
bool | contains (const Vector2D &p, bool allow_on_segment=true) 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, bool check_as_plane=true) const |
get minimum distance between this polygon and point | |
double | area () const |
get area of this polygon | |
double | signedArea2 () const |
get area with sign | |
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 |
rcsc::Polygon2D::Polygon2D | ( | const std::vector< Vector2D > & | v | ) |
create polygon with points
v | array of points |
const Polygon2D & rcsc::Polygon2D::assign | ( | ) |
set polygon to empty polygon
set polygon with points
v | array of points |
void rcsc::Polygon2D::addVertex | ( | const Vector2D & | p | ) |
append point to polygon
p | new point |
const std::vector< Vector2D > & rcsc::Polygon2D::vertex | ( | ) | const |
get list of point of this polygon
std::vector< Vector2D > & rcsc::Polygon2D::vertex | ( | ) |
get list of point of this polygon
bool rcsc::Polygon2D::contains | ( | const Vector2D & | p, | |
bool | allow_on_segment = true | |||
) | const |
check point is in this polygon or not
p | point for checking | |
allow_on_segment | when point is on outline, if this parameter is set to true, returns true |
Rect2D rcsc::Polygon2D::getBoundingBox | ( | ) | const |
get bounding box of this polygon
Vector2D rcsc::Polygon2D::xyCenter | ( | ) | const |
get centor of bounding box of this polygon
double rcsc::Polygon2D::dist | ( | const Vector2D & | p, | |
bool | check_as_plane = true | |||
) | const |
get minimum distance between this polygon and point
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. |
double rcsc::Polygon2D::area | ( | ) | const |
get area of this polygon
double rcsc::Polygon2D::signedArea2 | ( | ) | const |
get area with sign
bool rcsc::Polygon2D::isCounterclockwise | ( | ) | const |
check vertexes of this polygon is placed counterclockwise ot not
bool rcsc::Polygon2D::isClockwise | ( | ) | const |
check vertexes of this polygon is placed clockwise ot not
get a polygon clipped by a rectangle
r | rectangle for clipping |