Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
More...
|
| SHAPE_SIMPLE () |
| Create an empty polygon.
|
|
| SHAPE_SIMPLE (const SHAPE_LINE_CHAIN &aPoly) |
|
| SHAPE_SIMPLE (const SHAPE_SIMPLE &aOther) |
|
SHAPE * | Clone () const override |
| Return a dynamically allocated copy of the shape.
|
|
void | Clear () |
| Remove all points from the polygon.
|
|
const BOX2I | BBox (int aClearance=0) const override |
| Compute a bounding box of the shape, with a margin of aClearance a collision.
|
|
int | PointCount () const |
| Return the number of points (vertices) in this polygon.
|
|
const VECTOR2I & | CPoint (int aIndex) const |
| Return a const reference to a given point in the polygon.
|
|
const VECTOR2D | CDPoint (int aIndex) const |
| Return a given point as a vector with elements of type double.
|
|
const SHAPE_LINE_CHAIN & | Vertices () const |
| Return the list of vertices defining this simple polygon.
|
|
void | Append (int aX, int aY) |
| Append a new point at the end of the polygon.
|
|
void | Append (const VECTOR2I &aP) |
| Append a new point at the end of the polygon.
|
|
bool | Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
| Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision.
|
|
void | Rotate (double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override |
|
void | Move (const VECTOR2I &aVector) override |
|
bool | IsSolid () const override |
|
virtual const VECTOR2I | GetPoint (int aIndex) const override |
|
virtual const SEG | GetSegment (int aIndex) const override |
|
virtual size_t | GetPointCount () const override |
|
virtual size_t | GetSegmentCount () const override |
|
bool | IsClosed () const override |
|
| SHAPE_LINE_CHAIN_BASE (SHAPE_TYPE aType) |
|
virtual bool | Collide (const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
| Check if point aP lies closer to us than aClearance.
|
|
SEG::ecoord | SquaredDistance (const VECTOR2I &aP, bool aOutlineOnly=false) const |
|
bool | PointInside (const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const |
| Check if point aP lies inside a polygon (any type) defined by the line chain.
|
|
bool | PointOnEdge (const VECTOR2I &aP, int aAccuracy=0) const |
| Check if point aP lies on an edge or vertex of the line chain.
|
|
int | EdgeContainingPoint (const VECTOR2I &aP, int aAccuracy=0) const |
| Check if point aP lies on an edge or vertex of the line chain.
|
|
virtual BOX2I * | GetCachedBBox () const |
|
| SHAPE (SHAPE_TYPE aType) |
| Create an empty shape of type aType.
|
|
bool | IsNull () const |
| Return true if the shape is a null shape.
|
|
virtual bool | Collide (const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const |
| Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.
|
|
virtual bool | Collide (const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const |
|
virtual VECTOR2I | Centre () const |
| Compute a center-of-mass of the shape.
|
|
virtual bool | Parse (std::stringstream &aStream) |
|
virtual const std::string | Format () const |
|
| SHAPE_BASE (SHAPE_TYPE aType) |
| Create an empty shape of type aType.
|
|
SHAPE_TYPE | Type () const |
| Return the type of the shape.
|
|
virtual bool | HasIndexableSubshapes () const |
|
virtual size_t | GetIndexableSubshapeCount () const |
|
virtual void | GetIndexableSubshapes (std::vector< SHAPE * > &aSubshapes) |
|
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
Internally the vertices are held in a SHAPE_LINE_CHAIN, please note that there is a "virtual" line segment between the last and first vertex.