|
Horizon
|
An abstract shape on 2D plane. More...
#include <shape.h>
Public Member Functions | |
| SHAPE (SHAPE_TYPE aType) | |
| Create an empty shape of type aType. | |
| virtual SHAPE * | Clone () const |
| Return a dynamically allocated copy of the shape. More... | |
| bool | IsNull () const |
| Return true if the shape is a null shape. More... | |
| virtual bool | Collide (const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const |
| Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision. More... | |
| 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. More... | |
| virtual bool | Collide (const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const |
| virtual bool | Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const =0 |
| Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision. More... | |
| virtual const BOX2I | BBox (int aClearance=0) const =0 |
| Compute a bounding box of the shape, with a margin of aClearance a collision. More... | |
| virtual VECTOR2I | Centre () const |
| Compute a center-of-mass of the shape. More... | |
| virtual void | Rotate (double aAngle, const VECTOR2I &aCenter={ 0, 0 })=0 |
| virtual void | Move (const VECTOR2I &aVector)=0 |
| virtual bool | IsSolid () const =0 |
| virtual bool | Parse (std::stringstream &aStream) |
| virtual const std::string | Format () const |
Public Member Functions inherited from SHAPE_BASE | |
| SHAPE_BASE (SHAPE_TYPE aType) | |
| Create an empty shape of type aType. | |
| SHAPE_TYPE | Type () const |
| Return the type of the shape. More... | |
| virtual bool | HasIndexableSubshapes () const |
| virtual size_t | GetIndexableSubshapeCount () const |
| virtual void | GetIndexableSubshapes (std::vector< SHAPE * > &aSubshapes) |
Static Public Attributes | |
| static const int | MIN_PRECISION_IU = 4 |
| This is the minimum precision for all the points in a shape. | |
Protected Types | |
| typedef VECTOR2I::extended_type | ecoord |
Additional Inherited Members | |
Protected Attributes inherited from SHAPE_BASE | |
| SHAPE_TYPE | m_type |
| < type of our shape | |
An abstract shape on 2D plane.
|
pure virtual |
Compute a bounding box of the shape, with a margin of aClearance a collision.
| aClearance | how much the bounding box is expanded wrs to the minimum enclosing rectangle for the shape. |
Implemented in SHAPE_ARC, SHAPE_CIRCLE, SHAPE_COMPOUND, SHAPE_LINE_CHAIN, SHAPE_NULL, SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI, SHAPE_POLY_SET, SHAPE_RECT, SHAPE_SEGMENT, and SHAPE_SIMPLE.
|
inlinevirtual |
Compute a center-of-mass of the shape.
|
inlinevirtual |
Return a dynamically allocated copy of the shape.
| copy | of the shape |
Reimplemented in SHAPE_ARC, SHAPE_CIRCLE, SHAPE_COMPOUND, SHAPE_LINE_CHAIN, SHAPE_NULL, SHAPE_POLY_SET, SHAPE_RECT, SHAPE_SEGMENT, and SHAPE_SIMPLE.
|
pure virtual |
Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance, indicating a collision.
| aActual | [out] an optional pointer to an int to be updated with the actual distance int the event of a collision. |
| aLocation | [out] an option pointer to a point to store a nearby location in the event of a collision. |
Implemented in SHAPE_LINE_CHAIN_BASE, SHAPE_ARC, SHAPE_CIRCLE, SHAPE_COMPOUND, SHAPE_LINE_CHAIN, SHAPE_NULL, SHAPE_POLY_SET, SHAPE_RECT, SHAPE_SEGMENT, and SHAPE_SIMPLE.
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.
| aShape | shape to check collision against |
| aClearance | minimum clearance |
| aMTV | minimum translation vector |
| aActual | [out] an optional pointer to an int to store the actual distance in the event of a collision. |
| aLocation | [out] an option pointer to a point to store a nearby location in the event of a collision. |
Reimplemented in SHAPE_COMPOUND, SHAPE_RECT, and SHAPE_SEGMENT.
|
virtual |
Reimplemented in SHAPE_POLY_SET.
|
inlinevirtual |
Check if the boundary of shape (this) lies closer to the point aP than aClearance, indicating a collision.
| aActual | [out] an optional pointer to an int to store the actual distance in the event of a collision. |
| aLocation | [out] an option pointer to a point to store a nearby location in the event of a collision. |
Reimplemented in SHAPE_LINE_CHAIN_BASE, SHAPE_ARC, SHAPE_LINE_CHAIN, SHAPE_POLY_SET, and SHAPE_SEGMENT.
|
virtual |
Reimplemented in SHAPE_LINE_CHAIN, and SHAPE_POLY_SET.
|
inline |
Return true if the shape is a null shape.
| true | if null :-) |
|
pure virtual |
Implemented in SHAPE_POLY_SET.
|
pure virtual |
Implemented in SHAPE_POLY_SET.
|
virtual |
Reimplemented in SHAPE_LINE_CHAIN, and SHAPE_POLY_SET.
|
pure virtual |
| aCenter | is the rotation center. |
| aAngle | rotation angle in radians. |
Implemented in SHAPE_ARC, SHAPE_LINE_CHAIN, SHAPE_CIRCLE, SHAPE_COMPOUND, SHAPE_NULL, SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI, SHAPE_POLY_SET, SHAPE_RECT, SHAPE_SEGMENT, and SHAPE_SIMPLE.