KiCad PCB EDA Suite
|
#include <shape_poly_set.h>
Public Member Functions | |
TRI (int _a=0, int _b=0, int _c=0, TRIANGULATED_POLYGON *aParent=nullptr) | |
virtual void | Rotate (const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override |
virtual void | Move (const VECTOR2I &aVector) override |
virtual bool | IsSolid () const override |
virtual bool | IsClosed () const override |
virtual const BOX2I | BBox (int aClearance=0) const override |
Compute a bounding box of the shape, with a margin of aClearance a collision. | |
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 |
double | Area () const |
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. | |
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. | |
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 |
SEG::ecoord | SquaredDistance (const VECTOR2I &aP, bool aOutlineOnly=false) const override |
bool | PointInside (const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override |
Check if point aP lies inside a closed shape. | |
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 |
void | TransformToPolygon (SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override |
Fills a SHAPE_POLY_SET with a polygon representation of this shape. | |
virtual SHAPE * | Clone () const |
Return a dynamically allocated copy of the shape. | |
int | GetClearance (const SHAPE *aOther) const |
Return the actual minimum distance between two shapes. | |
bool | IsNull () const |
Return true if the shape is a null shape. | |
virtual VECTOR2I | Centre () const |
Compute a center-of-mass of the shape. | |
virtual int | Distance (const VECTOR2I &aP) const |
Returns the minimum distance from a given point to this shape. | |
bool | NearestPoints (const SHAPE *aOther, VECTOR2I &aPtThis, VECTOR2I &aPtOther) const |
Return the two points that mark the closest distance between this shape and aOther. | |
virtual VECTOR2I | GetStart () const |
virtual VECTOR2I | GetEnd () const |
virtual int | GetWidth () const |
virtual void | SetWidth (int aWidth) |
virtual bool | Parse (std::stringstream &aStream) |
virtual const std::string | Format (bool aCplusPlus=true) 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. | |
wxString | TypeName () const |
virtual bool | HasIndexableSubshapes () const |
virtual size_t | GetIndexableSubshapeCount () const |
virtual void | GetIndexableSubshapes (std::vector< const SHAPE * > &aSubshapes) const |
Public Attributes | |
int | a |
int | b |
int | c |
TRIANGULATED_POLYGON * | parent |
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 |
Protected Attributes | |
SHAPE_TYPE | m_type |
< type of our shape | |
Private Attributes | |
std::list< FACET * > | facets |
Definition at line 78 of file shape_poly_set.h.
|
protectedinherited |
|
inline |
Definition at line 80 of file shape_poly_set.h.
References a, b, c, parent, SH_POLY_SET_TRIANGLE, SHAPE_LINE_CHAIN_BASE::SHAPE_LINE_CHAIN_BASE(), and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRIANGULATED_POLYGON().
|
inline |
Definition at line 125 of file shape_poly_set.h.
References a, std::abs(), b, c, VECTOR2< T >::Cross(), and parent.
|
overridevirtual |
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. |
Implements SHAPE.
Definition at line 3214 of file shape_poly_set.cpp.
References a, b, c, BOX2< Vec >::Inflate(), BOX2< Vec >::Merge(), and parent.
|
inherited |
Definition at line 703 of file wrlfacet.cpp.
References IFSG_NODE::AddChildNode(), IFSG_INDEX::AddIndex(), IFSG_NODE::AddRefNode(), 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 232 of file shape.h.
References BBox(), and BOX2< Vec >::Centre().
Referenced by PCB_CONTROL::ApplyDesignBlockLayout(), PNS::TOPOLOGY::AssembleDiffPair(), Collide(), and pickSegment().
|
inlinevirtualinherited |
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.
Definition at line 148 of file shape.h.
References SHAPE().
Referenced by PNS_TEST_DEBUG_DECORATOR::AddItem(), PNS_TEST_DEBUG_DECORATOR::AddShape(), PNS::SOLID::operator=(), 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 | [out] 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.
Definition at line 1195 of file shape_collisions.cpp.
References collideShapes(), and SHAPE().
|
virtualinherited |
Reimplemented in SHAPE_ARC, SHAPE_COMPOUND, SHAPE_POLY_SET, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 1201 of file shape_collisions.cpp.
References collideShapes(), and SHAPE().
|
overridevirtualinherited |
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 754 of file shape_line_chain.cpp.
References SEG::A, VECTOR2< int32_t >::ECOORD_MAX, GetSegment(), GetSegmentCount(), IsClosed(), SEG::NearestPoint(), PointInside(), SEG::Square(), and SEG::SquaredDistance().
|
overridevirtualinherited |
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 366 of file shape_line_chain.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, GetSegment(), GetSegmentCount(), IsClosed(), SEG::NearestPoint(), PointInside(), and SEG::Square().
Referenced by Collide().
|
virtualinherited |
Returns the minimum distance from a given point to this shape.
Always returns zero if the point is inside a closed shape and aOutlineOnly is false.
aP | is the point to test |
Reimplemented in SHAPE_COMPOUND, and SHAPE_LINE_CHAIN.
Definition at line 109 of file shape.cpp.
References SquaredDistance().
|
inherited |
Check if point aP lies on an edge or vertex of the line chain.
aP | point to check |
Definition at line 1961 of file shape_line_chain.cpp.
References SEG::A, SEG::B, GetPoint(), GetPointCount(), GetSegment(), GetSegmentCount(), SEG::SquaredDistance(), and VECTOR2< T >::SquaredDistance().
Referenced by PointOnEdge().
|
virtualinherited |
Reimplemented in SHAPE_CIRCLE, SHAPE_COMPOUND, SHAPE_LINE_CHAIN, SHAPE_POLY_SET, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 47 of file shape.cpp.
References SHAPE_BASE::m_type.
Referenced by PNS::VIA::Format(), SHAPE_CIRCLE::Format(), SHAPE_SEGMENT::Format(), and SHAPE_FILE_IO::Write().
|
inlinevirtualinherited |
Reimplemented in SHAPE_LINE_CHAIN.
Definition at line 368 of file shape.h.
Referenced by PointInside().
|
inherited |
Return the actual minimum distance between two shapes.
distance | in IU |
POLY_SETs contain a bunch of polygons that are triangulated. But there are way more triangles than necessary for collision detection. Triangles check three vertices each but for the outline, we only need one. These are also fractured, so we don't need to worry about holes
Definition at line 55 of file shape.cpp.
References SHAPE_POLY_SET::COutline(), SHAPE_BASE::GetIndexableSubshapeCount(), SHAPE_BASE::GetIndexableSubshapes(), SHAPE_POLY_SET::OutlineCount(), SH_POLY_SET, SHAPE(), and SHAPE_BASE::Type().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
Definition at line 113 of file shape.h.
Referenced by SHAPE::GetClearance().
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
Definition at line 115 of file shape.h.
Referenced by SHAPE_COMPOUND::AddShape(), and SHAPE::GetClearance().
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 100 of file shape_poly_set.h.
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 122 of file shape_poly_set.h.
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 111 of file shape_poly_set.h.
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 123 of file shape_poly_set.h.
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.
Definition at line 286 of file shape.h.
Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 289 of file shape.h.
Referenced by SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN().
|
inlinevirtualinherited |
Reimplemented in SHAPE_COMPOUND, and SHAPE_POLY_SET.
|
inlineoverridevirtual |
Implements SHAPE_LINE_CHAIN_BASE.
Definition at line 96 of file shape_poly_set.h.
|
inlineinherited |
Return true if the shape is a null shape.
true | if null :-) |
Definition at line 166 of file shape.h.
References SHAPE_BASE::m_type, and SH_NULL.
|
inlineoverridevirtual |
Implements SHAPE.
Definition at line 94 of file shape_poly_set.h.
|
inlineoverridevirtual |
Implements SHAPE.
Definition at line 92 of file shape_poly_set.h.
|
inherited |
Return the two points that mark the closest distance between this shape and aOther.
Public interface for finding nearest points between two shapes.
If the shapes are overlapping, the points will be the same.
aOther | the other shape to compare with |
aPtThis | [out] the point on this shape closest to aOther |
aPtOther | [out] the point on aOther closest to this shape |
aA | first shape |
aB | second shape |
aPtA | [out] nearest point on first shape |
aPtB | [out] nearest point on second shape |
Definition at line 911 of file shape_nearest_points.cpp.
References nearestPoints(), and SHAPE().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inherited |
Definition at line 695 of file wrlfacet.cpp.
References facets.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
|
virtualinherited |
Reimplemented in SHAPE_LINE_CHAIN, and SHAPE_POLY_SET.
|
overridevirtualinherited |
Check if point aP lies inside a closed shape.
Always returns false if this shape is not closed.
aPt | point to check |
aUseBBoxCache | gives better performance if the bounding box caches have been generated. |
Reimplemented from SHAPE.
Definition at line 1904 of file shape_line_chain.cpp.
References GetCachedBBox(), GetPoint(), GetPointCount(), IsClosed(), PointOnEdge(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by BuildBoardPolygonOutlines(), buildContourHierarchy(), Collide(), Collide(), Collide(), Collide(), Collide(), SHAPE_LINE_CHAIN::Collide(), SHAPE_LINE_CHAIN::Collide(), Collide(), Collide(), SHAPE_POLY_SET::containsSingle(), PCB_TUNING_PATTERN::EditFinish(), BOARD::GetBoardPolygonOutlines(), ZONE::HitTest(), MARKER_BASE::HitTestMarker(), CONNECTIVITY_DATA::IsConnectedOnLayer(), PNS::SHOVE::onReverseCollidingVia(), SHAPE::PointInside(), SHAPE_POLY_SET::RebuildHolesFromContours(), KIGEOM::RectifyPolygon(), SCH_SELECTION_TOOL::SelectMultiple(), PNS::SHOVE::shoveLineToHullSet(), SquaredDistance(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer(), and PNS::LINE::Walkaround().
|
inherited |
Check if point aP lies on an edge or vertex of the line chain.
aP | point to check |
Definition at line 1955 of file shape_line_chain.cpp.
References EdgeContainingPoint().
Referenced by getPNSLine(), FABMASTER::loadZones(), PointInside(), PNS::LINE_PLACER::splitHeadTail(), and PNS::LINE::Walkaround().
|
inlineoverridevirtual |
aCenter | is the rotation center. |
aAngle | rotation angle. |
Implements SHAPE.
Definition at line 89 of file shape_poly_set.h.
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, SHAPE_LINE_CHAIN, and SHAPE_SEGMENT.
|
overridevirtualinherited |
Reimplemented from SHAPE.
Definition at line 1160 of file shape_line_chain.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, GetSegment(), GetSegmentCount(), IsClosed(), PointInside(), and SquaredDistance().
Referenced by SHAPE_LINE_CHAIN::Distance(), SHAPE::SquaredDistance(), and SquaredDistance().
|
inlineoverridevirtualinherited |
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
aBuffer | [out] will be filled with the polygonal representation of this shape. |
aError | controls the maximum allowed deviation when converting rounded shapes to segments |
aErrorLoc | controls where the error is placed when approximating rounded shapes |
Implements SHAPE.
Reimplemented in SHAPE_SIMPLE.
|
inlineinherited |
Return the type of the shape.
the | type |
Definition at line 98 of file shape.h.
References m_type.
Referenced by CREEPAGE_GRAPH::Addshape(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::BuildHullForPrimitiveShape(), PNS_LOG_VIEWER_FRAME::buildListTree(), Collide(), SHAPE_POLY_SET::Collide(), collideShapes(), collideSingleShapes(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS_LOG_VIEWER_FRAME::drawSimpleShape(), EDA_SHAPE::EDA_SHAPE(), SHAPE::GetClearance(), nearestPoints(), nearestPointsSingleShapes(), DRC_RTREE::QueryColliding(), STROKE_PARAMS::Stroke(), and SHAPE_FILE_IO::Write().
|
inlineinherited |
int SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI::a |
Definition at line 137 of file shape_poly_set.h.
Referenced by Area(), BBox(), GetPoint(), GetSegment(), and TRI().
int SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI::b |
Definition at line 138 of file shape_poly_set.h.
Referenced by Area(), BBox(), GetPoint(), GetSegment(), and TRI().
int SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI::c |
Definition at line 139 of file shape_poly_set.h.
Referenced by Area(), BBox(), GetPoint(), GetSegment(), and TRI().
|
privateinherited |
Definition at line 143 of file wrlfacet.h.
Referenced by CalcShape(), and NewFacet().
|
protectedinherited |
< type of our shape
Definition at line 119 of file shape.h.
Referenced by SHAPE::Format(), SHAPE::IsNull(), SHAPE_BASE(), Type(), and TypeName().
|
staticinherited |
This is the minimum precision for all the points in a shape.
Definition at line 131 of file shape.h.
Referenced by DIRECTION_45::BuildInitialTrace(), CompareLength(), CIRCLE::Contains(), EDIT_TOOL::FilletTracks(), CIRCLE::IntersectLine(), and LINE_FILLET_ROUTINE::ProcessLinePair().
TRIANGULATED_POLYGON* SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI::parent |
Definition at line 140 of file shape_poly_set.h.
Referenced by Area(), BBox(), GetPoint(), GetSegment(), and TRI().