![]() |
KiCad PCB EDA Suite
|
#include <shape.h>
Public Member Functions | |
SHAPE_LINE_CHAIN_BASE (SHAPE_TYPE aType) | |
virtual | ~SHAPE_LINE_CHAIN_BASE () |
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. More... | |
virtual bool | Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
Check if segment aSeg lies closer to us than aClearance. More... | |
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. More... | |
bool | PointOnEdge (const VECTOR2I &aP, int aAccuracy=0) const |
Check if point aP lies on an edge or vertex of the line chain. More... | |
int | EdgeContainingPoint (const VECTOR2I &aP, int aAccuracy=0) const |
Check if point aP lies on an edge or vertex of the line chain. More... | |
virtual const VECTOR2I | GetPoint (int aIndex) const =0 |
virtual const SEG | GetSegment (int aIndex) const =0 |
virtual size_t | GetPointCount () const =0 |
virtual size_t | GetSegmentCount () const =0 |
virtual bool | IsClosed () const =0 |
virtual BOX2I * | GetCachedBBox () const |
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 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 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 |
FACET * | NewFacet () |
SGNODE * | CalcShape (SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false) |
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. More... | |
Protected Types | |
typedef VECTOR2I::extended_type | ecoord |
Protected Attributes | |
SHAPE_TYPE | m_type |
< type of our shape More... | |
|
protectedinherited |
|
inline |
|
inlinevirtual |
|
pure virtualinherited |
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_POLY_SET, SHAPE_LINE_CHAIN, SHAPE_ARC, SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI, SHAPE_RECT, SHAPE_SIMPLE, SHAPE_COMPOUND, SHAPE_CIRCLE, SHAPE_SEGMENT, and SHAPE_NULL.
Referenced by boundingBox(), SHAPE::Centre(), PNS::ARC::ChangedArea(), PNS::VIA::ChangedArea(), DRC_RTREE::CheckColliding(), SHAPE_INDEX_LIST< PNS::ITEM * >::Query(), SHAPE_INDEX< T >::Query(), SHAPE_INDEX_LIST< T, >::query_iterator::query_iterator(), SHAPE_INDEX_LIST< T, >::SHAPE_ENTRY::SHAPE_ENTRY(), and ROUTER_PREVIEW_ITEM::ViewBBox().
|
inherited |
Definition at line 703 of file wrlfacet.cpp.
References IFSG_NODE::AddChildNode(), IFSG_INDEX::AddIndex(), IFSG_NODE::AddRefNode(), SHAPE::facets, IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), IFSG_FACESET::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COLORS::SetColorList(), IFSG_COORDS::SetCoordsList(), IFSG_NORMALS::SetNormalList(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
|
inlinevirtualinherited |
Compute a center-of-mass of the shape.
Definition at line 216 of file shape.h.
References SHAPE::BBox(), and BOX2< Vec >::Centre().
Referenced by Collide().
|
inlinevirtualinherited |
Return a dynamically allocated copy of the shape.
copy | of the shape |
Reimplemented in SHAPE_POLY_SET, SHAPE_LINE_CHAIN, SHAPE_ARC, SHAPE_RECT, SHAPE_SIMPLE, SHAPE_CIRCLE, SHAPE_SEGMENT, SHAPE_COMPOUND, and SHAPE_NULL.
Definition at line 139 of file shape.h.
Referenced by PNS::ROUTER::markViolations(), ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM(), PNS::SOLID::SOLID(), and ROUTER_PREVIEW_ITEM::Update().
|
virtualinherited |
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_RECT, SHAPE_SEGMENT, and SHAPE_COMPOUND.
Definition at line 1103 of file shape_collisions.cpp.
References collideShapes().
|
virtualinherited |
Reimplemented in SHAPE_POLY_SET, SHAPE_ARC, SHAPE_RECT, SHAPE_SEGMENT, and SHAPE_COMPOUND.
Definition at line 1109 of file shape_collisions.cpp.
References collideShapes().
|
overridevirtual |
Check if point aP lies closer to us than aClearance.
aP | the point to check for collisions with |
aClearance | minimum distance that does not qualify as a collision. |
aActual | an optional pointer to an int to store the actual distance in the event of a collision. |
Reimplemented from SHAPE.
Reimplemented in SHAPE_LINE_CHAIN.
Definition at line 301 of file shape_line_chain.cpp.
References VECTOR2< T >::ECOORD_MAX, GetSegment(), GetSegmentCount(), IsClosed(), SEG::NearestPoint(), PointInside(), and SEG::Square().
Referenced by Collide().
|
overridevirtual |
Check if segment aSeg lies closer to us than aClearance.
aSeg | the segment to check for collisions with |
aClearance | minimum distance that does not qualify as a collision. |
aActual | an optional pointer to an int to store the actual distance in the event of a collision. |
Implements SHAPE.
Reimplemented in SHAPE_LINE_CHAIN, and SHAPE_SIMPLE.
Definition at line 437 of file shape_line_chain.cpp.
References SEG::A, VECTOR2< T >::ECOORD_MAX, GetSegment(), GetSegmentCount(), IsClosed(), SEG::NearestPoint(), PointInside(), SEG::Square(), and SEG::SquaredDistance().
int SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint | ( | const VECTOR2I & | aP, |
int | aAccuracy = 0 |
||
) | const |
Check if point aP lies on an edge or vertex of the line chain.
aP | point to check |
Definition at line 1593 of file shape_line_chain.cpp.
References SEG::A, SEG::B, SEG::Distance(), GetPoint(), GetPointCount(), GetSegment(), GetSegmentCount(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by PointOnEdge().
|
virtualinherited |
Reimplemented in SHAPE_POLY_SET, SHAPE_LINE_CHAIN, SHAPE_RECT, SHAPE_SEGMENT, and SHAPE_COMPOUND.
Definition at line 35 of file shape.cpp.
Referenced by SHAPE_FILE_IO::Write().
|
inlinevirtual |
Reimplemented in SHAPE_LINE_CHAIN.
Definition at line 312 of file shape.h.
Referenced by PointInside().
|
inlinevirtualinherited |
Reimplemented in SHAPE_POLY_SET, and SHAPE_COMPOUND.
|
inlinevirtualinherited |
Reimplemented in SHAPE_POLY_SET, and SHAPE_COMPOUND.
Definition at line 106 of file shape.h.
Referenced by SHAPE_COMPOUND::AddShape(), and ROUTER_PREVIEW_ITEM::ViewDraw().
|
pure virtual |
Implemented in SHAPE_LINE_CHAIN, SHAPE_SIMPLE, and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI.
Referenced by Collide(), EdgeContainingPoint(), and PointInside().
|
pure virtual |
Implemented in SHAPE_LINE_CHAIN, SHAPE_SIMPLE, and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI.
Referenced by Collide(), EdgeContainingPoint(), and PointInside().
|
pure virtual |
Implemented in SHAPE_LINE_CHAIN, SHAPE_SIMPLE, and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI.
Referenced by Collide(), Collide(), ROUTER_PREVIEW_ITEM::drawLineChain(), EdgeContainingPoint(), and SquaredDistance().
|
pure virtual |
Implemented in SHAPE_LINE_CHAIN, SHAPE_SIMPLE, and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI.
Referenced by Collide(), Collide(), ROUTER_PREVIEW_ITEM::drawLineChain(), EdgeContainingPoint(), and SquaredDistance().
|
inlinevirtualinherited |
Reimplemented in SHAPE_POLY_SET, and SHAPE_COMPOUND.
Definition at line 99 of file shape.h.
Referenced by SHAPE_COMPOUND::AddShape(), and ROUTER_PREVIEW_ITEM::ViewDraw().
|
pure virtual |
Implemented in SHAPE_LINE_CHAIN, SHAPE_SIMPLE, and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI.
Referenced by Collide(), Collide(), ROUTER_PREVIEW_ITEM::drawLineChain(), PointInside(), and SquaredDistance().
|
inlineinherited |
Return true if the shape is a null shape.
true | if null :-) |
Definition at line 150 of file shape.h.
References SHAPE_BASE::m_type, and SH_NULL.
|
pure virtualinherited |
Implemented in SHAPE_POLY_SET, SHAPE_LINE_CHAIN, SHAPE_SIMPLE, SHAPE_RECT, SHAPE_ARC, SHAPE_SEGMENT, SHAPE_CIRCLE, SHAPE_COMPOUND, SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI, and SHAPE_NULL.
|
pure virtualinherited |
Implemented in SHAPE_POLY_SET, SHAPE_LINE_CHAIN, SHAPE_ARC, SHAPE_SIMPLE, SHAPE_SEGMENT, SHAPE_RECT, SHAPE_CIRCLE, SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI, SHAPE_COMPOUND, and SHAPE_NULL.
Referenced by PNS::SOLID::SetPos().
|
inherited |
Definition at line 695 of file wrlfacet.cpp.
References SHAPE::facets.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
|
virtualinherited |
Reimplemented in SHAPE_POLY_SET, and SHAPE_LINE_CHAIN.
bool SHAPE_LINE_CHAIN_BASE::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.
For closed shapes only.
aPt | point to check |
aUseBBoxCache | gives better performance if the bounding box caches have been generated. |
Definition at line 1535 of file shape_line_chain.cpp.
References GetCachedBBox(), GetPoint(), GetPointCount(), IsClosed(), PointOnEdge(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Collide(), SHAPE_LINE_CHAIN::Collide(), Collide(), POLY_GRID_PARTITION::containsPoint(), SHAPE_POLY_SET::containsSingle(), ZONE::HitTestCutout(), MARKER_BASE::HitTestMarker(), DRC_RTREE::QueryColliding(), SquaredDistance(), and PNS::LINE::Walkaround().
bool SHAPE_LINE_CHAIN_BASE::PointOnEdge | ( | const VECTOR2I & | aP, |
int | aAccuracy = 0 |
||
) | const |
Check if point aP lies on an edge or vertex of the line chain.
aP | point to check |
Definition at line 1587 of file shape_line_chain.cpp.
References EdgeContainingPoint().
Referenced by FABMASTER::loadZones(), PointInside(), and PNS::LINE::Walkaround().
|
pure virtualinherited |
aCenter | is the rotation center. |
aAngle | rotation angle in radians. |
Implemented in SHAPE_POLY_SET, SHAPE_LINE_CHAIN, SHAPE_ARC, SHAPE_SIMPLE, SHAPE_RECT, SHAPE_SEGMENT, SHAPE_CIRCLE, SHAPE_COMPOUND, SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI, and SHAPE_NULL.
SEG::ecoord SHAPE_LINE_CHAIN_BASE::SquaredDistance | ( | const VECTOR2I & | aP, |
bool | aOutlineOnly = false |
||
) | const |
Definition at line 804 of file shape_line_chain.cpp.
References VECTOR2< T >::ECOORD_MAX, GetSegment(), GetSegmentCount(), IsClosed(), PointInside(), and SEG::SquaredDistance().
Referenced by SHAPE_LINE_CHAIN::Distance().
|
inlineinherited |
Return the type of the shape.
the | type |
Definition at line 94 of file shape.h.
References SHAPE_BASE::m_type.
Referenced by PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::buildHullForPrimitiveShape(), Collide(), SHAPE_POLY_SET::Collide(), collideShapes(), collideSingleShapes(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS::SOLID::HoleHull(), PNS::SOLID::Hull(), and SHAPE_FILE_IO::Write().
|
protectedinherited |
< type of our shape
Definition at line 110 of file shape.h.
Referenced by SHAPE::IsNull(), and SHAPE_BASE::Type().
|
staticinherited |
This is the minimum precision for all the points in a shape.
Definition at line 122 of file shape.h.
Referenced by BOOST_AUTO_TEST_CASE(), DIRECTION_45::BuildInitialTrace(), CompareLength(), CIRCLE::Contains(), EDIT_TOOL::FilletTracks(), and CIRCLE::IntersectLine().