![]() |
KiCad PCB EDA Suite
|
Represent a set of closed polygons. More...
#include <shape_poly_set.h>
Classes | |
class | ITERATOR_TEMPLATE |
Base class for iterating over all vertices in a given SHAPE_POLY_SET. More... | |
class | SEGMENT_ITERATOR_TEMPLATE |
Base class for iterating over all segments in a given SHAPE_POLY_SET. More... | |
class | TRIANGULATED_POLYGON |
struct | VERTEX_INDEX |
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: the polygon index, the contour index relative to the polygon and the vertex index relative the contour. More... | |
Public Types | |
enum | POLYGON_MODE { PM_FAST = true, PM_STRICTLY_SIMPLE = false } |
Operations on polygons use a aFastMode param if aFastMode is PM_FAST (true) the result can be a weak polygon if aFastMode is PM_STRICTLY_SIMPLE (false) (default) the result is (theoretically) a strictly simple polygon, but calculations can be really significantly time consuming Most of time PM_FAST is preferable. More... | |
enum | CORNER_STRATEGY { ALLOW_ACUTE_CORNERS, CHAMFER_ACUTE_CORNERS, ROUND_ACUTE_CORNERS, CHAMFER_ALL_CORNERS, ROUND_ALL_CORNERS } |
< define how inflate transform build inflated polygon More... | |
typedef std::vector< SHAPE_LINE_CHAIN > | POLYGON |
< represents a single polygon outline with holes. More... | |
typedef ITERATOR_TEMPLATE< VECTOR2I > | ITERATOR |
typedef ITERATOR_TEMPLATE< const VECTOR2I > | CONST_ITERATOR |
typedef SEGMENT_ITERATOR_TEMPLATE< SEG > | SEGMENT_ITERATOR |
typedef SEGMENT_ITERATOR_TEMPLATE< const SEG > | CONST_SEGMENT_ITERATOR |
Public Member Functions | |
SHAPE_POLY_SET () | |
SHAPE_POLY_SET (const BOX2D &aRect) | |
SHAPE_POLY_SET (const SHAPE_LINE_CHAIN &aOutline) | |
Construct a SHAPE_POLY_SET with the first outline given by aOutline. More... | |
SHAPE_POLY_SET (const SHAPE_POLY_SET &aOther) | |
Copy constructor SHAPE_POLY_SET Performs a deep copy of aOther into this . More... | |
~SHAPE_POLY_SET () | |
SHAPE_POLY_SET & | operator= (const SHAPE_POLY_SET &aOther) |
void | CacheTriangulation (bool aPartition=true) |
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations. More... | |
bool | IsTriangulationUpToDate () const |
MD5_HASH | GetHash () const |
virtual bool | HasIndexableSubshapes () const override |
virtual size_t | GetIndexableSubshapeCount () const override |
virtual void | GetIndexableSubshapes (std::vector< SHAPE * > &aSubshapes) override |
bool | GetRelativeIndices (int aGlobalIdx, VERTEX_INDEX *aRelativeIndices) const |
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated list of all vertices in all contours— and get the index of the vertex relative to the contour relative to the polygon in which it is. More... | |
bool | GetGlobalIndex (VERTEX_INDEX aRelativeIndices, int &aGlobalIdx) const |
Compute the global index of a vertex from the relative indices of polygon, contour and vertex. More... | |
SHAPE * | Clone () const override |
Return a dynamically allocated copy of the shape. More... | |
int | NewOutline () |
Creates a new hole in a given outline. More... | |
int | NewHole (int aOutline=-1) |
Adds a new outline to the set and returns its index. More... | |
int | AddOutline (const SHAPE_LINE_CHAIN &aOutline) |
Adds a new hole to the given outline (default: last) and returns its index. More... | |
int | AddHole (const SHAPE_LINE_CHAIN &aHole, int aOutline=-1) |
Return the area of this poly set. More... | |
double | Area () |
Count the number of arc shapes present. More... | |
int | ArcCount () const |
Appends all the arcs in this polyset to aArcBuffer. More... | |
void | GetArcs (std::vector< SHAPE_ARC > &aArcBuffer) const |
Removes all arc references from all the outlines and holes in the polyset. More... | |
void | ClearArcs () |
Appends a vertex at the end of the given outline/hole (default: the last outline) More... | |
int | Append (int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false) |
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last polygon). More... | |
void | Append (const SHAPE_POLY_SET &aSet) |
Append a vertex at the end of the given outline/hole (default: the last outline) More... | |
void | Append (const VECTOR2I &aP, int aOutline=-1, int aHole=-1) |
int | Append (SHAPE_ARC &aArc, int aOutline=-1, int aHole=-1) |
Append a new arc to the contour indexed by aOutline and aHole (defaults to the outline of the last polygon). More... | |
void | InsertVertex (int aGlobalIndex, const VECTOR2I &aNewVertex) |
Adds a vertex in the globally indexed position aGlobalIndex. More... | |
const VECTOR2I & | CVertex (int aIndex, int aOutline, int aHole) const |
Return the aGlobalIndex-th vertex in the poly set. More... | |
const VECTOR2I & | CVertex (int aGlobalIndex) const |
Return the index-th vertex in a given hole outline within a given outline. More... | |
const VECTOR2I & | CVertex (VERTEX_INDEX aIndex) const |
bool | GetNeighbourIndexes (int aGlobalIndex, int *aPrevious, int *aNext) |
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a contour in the polygon set. More... | |
bool | IsPolygonSelfIntersecting (int aPolygonIndex) const |
Check whether the aPolygonIndex-th polygon in the set is self intersecting. More... | |
bool | IsSelfIntersecting () const |
Check whether any of the polygons in the set is self intersecting. More... | |
unsigned int | TriangulatedPolyCount () const |
Return the number of outlines in the set. More... | |
int | OutlineCount () const |
Return the number of vertices in a given outline/hole. More... | |
int | VertexCount (int aOutline=-1, int aHole=-1) const |
Return the number of points in the shape poly set. More... | |
int | FullPointCount () const |
Returns the number of holes in a given outline. More... | |
int | HoleCount (int aOutline) const |
Return the reference to aIndex-th outline in the set. More... | |
SHAPE_LINE_CHAIN & | Outline (int aIndex) |
const SHAPE_LINE_CHAIN & | Outline (int aIndex) const |
SHAPE_POLY_SET | Subset (int aFirstPolygon, int aLastPolygon) |
Return a subset of the polygons in this set, the ones between aFirstPolygon and aLastPolygon. More... | |
SHAPE_POLY_SET | UnitSet (int aPolygonIndex) |
Return the reference to aHole-th hole in the aIndex-th outline. More... | |
SHAPE_LINE_CHAIN & | Hole (int aOutline, int aHole) |
Return the aIndex-th subpolygon in the set. More... | |
POLYGON & | Polygon (int aIndex) |
const POLYGON & | Polygon (int aIndex) const |
const TRIANGULATED_POLYGON * | TriangulatedPolygon (int aIndex) const |
const SHAPE_LINE_CHAIN & | COutline (int aIndex) const |
const SHAPE_LINE_CHAIN & | CHole (int aOutline, int aHole) const |
const POLYGON & | CPolygon (int aIndex) const |
ITERATOR | Iterate (int aFirst, int aLast, bool aIterateHoles=false) |
Return an object to iterate through the points of the polygons between aFirst and aLast . More... | |
ITERATOR | Iterate (int aOutline) |
ITERATOR | IterateWithHoles (int aOutline) |
ITERATOR | Iterate () |
ITERATOR | IterateWithHoles () |
CONST_ITERATOR | CIterate (int aFirst, int aLast, bool aIterateHoles=false) const |
CONST_ITERATOR | CIterate (int aOutline) const |
CONST_ITERATOR | CIterateWithHoles (int aOutline) const |
CONST_ITERATOR | CIterate () const |
CONST_ITERATOR | CIterateWithHoles () const |
ITERATOR | IterateFromVertexWithHoles (int aGlobalIdx) |
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (default: without) More... | |
SEGMENT_ITERATOR | IterateSegments (int aFirst, int aLast, bool aIterateHoles=false) |
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (default: without) More... | |
CONST_SEGMENT_ITERATOR | CIterateSegments (int aFirst, int aLast, bool aIterateHoles=false) const |
Return an iterator object, for iterating aPolygonIdx-th polygon edges. More... | |
SEGMENT_ITERATOR | IterateSegments (int aPolygonIdx) |
Return an iterator object, for iterating aPolygonIdx-th polygon edges. More... | |
CONST_SEGMENT_ITERATOR | CIterateSegments (int aPolygonIdx) const |
Return an iterator object, for all outlines in the set (no holes). More... | |
SEGMENT_ITERATOR | IterateSegments () |
Returns an iterator object, for all outlines in the set (no holes) More... | |
CONST_SEGMENT_ITERATOR | CIterateSegments () const |
Returns an iterator object, for all outlines in the set (with holes) More... | |
SEGMENT_ITERATOR | IterateSegmentsWithHoles () |
Return an iterator object, for the aOutline-th outline in the set (with holes). More... | |
SEGMENT_ITERATOR | IterateSegmentsWithHoles (int aOutline) |
Return an iterator object, for the aOutline-th outline in the set (with holes). More... | |
CONST_SEGMENT_ITERATOR | CIterateSegmentsWithHoles () const |
Return an iterator object, for the aOutline-th outline in the set (with holes). More... | |
CONST_SEGMENT_ITERATOR | CIterateSegmentsWithHoles (int aOutline) const |
void | BooleanAdd (const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode) |
Perform boolean polyset difference For aFastMode meaning, see function booleanOp. More... | |
void | BooleanSubtract (const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode) |
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp. More... | |
void | BooleanIntersection (const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode) |
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning, see function booleanOp. More... | |
void | BooleanAdd (const SHAPE_POLY_SET &a, const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode) |
Perform boolean polyset difference between a and b, store the result in it self For aFastMode meaning, see function booleanOp. More... | |
void | BooleanSubtract (const SHAPE_POLY_SET &a, const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode) |
Perform boolean polyset intersection between a and b, store the result in it self For aFastMode meaning, see function booleanOp. More... | |
void | BooleanIntersection (const SHAPE_POLY_SET &a, const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode) |
void | Inflate (int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS) |
Perform outline inflation/deflation. More... | |
void | Deflate (int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS) |
void | InflateWithLinkedHoles (int aFactor, int aCircleSegmentsCount, POLYGON_MODE aFastMode) |
Perform outline inflation/deflation, using round corners. More... | |
void | Fracture (POLYGON_MODE aFastMode) |
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes. More... | |
void | Unfracture (POLYGON_MODE aFastMode) |
Return true if the polygon set has any holes. More... | |
bool | HasHoles () const |
Return true if the polygon set has any holes that share a vertex. More... | |
bool | HasTouchingHoles () const |
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFastMode meaning, see function booleanOp. More... | |
void | Simplify (POLYGON_MODE aFastMode) |
int | NormalizeAreaOutlines () |
Convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s). More... | |
const std::string | Format () const override |
bool | Parse (std::stringstream &aStream) override |
void | Move (const VECTOR2I &aVector) override |
void | Mirror (bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 }) |
Mirror the line points about y or x (or both) More... | |
void | Rotate (double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override |
Rotate all vertices by a given angle. More... | |
bool | IsSolid () const override |
const BOX2I | BBox (int aClearance=0) const override |
Compute a bounding box of the shape, with a margin of aClearance a collision. More... | |
bool | PointOnEdge (const VECTOR2I &aP) const |
Check if point aP lies on an edge or vertex of some of the outlines or holes. More... | |
bool | Collide (const SHAPE *aShape, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision. More... | |
bool | Collide (const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
Check whether the point aP is either inside or on the edge of the polygon set. More... | |
bool | Collide (const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override |
Check whether the segment aSeg collides with the polygon set (or its edge). More... | |
bool | CollideVertex (const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const |
Check whether aPoint collides with any vertex of any of the contours of the polygon. More... | |
bool | CollideEdge (const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const |
Check whether aPoint collides with any edge of any of the contours of the polygon. More... | |
void | BuildBBoxCaches () const |
Construct BBoxCaches for Contains(), below. More... | |
const BOX2I | BBoxFromCaches () const |
bool | Contains (const VECTOR2I &aP, int aSubpolyIndex=-1, int aAccuracy=0, bool aUseBBoxCaches=false) const |
Return true if a given subpolygon contains the point aP. More... | |
bool | IsEmpty () const |
void | RemoveVertex (int aGlobalIndex) |
Delete the aGlobalIndex-th vertex. More... | |
void | RemoveVertex (VERTEX_INDEX aRelativeIndices) |
Delete the vertex indexed by aRelativeIndex (index of polygon, contour and vertex). More... | |
void | RemoveAllContours () |
void | RemoveContour (int aContourIdx, int aPolygonIdx=-1) |
Delete the aContourIdx-th contour of the aPolygonIdx-th polygon in the set. More... | |
int | RemoveNullSegments () |
Look for null segments; ie, segments whose ends are exactly the same and deletes them. More... | |
void | SetVertex (const VERTEX_INDEX &aIndex, const VECTOR2I &aPos) |
Accessor function to set the position of a specific point. More... | |
void | SetVertex (int aGlobalIndex, const VECTOR2I &aPos) |
Set the vertex based on the global index. More... | |
int | TotalVertices () const |
Delete aIdx-th polygon from the set. More... | |
void | DeletePolygon (int aIdx) |
POLYGON | ChamferPolygon (unsigned int aDistance, int aIndex) |
Return a chamfered version of the aIndex-th polygon. More... | |
POLYGON | FilletPolygon (unsigned int aRadius, int aErrorMax, int aIndex) |
Return a filleted version of the aIndex-th polygon. More... | |
SHAPE_POLY_SET | Chamfer (int aDistance) |
Return a chamfered version of the polygon set. More... | |
SHAPE_POLY_SET | Fillet (int aRadius, int aErrorMax) |
Return a filleted version of the polygon set. More... | |
SEG::ecoord | SquaredDistanceToPolygon (VECTOR2I aPoint, int aIndex, VECTOR2I *aNearest) const |
Compute the minimum distance between the aIndex-th polygon and aPoint. More... | |
SEG::ecoord | SquaredDistanceToPolygon (const SEG &aSegment, int aIndex, VECTOR2I *aNearest) const |
Compute the minimum distance between the aIndex-th polygon and aSegment with a possible width. More... | |
SEG::ecoord | SquaredDistance (VECTOR2I aPoint, VECTOR2I *aNearest=nullptr) const |
Compute the minimum distance squared between aPoint and all the polygons in the set. More... | |
SEG::ecoord | SquaredDistance (const SEG &aSegment, VECTOR2I *aNearest=nullptr) const |
Compute the minimum distance squared between aSegment and all the polygons in the set. More... | |
bool | IsVertexInHole (int aGlobalIdx) |
Check whether the aGlobalIndex-th vertex belongs to a hole. 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 VECTOR2I | Centre () const |
Compute a center-of-mass of the shape. More... | |
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... | |
Static Public Member Functions | |
static const SHAPE_POLY_SET | BuildPolysetFromOrientedPaths (const std::vector< SHAPE_LINE_CHAIN > &aPaths, bool aReverseOrientation=false, bool aEvenOdd=false) |
Build a SHAPE_POLY_SET from a bunch of outlines in provided in random order. More... | |
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... | |
Private Types | |
enum | CORNER_MODE { CHAMFERED, FILLETED } |
Operation ChamferPolygon and FilletPolygon are computed under the private chamferFillet method; this enum is defined to make the necessary distinction when calling this method from the public ChamferPolygon and FilletPolygon methods. More... | |
typedef std::vector< POLYGON > | POLYSET |
Private Member Functions | |
void | fractureSingle (POLYGON &paths) |
void | unfractureSingle (POLYGON &path) |
void | importTree (ClipperLib::PolyTree *tree, const std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, const std::vector< SHAPE_ARC > &aArcBuffe) |
void | booleanOp (ClipperLib::ClipType aType, const SHAPE_POLY_SET &aOtherShape, POLYGON_MODE aFastMode) |
This is the engine to execute all polygon boolean transforms (AND, OR, ... More... | |
void | booleanOp (ClipperLib::ClipType aType, const SHAPE_POLY_SET &aShape, const SHAPE_POLY_SET &aOtherShape, POLYGON_MODE aFastMode) |
bool | containsSingle (const VECTOR2I &aP, int aSubpolyIndex, int aAccuracy, bool aUseBBoxCaches=false) const |
Check whether the point aP is inside the aSubpolyIndex-th polygon of the polyset. More... | |
POLYGON | chamferFilletPolygon (CORNER_MODE aMode, unsigned int aDistance, int aIndex, int aErrorMax) |
Return the chamfered or filleted version of the aIndex-th polygon in the set, depending on the aMode selected. More... | |
bool | hasTouchingHoles (const POLYGON &aPoly) const |
MD5_HASH | checksum () const |
Private Attributes | |
POLYSET | m_polys |
std::vector< std::unique_ptr< TRIANGULATED_POLYGON > > | m_triangulatedPolys |
bool | m_triangulationValid = false |
MD5_HASH | m_hash |
Represent a set of closed polygons.
Polygons may be nonconvex, self-intersecting and have holes. Provides boolean operations (using Clipper library as the backend).
Let us define the terms used on this class to clarify methods names and comments:
TODO: add convex partitioning & spatial index
Definition at line 64 of file shape_poly_set.h.
typedef ITERATOR_TEMPLATE<const VECTOR2I> SHAPE_POLY_SET::CONST_ITERATOR |
Definition at line 473 of file shape_poly_set.h.
typedef SEGMENT_ITERATOR_TEMPLATE<const SEG> SHAPE_POLY_SET::CONST_SEGMENT_ITERATOR |
Definition at line 477 of file shape_poly_set.h.
|
protectedinherited |
Definition at line 472 of file shape_poly_set.h.
typedef std::vector<SHAPE_LINE_CHAIN> SHAPE_POLY_SET::POLYGON |
< represents a single polygon outline with holes.
The first entry is the outline, the remaining (if any), are the holes N.B. SWIG only supports typedef, so avoid c++ 'using' keyword
Definition at line 70 of file shape_poly_set.h.
|
private |
Definition at line 1448 of file shape_poly_set.h.
Definition at line 476 of file shape_poly_set.h.
|
private |
Operation ChamferPolygon and FilletPolygon are computed under the private chamferFillet method; this enum is defined to make the necessary distinction when calling this method from the public ChamferPolygon and FilletPolygon methods.
Enumerator | |
---|---|
CHAMFERED | |
FILLETED |
Definition at line 1420 of file shape_poly_set.h.
< define how inflate transform build inflated polygon
Definition at line 980 of file shape_poly_set.h.
Operations on polygons use a aFastMode param if aFastMode is PM_FAST (true) the result can be a weak polygon if aFastMode is PM_STRICTLY_SIMPLE (false) (default) the result is (theoretically) a strictly simple polygon, but calculations can be really significantly time consuming Most of time PM_FAST is preferable.
PM_STRICTLY_SIMPLE can be used in critical cases (Gerber output for instance)
Enumerator | |
---|---|
PM_FAST | |
PM_STRICTLY_SIMPLE |
Definition at line 947 of file shape_poly_set.h.
SHAPE_POLY_SET::SHAPE_POLY_SET | ( | ) |
SHAPE_POLY_SET::SHAPE_POLY_SET | ( | const BOX2D & | aRect | ) |
Definition at line 68 of file shape_poly_set.cpp.
References Append(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), NewOutline(), Outline(), and SHAPE_LINE_CHAIN::SetClosed().
SHAPE_POLY_SET::SHAPE_POLY_SET | ( | const SHAPE_LINE_CHAIN & | aOutline | ) |
Construct a SHAPE_POLY_SET with the first outline given by aOutline.
aOutline | is a closed outline |
Definition at line 80 of file shape_poly_set.cpp.
References AddOutline().
SHAPE_POLY_SET::SHAPE_POLY_SET | ( | const SHAPE_POLY_SET & | aOther | ) |
Copy constructor SHAPE_POLY_SET Performs a deep copy of aOther
into this
.
aOther | is the SHAPE_POLY_SET object that will be copied. |
Definition at line 87 of file shape_poly_set.cpp.
References GetHash(), IsTriangulationUpToDate(), m_hash, m_triangulatedPolys, m_triangulationValid, TriangulatedPolyCount(), and TriangulatedPolygon().
SHAPE_POLY_SET::~SHAPE_POLY_SET | ( | ) |
Definition at line 111 of file shape_poly_set.cpp.
int SHAPE_POLY_SET::AddHole | ( | const SHAPE_LINE_CHAIN & | aHole, |
int | aOutline = -1 |
||
) |
Return the area of this poly set.
Definition at line 494 of file shape_poly_set.cpp.
References m_polys.
Referenced by ZONE::AddPolygon(), BuildFootprintPolygonOutlines(), KI_TEST::BuildHollowSquare(), KI_TEST::CommonTestData::CommonTestData(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), FABMASTER::loadFootprints(), FABMASTER::loadShapePolySet(), FABMASTER::loadZone(), and ALTIUM_PCB::ParseRegions6Data().
int SHAPE_POLY_SET::AddOutline | ( | const SHAPE_LINE_CHAIN & | aOutline | ) |
Adds a new hole to the given outline (default: last) and returns its index.
Definition at line 480 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::IsClosed(), and m_polys.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), ZONE::AddPolygon(), BOOST_AUTO_TEST_CASE(), buildBoardBoundingBoxPoly(), KI_TEST::BuildHollowSquare(), KI_TEST::BuildPolyset(), KI_TEST::CommonTestData::CommonTestData(), ZONE_FILLER::computeRawFilledArea(), ConvertPolygonToBlocks(), FOOTPRINT::CoverageRatio(), CONVERT_TOOL::CreateLines(), BOARD_ADAPTER::createPadWithClearance(), KIGFX::GERBVIEW_PAINTER::draw(), GEOM_TEST::FilletPolySet(), FOOTPRINT::GetBoundingHull(), PNS::SOLID::HoleHull(), PNS::SOLID::Hull(), IteratorFixture::IteratorFixture(), DSN::SPECCTRA_DB::makeIMAGE(), CONVERT_TOOL::makePolysFromCircles(), CONVERT_TOOL::makePolysFromRects(), CONVERT_TOOL::makePolysFromSegs(), PAD::MergePrimitivesAsPolygon(), NormalizeAreaOutlines(), EAGLE_PLUGIN::packagePolygon(), ALTIUM_PCB::ParsePolygons6Data(), ALTIUM_PCB::ParseRegions6Data(), ALTIUM_PCB::ParseShapeBasedRegions6Data(), partitionPolyIntoRegularCellGrid(), ZONE_CREATE_HELPER::performZoneCutout(), PGPartitionFixture::PGPartitionFixture(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), PlotStandardLayer(), SHAPE_POLY_SET(), TestConcaveSquareFillet(), and TestSquareFillet().
int SHAPE_POLY_SET::Append | ( | int | x, |
int | y, | ||
int | aOutline = -1 , |
||
int | aHole = -1 , |
||
bool | aAllowDuplication = false |
||
) |
Add a new vertex to the contour indexed by aOutline
and aHole
(defaults to the outline of the last polygon).
x | is the x coordinate of the new vertex. |
y | is the y coordinate of the new vertex. |
aOutline | is the index of the polygon. |
aHole | is the index of the hole (-1 for the main outline), |
aAllowDuplication | is a flag to indicate whether it is allowed to add this corner even if it is duplicated. |
Definition at line 230 of file shape_poly_set.cpp.
References m_polys.
Referenced by AR_AUTOPLACER::addFpBody(), addHoleToPolygon(), ZONE_FILLER::addKnockout(), AR_AUTOPLACER::addPad(), PAD::AddPrimitivePoly(), Append(), ZONE::AppendCorner(), BuildBoardPolygonOutlines(), ZONE_FILLER::buildCopperItemClearances(), BuildFootprintPolygonOutlines(), ConvertOutlineToPolygon(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), D_CODE::ConvertShapeToPolygon(), CornerListToPolygon(), BITMAPCONV_INFO::createOutputData(), BOARD_ADAPTER::createPadWithClearance(), CONVERT_TOOL::CreatePolys(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), CONVERT_TOOL::extractPolygons(), fillArcPOLY(), PCB_BASE_FRAME::FocusOnItems(), FOOTPRINT::GetBoundingHull(), getRectangleAlongCentreLine(), EDA_SHAPE::hitTest(), InsertVertex(), FABMASTER::loadFootprints(), EAGLE_PLUGIN::loadPolygon(), FABMASTER::loadShapePolySet(), FABMASTER::loadZone(), LEGACY_PLUGIN::loadZONE_CONTAINER(), DSN::SPECCTRA_DB::makeIMAGE(), DXF_PLOTTER::PlotPoly(), PlotStandardLayer(), RENDER_3D_OPENGL::reload(), EDA_SHAPE::rotate(), KIGFX::PREVIEW::POLYGON_ITEM::SetPoints(), EDA_SHAPE::SetPolyPoints(), SHAPE_POLY_SET(), DS_DATA_ITEM_POLYGONS::SyncDrawItems(), TransformArcToPolygon(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), TransformCircleToPolygon(), TransformOvalToPolygon(), TransformRingToPolygon(), TransformRoundChamferedRectToPolygon(), FP_TEXT::TransformShapeWithClearanceToPolygon(), EDA_SHAPE::TransformShapeWithClearanceToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), TransformTrapezoidToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), and EE_POINT_EDITOR::updateParentItem().
void SHAPE_POLY_SET::Append | ( | const SHAPE_POLY_SET & | aSet | ) |
Append a vertex at the end of the given outline/hole (default: the last outline)
Definition at line 1642 of file shape_poly_set.cpp.
References m_polys.
void SHAPE_POLY_SET::Append | ( | const VECTOR2I & | aP, |
int | aOutline = -1 , |
||
int | aHole = -1 |
||
) |
Definition at line 1648 of file shape_poly_set.cpp.
References Append(), VECTOR2< T >::x, and VECTOR2< T >::y.
int SHAPE_POLY_SET::Append | ( | SHAPE_ARC & | aArc, |
int | aOutline = -1 , |
||
int | aHole = -1 |
||
) |
Append a new arc to the contour indexed by aOutline
and aHole
(defaults to the outline of the last polygon).
aArc | The arc to be inserted |
aOutline | Index of the polygon |
aHole | Index of the hole (-1 for the main outline) |
Definition at line 253 of file shape_poly_set.cpp.
References m_polys.
int SHAPE_POLY_SET::ArcCount | ( | ) | const |
Appends all the arcs in this polyset to aArcBuffer.
Definition at line 529 of file shape_poly_set.cpp.
References m_polys.
Referenced by booleanOp().
double SHAPE_POLY_SET::Area | ( | ) |
Count the number of arc shapes present.
Definition at line 513 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Area(), Hole(), HoleCount(), Outline(), and OutlineCount().
Referenced by BOOST_AUTO_TEST_CASE(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), and polygonArea().
|
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 1389 of file shape_poly_set.cpp.
References BOX2< Vec >::Inflate(), m_polys, and BOX2< Vec >::Merge().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), DRAWING_TOOL::DrawBoardCharacteristics(), PCB_BASE_FRAME::FocusOnItems(), APERTURE_MACRO::GetApertureMacroShape(), PAD::GetBestAnchorPosition(), ZONE::GetBoundingBox(), DS_DRAW_ITEM_POLYPOLYGONS::GetBoundingBox(), GERBER_DRAW_ITEM::GetBoundingBox(), DIALOG_PAD_PROPERTIES::padValuesOK(), partitionPolyIntoRegularCellGrid(), BOARD::TestZoneIntersection(), KIGFX::PREVIEW::POLYGON_ITEM::ViewBBox(), and KIGFX::PREVIEW::CENTRELINE_RECT_ITEM::ViewBBox().
const BOX2I SHAPE_POLY_SET::BBoxFromCaches | ( | ) | const |
Definition at line 1406 of file shape_poly_set.cpp.
References m_polys, and BOX2< Vec >::Merge().
Referenced by DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances().
void SHAPE_POLY_SET::BooleanAdd | ( | const SHAPE_POLY_SET & | b, |
POLYGON_MODE | aFastMode | ||
) |
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
Definition at line 678 of file shape_poly_set.cpp.
References booleanOp().
Referenced by PAD::addPadPrimitivesToPolygon(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), ZONE::BuildSmoothedPoly(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), ALTIUM_PCB::ParseRegions6Data(), DXF_PLOTTER::PlotPoly(), PlotSolderMaskLayer(), and ZONE::RemoveCutout().
void SHAPE_POLY_SET::BooleanAdd | ( | const SHAPE_POLY_SET & | a, |
const SHAPE_POLY_SET & | b, | ||
POLYGON_MODE | aFastMode | ||
) |
Perform boolean polyset difference between a and b, store the result in it self For aFastMode meaning, see function booleanOp.
Definition at line 696 of file shape_poly_set.cpp.
References booleanOp().
void SHAPE_POLY_SET::BooleanIntersection | ( | const SHAPE_POLY_SET & | b, |
POLYGON_MODE | aFastMode | ||
) |
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning, see function booleanOp.
Definition at line 690 of file shape_poly_set.cpp.
References booleanOp().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOOST_AUTO_TEST_CASE(), ZONE::BuildSmoothedPoly(), ZONE_FILLER::computeRawFilledArea(), ConvertPolygonToBlocks(), PCB_BASE_FRAME::FocusOnItems(), isCopperOutside(), PAD_TOOL::recombinePad(), RENDER_3D_OPENGL::reload(), and TransformOvalToPolygon().
void SHAPE_POLY_SET::BooleanIntersection | ( | const SHAPE_POLY_SET & | a, |
const SHAPE_POLY_SET & | b, | ||
POLYGON_MODE | aFastMode | ||
) |
Definition at line 710 of file shape_poly_set.cpp.
References booleanOp().
|
private |
This is the engine to execute all polygon boolean transforms (AND, OR, ...
and polygon simplification (merging overlapping polygons).
aType | is the transform type ( see ClipperLib::ClipType ) |
aOtherShape | is the SHAPE_LINE_CHAIN to combine with me. |
aFastMode | is an option to choose if the result can be a weak polygon or a strictly simple polygon. if aFastMode is PM_FAST the result can be a weak polygon if aFastMode is PM_STRICTLY_SIMPLE (default) the result is (theoretically) a strictly simple polygon, but calculations can be really significantly time consuming |
Definition at line 566 of file shape_poly_set.cpp.
Referenced by BooleanAdd(), BooleanIntersection(), BooleanSubtract(), and Simplify().
|
private |
Definition at line 573 of file shape_poly_set.cpp.
References ArcCount(), importTree(), CLIPPER_Z_VALUE::m_FirstArcIdx, m_polys, CLIPPER_Z_VALUE::m_SecondArcIdx, OutlineCount(), and PM_STRICTLY_SIMPLE.
void SHAPE_POLY_SET::BooleanSubtract | ( | const SHAPE_POLY_SET & | b, |
POLYGON_MODE | aFastMode | ||
) |
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
Definition at line 684 of file shape_poly_set.cpp.
References booleanOp().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), addHoleToPolygon(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), ZONE_FILLER::computeRawFilledArea(), BOARD_ADAPTER::createLayers(), BITMAPCONV_INFO::createOutputData(), TRACKS_CLEANER::deleteTracksInPads(), EXPORTER_PCB_VRML::ExportVrmlSolderMask(), PCB_BASE_FRAME::FocusOnItems(), RENDER_3D_OPENGL::generateViasAndPads(), AR_AUTOPLACER::genModuleOnRoutingMatrix(), APERTURE_MACRO::GetApertureMacroShape(), ZONE_FILLER::knockoutThermalReliefs(), NormalizeAreaOutlines(), DIALOG_PAD_PROPERTIES::padValuesOK(), ZONE_CREATE_HELPER::performZoneCutout(), PlotSolderMaskLayer(), RENDER_3D_RAYTRACE::Reload(), RENDER_3D_OPENGL::reload(), and ZONE_FILLER::subtractHigherPriorityZones().
void SHAPE_POLY_SET::BooleanSubtract | ( | const SHAPE_POLY_SET & | a, |
const SHAPE_POLY_SET & | b, | ||
POLYGON_MODE | aFastMode | ||
) |
Perform boolean polyset intersection between a and b, store the result in it self For aFastMode meaning, see function booleanOp.
Definition at line 703 of file shape_poly_set.cpp.
References booleanOp().
void SHAPE_POLY_SET::BuildBBoxCaches | ( | ) | const |
Construct BBoxCaches for Contains(), below.
Definition at line 1722 of file shape_poly_set.cpp.
References CHole(), COutline(), SHAPE_LINE_CHAIN::GenerateBBoxCache(), HoleCount(), and OutlineCount().
Referenced by ZONE_FILLER::computeRawFilledArea().
|
static |
Build a SHAPE_POLY_SET from a bunch of outlines in provided in random order.
aPath | set of closed outlines forming the polygon. Positive orientation = outline, negative = hole |
aReverseOrientation | inverts the sign of the orientation of aPaths (so negative = outline) |
aEvenOdd | forces the even-off fill rule (default is non zero) |
Definition at line 2531 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Append(), Hole(), NewHole(), NewOutline(), Outline(), and path.
Referenced by convertPolygon().
void SHAPE_POLY_SET::CacheTriangulation | ( | bool | aPartition = true | ) |
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
aPartition | = true to created a trinagulation in a partition on a grid false to create a more basic triangulation of the polygons Note in partition calculations the grid size is hard coded to 1e7. This is a good value for Pcbnew: 1cm, in internal units. But not good for Gerbview (1e7 = 10cm), however using a partition is not useful. |
Definition at line 2319 of file shape_poly_set.cpp.
References checksum(), ClearArcs(), DeletePolygon(), Fracture(), HasHoles(), MD5_HASH::IsValid(), m_hash, m_triangulatedPolys, m_triangulationValid, OutlineCount(), partitionPolyIntoRegularCellGrid(), PM_FAST, and Polygon().
Referenced by FOOTPRINT::BuildPolyCourtyards(), ZONE::CacheTriangulation(), ConvertPolygonToTriangles(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), Mirror(), polygon_triangulation_main(), Rotate(), and PNS_KICAD_IFACE_BASE::syncZone().
|
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().
SHAPE_POLY_SET SHAPE_POLY_SET::Chamfer | ( | int | aDistance | ) |
Return a chamfered version of the polygon set.
aDistance | is the chamfering distance. |
Definition at line 2019 of file shape_poly_set.cpp.
References ChamferPolygon(), and m_polys.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone().
|
private |
Return the chamfered or filleted version of the aIndex-th polygon in the set, depending on the aMode selected.
aMode | represent which action will be taken: CORNER_MODE::CHAMFERED will return a chamfered version of the polygon, CORNER_MODE::FILLETED will return a filleted version of the polygon. |
aDistance | is the chamfering distance if aMode = CHAMFERED; if aMode = FILLETED, is the filleting radius. |
aIndex | is the index of the polygon that will be chamfered/filleted. |
aErrorMax | is the maximum allowable deviation of the polygon from the circle if aMode = FILLETED. If aMode = CHAMFERED, it is unused. |
Definition at line 2041 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::CPoint(), distance(), GetArcToSegmentCount(), KiROUND(), Polygon(), RemoveNullSegments(), SHAPE_LINE_CHAIN::SetClosed(), and VECTOR2< T >::x.
Referenced by ChamferPolygon(), and FilletPolygon().
SHAPE_POLY_SET::POLYGON SHAPE_POLY_SET::ChamferPolygon | ( | unsigned int | aDistance, |
int | aIndex | ||
) |
Return a chamfered version of the aIndex-th polygon.
aDistance | is the chamfering distance. |
aIndex | is the index of the polygon to be chamfered. |
Definition at line 1870 of file shape_poly_set.cpp.
References CHAMFERED, and chamferFilletPolygon().
Referenced by Chamfer().
|
private |
Definition at line 2389 of file shape_poly_set.cpp.
References MD5_HASH::Finalize(), MD5_HASH::Hash(), and m_polys.
Referenced by CacheTriangulation(), GetHash(), IsTriangulationUpToDate(), and Move().
|
inline |
Definition at line 732 of file shape_poly_set.h.
References m_polys.
Referenced by BOARD_ADAPTER::addSolidAreasShapes(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), BuildBBoxCaches(), containsSingle(), KIGFX::PCB_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape(), GEOM_TEST::IsPolySetValid(), PlotLayerOutlines(), and HYPERLYNX_EXPORTER::writeNetObjects().
|
inline |
Definition at line 805 of file shape_poly_set.h.
References SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentContour, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentPolygon, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentVertex, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_iterateHoles, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_lastPolygon, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_poly, and OutlineCount().
Referenced by ConvertOutlineToPolygon(), EDA_SHAPE::DupPolyPointsList(), EDA_SHAPE::getBoundingBox(), and ZONE::GetInteractingZones().
|
inline |
|
inline |
Definition at line 829 of file shape_poly_set.h.
References OutlineCount().
Referenced by CIterate(), and CIterateWithHoles().
|
inline |
Return an iterator object, for iterating aPolygonIdx-th polygon edges.
Definition at line 876 of file shape_poly_set.h.
References SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_currentContour, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_currentPolygon, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_currentSegment, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_iterateHoles, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_lastPolygon, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_poly, and OutlineCount().
Referenced by BRDITEMS_PLOTTER::PlotPcbShape(), projectPointOnSegment(), and PCB_DIMENSION_BASE::segPolyIntersection().
|
inline |
Return an iterator object, for all outlines in the set (no holes).
Definition at line 898 of file shape_poly_set.h.
References CIterateSegments().
|
inline |
Returns an iterator object, for all outlines in the set (with holes)
Definition at line 910 of file shape_poly_set.h.
References OutlineCount().
Referenced by CIterateSegments(), and CIterateSegmentsWithHoles().
|
inline |
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition at line 928 of file shape_poly_set.h.
References CIterateSegments(), and OutlineCount().
Referenced by CollideEdge(), IsPolygonSelfIntersecting(), and SquaredDistanceToPolygon().
|
inline |
Definition at line 934 of file shape_poly_set.h.
References CIterateSegments().
|
inline |
Definition at line 824 of file shape_poly_set.h.
References CIterate().
Referenced by PCB_POINT_EDITOR::buildForPolyOutline(), ZONE::CIterateWithHoles(), and PCB_GRID_HELPER::computeAnchors().
|
inline |
Definition at line 834 of file shape_poly_set.h.
References CIterate(), and OutlineCount().
Referenced by CollideVertex().
void SHAPE_POLY_SET::ClearArcs | ( | ) |
Appends a vertex at the end of the given outline/hole (default: the last outline)
Definition at line 556 of file shape_poly_set.cpp.
References m_polys.
Referenced by BOOST_AUTO_TEST_CASE(), ZONE::BuildSmoothedPoly(), CacheTriangulation(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), and ZONE_FILLER::subtractHigherPriorityZones().
|
overridevirtual |
Return a dynamically allocated copy of the shape.
copy | of the shape Creates a new empty polygon in the set and returns its index |
Reimplemented from SHAPE.
Definition at line 116 of file shape_poly_set.cpp.
References SHAPE_POLY_SET().
|
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().
|
overridevirtual |
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 |
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 from SHAPE.
Definition at line 1484 of file shape_poly_set.cpp.
References SHAPE::Collide(), SHAPE_CIRCLE::GetCenter(), SHAPE_CIRCLE::GetRadius(), SHAPE_SEGMENT::GetSeg(), SHAPE_SEGMENT::GetWidth(), m_triangulatedPolys, SH_CIRCLE, SH_SEGMENT, and SHAPE_BASE::Type().
Referenced by calcIsInsideArea(), calcIsInsideCourtyard(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), EDA_SHAPE::hitTest(), FOOTPRINT::HitTestAccurate(), PCB_SELECTION_TOOL::hitTestDistance(), and DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances().
|
overridevirtual |
Check whether the point aP is either inside or on the edge of the polygon set.
Note that prior to Jul 2020 we considered the edge to not be part of the polygon. However, most other shapes (rects, circles, segments, etc.) include their edges and the difference was causing issues when used for DRC.
(FWIW, SHAPE_LINE_CHAIN was a split personality, with Collide() including its edges but PointInside() not. That has also been corrected.)
aP | is the VECTOR2I point whose collision with respect to the poly set will be tested. |
aClearance | is the security distance; if the point lies closer to the polygon than aClearance distance, then there is a collision. |
aActual | an optional pointer to an int to store the actual distance in the event of a collision. |
Reimplemented from SHAPE.
Definition at line 1460 of file shape_poly_set.cpp.
References IsEmpty(), SEG::Square(), SquaredDistance(), and VertexCount().
|
overridevirtual |
Check whether the segment aSeg collides with the polygon set (or its edge).
Note that prior to Jul 2020 we considered the edge to not be part of the polygon. However, most other shapes (rects, circles, segments, etc.) include their edges and the difference was causing issues when used for DRC.
(FWIW, SHAPE_LINE_CHAIN was a split personality, with Collide() including its edges but PointInside() not. That has also been corrected.)
aSeg | is the SEG segment whose collision with respect to the poly set will be tested. |
aClearance | is the security distance; if the segment passes closer to the polygon than aClearance distance, then there is a collision. |
aActual | an optional pointer to an int to store the actual distance in the event of a collision. |
Implements SHAPE.
Definition at line 1439 of file shape_poly_set.cpp.
References SEG::Square(), and SquaredDistance().
bool SHAPE_POLY_SET::CollideEdge | ( | const VECTOR2I & | aPoint, |
SHAPE_POLY_SET::VERTEX_INDEX & | aClosestVertex, | ||
int | aClearance = 0 |
||
) | const |
Check whether aPoint collides with any edge of any of the contours of the polygon.
aPoint | is the VECTOR2I point whose collision with respect to the polygon will be tested. |
aClearance | is the security distance; if aPoint lies closer to a vertex than aClearance distance, then there is a collision. |
aClosestVertex | is the index of the closes vertex to aPoint . |
Definition at line 1693 of file shape_poly_set.cpp.
References CIterateSegmentsWithHoles(), SEG::Distance(), and distance().
Referenced by EDA_SHAPE::hitTest(), and ZONE::HitTestForEdge().
bool SHAPE_POLY_SET::CollideVertex | ( | const VECTOR2I & | aPoint, |
SHAPE_POLY_SET::VERTEX_INDEX & | aClosestVertex, | ||
int | aClearance = 0 |
||
) | const |
Check whether aPoint collides with any vertex of any of the contours of the polygon.
aPoint | is the VECTOR2I point whose collision with respect to the polygon will be tested. |
aClearance | is the security distance; if aPoint lies closer to a vertex than aClearance distance, then there is a collision. |
aClosestVertex | is the index of the closes vertex to aPoint . |
Definition at line 1654 of file shape_poly_set.cpp.
References CIterateWithHoles(), delta, and distance().
Referenced by ZONE::HitTestForCorner().
bool SHAPE_POLY_SET::Contains | ( | const VECTOR2I & | aP, |
int | aSubpolyIndex = -1 , |
||
int | aAccuracy = 0 , |
||
bool | aUseBBoxCaches = false |
||
) | const |
Return true if a given subpolygon contains the point aP.
aP | is the point to check |
aSubpolyIndex | is the subpolygon to check, or -1 to check all |
aUseBBoxCaches | gives faster performance when multiple calls are made with no editing in between, but the caller MUST cache the bbox caches before calling (via BuildBBoxCaches(), above) |
Definition at line 1734 of file shape_poly_set.cpp.
References containsSingle(), m_polys, and OutlineCount().
Referenced by SHAPE_RECT::Collide(), ZONE_FILLER::computeRawFilledArea(), ZONE_FILLER::Fill(), PAD::GetBestAnchorPosition(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), GERBER_DRAW_ITEM::HitTest(), ZONE::HitTestFilledArea(), PCB_DIMENSION_BASE::segPolyIntersection(), BOARD::TestZoneIntersection(), PCB_DIM_ALIGNED::updateGeometry(), and PCB_DIM_ORTHOGONAL::updateGeometry().
|
private |
Check whether the point aP is inside the aSubpolyIndex-th polygon of the polyset.
If the points lies on an edge, the polygon is considered to contain it.
aP | is the VECTOR2I point whose position with respect to the inside of the aSubpolyIndex-th polygon will be tested. |
aSubpolyIndex | is an integer specifying which polygon in the set has to be checked. |
aAccuracy | accuracy in internal units |
aUseBBoxCaches | gives faster performance when multiple calls are made with no editing in between, but the caller MUST cache the bbox caches before calling (via BuildBBoxCaches(), above) |
Definition at line 1790 of file shape_poly_set.cpp.
References CHole(), HoleCount(), m_polys, and SHAPE_LINE_CHAIN_BASE::PointInside().
Referenced by Contains(), and SquaredDistanceToPolygon().
|
inline |
Definition at line 727 of file shape_poly_set.h.
References m_polys.
Referenced by CN_LIST::Add(), PAD::AddPrimitivePoly(), BOARD_ADAPTER::addSolidAreasShapes(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), CN_ZONE_LAYER::AnchorCount(), BuildBBoxCaches(), BuildConvexHull(), PAD::BuildEffectiveShapes(), CN_VISITOR::checkZoneZoneConnection(), CN_ZONE_LAYER::CN_ZONE_LAYER(), convertPolygon(), ConvertPolygonToBlocks(), CONVERT_TOOL::CreatePolys(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::Draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), KIGFX::CAIRO_GAL_BASE::DrawPolygon(), KIGFX::OPENGL_GAL::DrawPolygon(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), EDA_SHAPE::DupPolyPointsList(), EXPORTER_PCB_VRML::ExportVrmlBoard(), EXPORTER_PCB_VRML::ExportVrmlPolygonSet(), PCB_PLUGIN::format(), CN_ZONE_LAYER::GetAnchor(), PAD::GetBestAnchorPosition(), FOOTPRINT::GetBoundingHull(), EDA_SHAPE::GetLength(), CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), FABMASTER::loadGraphics(), EAGLE_PLUGIN::loadPolygon(), FABMASTER::loadPolygon(), EDA_SHAPE::MakeEffectiveShapes(), DSN::SPECCTRA_DB::makePADSTACK(), PlotLayerOutlines(), DXF_PLOTTER::PlotPoly(), PlotSolderMaskLayer(), DXF_PLOTTER::ThickSegment(), HYPERLYNX_EXPORTER::writeBoardInfo(), HYPERLYNX_EXPORTER::writeNetObjects(), and GBR_TO_PCB_EXPORTER::writePcbPolygon().
|
inline |
Definition at line 737 of file shape_poly_set.h.
References m_polys.
Referenced by SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::Advance(), SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::Advance(), GetRelativeIndices(), HasTouchingHoles(), SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::IsAdjacent(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::operator bool(), and PlotStandardLayer().
const VECTOR2I & SHAPE_POLY_SET::CVertex | ( | int | aIndex, |
int | aOutline, | ||
int | aHole | ||
) | const |
Return the aGlobalIndex-th vertex in the poly set.
Definition at line 357 of file shape_poly_set.cpp.
References m_polys.
Referenced by PCB_POINT_EDITOR::addCorner(), EDA_SHAPE::Compare(), CVertex(), D_CODE::DrawFlashedPolygon(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), findVertex(), ZONE::GetCornerPosition(), EDA_SHAPE::getPosition(), ZONE::HatchBorder(), ZONE::HitTest(), ZONE::MoveEdge(), ZONE::SetCornerPosition(), PCB_POINT_EDITOR::updateItem(), and PCB_POINT_EDITOR::updatePoints().
const VECTOR2I & SHAPE_POLY_SET::CVertex | ( | int | aGlobalIndex | ) | const |
Return the index-th vertex in a given hole outline within a given outline.
Definition at line 376 of file shape_poly_set.cpp.
References GetRelativeIndices(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, m_polys, and SHAPE_POLY_SET::VERTEX_INDEX::m_vertex.
const VECTOR2I & SHAPE_POLY_SET::CVertex | ( | SHAPE_POLY_SET::VERTEX_INDEX | index | ) | const |
Definition at line 388 of file shape_poly_set.cpp.
References CVertex(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, and SHAPE_POLY_SET::VERTEX_INDEX::m_vertex.
|
inline |
Definition at line 1009 of file shape_poly_set.h.
References Inflate().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), calcIsInsideArea(), ZONE_FILLER::computeRawFilledArea(), KIGFX::PCB_PAINTER::draw(), ZONE_FILLER::fillSingleZone(), PCB_BASE_FRAME::FocusOnItems(), ALTIUM_PCB::ParseRegions6Data(), and PlotSolderMaskLayer().
void SHAPE_POLY_SET::DeletePolygon | ( | int | aIdx | ) |
Definition at line 1636 of file shape_poly_set.cpp.
References m_polys.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), CacheTriangulation(), ZONE_FILLER::computeRawFilledArea(), ZONE_FILLER::Fill(), and PlotStandardLayer().
SHAPE_POLY_SET SHAPE_POLY_SET::Fillet | ( | int | aRadius, |
int | aErrorMax | ||
) |
Return a filleted version of the polygon set.
aRadius | is the fillet radius. |
aErrorMax | is the maximum allowable deviation of the polygon from the circle |
Definition at line 2030 of file shape_poly_set.cpp.
References FilletPolygon(), and m_polys.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone().
SHAPE_POLY_SET::POLYGON SHAPE_POLY_SET::FilletPolygon | ( | unsigned int | aRadius, |
int | aErrorMax, | ||
int | aIndex | ||
) |
Return a filleted version of the aIndex-th polygon.
aRadius | is the fillet radius. |
aErrorMax | is the maximum allowable deviation of the polygon from the circle |
aIndex | is the index of the polygon to be filleted |
Definition at line 1876 of file shape_poly_set.cpp.
References chamferFilletPolygon(), and FILLETED.
Referenced by Fillet(), and GEOM_TEST::FilletPolySet().
|
overridevirtual |
void SHAPE_POLY_SET::Fracture | ( | POLYGON_MODE | aFastMode | ) |
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
Definition at line 1063 of file shape_poly_set.cpp.
References fractureSingle(), m_polys, and Simplify().
Referenced by addHoleToPolygon(), PAD::addPadPrimitivesToPolygon(), PAD::AddPrimitivePoly(), CacheTriangulation(), ZONE_FILLER::computeRawFilledArea(), convertPolygon(), BITMAPCONV_INFO::createOutputData(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape(), AR_AUTOPLACER::drawPlacementRoutingMatrix(), EXPORTER_PCB_VRML::ExportStandardLayers(), EXPORTER_PCB_VRML::ExportVrmlSolderMask(), AR_AUTOPLACER::fillMatrix(), ZONE_FILLER::fillSingleZone(), APERTURE_MACRO::GetApertureMacroShape(), InflateWithLinkedHoles(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), FABMASTER::loadFootprints(), EAGLE_PLUGIN::loadPolygon(), FABMASTER::loadShapePolySet(), ALTIUM_PCB::ParseRegions6Data(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), DXF_PLOTTER::PlotPoly(), PlotSolderMaskLayer(), RENDER_3D_RAYTRACE::Reload(), TransformRingToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), and ZONE::TransformSmoothedOutlineToPolygon().
|
private |
Definition at line 947 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Append(), FractureEdge::m_connected, FractureEdge::m_next, FractureEdge::m_p1, path, processEdge(), SHAPE_LINE_CHAIN::SetClosed(), and VECTOR2< T >::x.
Referenced by Fracture().
int SHAPE_POLY_SET::FullPointCount | ( | ) | const |
Returns the number of holes in a given outline.
Definition at line 323 of file shape_poly_set.cpp.
References HoleCount(), m_polys, and OutlineCount().
void SHAPE_POLY_SET::GetArcs | ( | std::vector< SHAPE_ARC > & | aArcBuffer | ) | const |
Removes all arc references from all the outlines and holes in the polyset.
Definition at line 543 of file shape_poly_set.cpp.
References m_polys.
Referenced by BOOST_AUTO_TEST_CASE().
bool SHAPE_POLY_SET::GetGlobalIndex | ( | SHAPE_POLY_SET::VERTEX_INDEX | aRelativeIndices, |
int & | aGlobalIdx | ||
) | const |
Compute the global index of a vertex from the relative indices of polygon, contour and vertex.
aRelativeIndices | is the set of relative indices. |
aGlobalIdx | [out] is the computed global index. |
aGlobalIdx
reference. Definition at line 162 of file shape_poly_set.cpp.
References SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, m_polys, SHAPE_POLY_SET::VERTEX_INDEX::m_vertex, and Polygon().
Referenced by GetNeighbourIndexes(), and ZONE::GetSelectedCorner().
MD5_HASH SHAPE_POLY_SET::GetHash | ( | ) | const |
Definition at line 2226 of file shape_poly_set.cpp.
References checksum(), MD5_HASH::IsValid(), and m_hash.
Referenced by ZONE::BuildHashValue(), ZONE::GetHashValue(), DSN::SPECCTRA_DB::makePADSTACK(), operator=(), and SHAPE_POLY_SET().
|
overridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 2456 of file shape_poly_set.cpp.
References m_triangulatedPolys.
Referenced by GetIndexableSubshapes().
|
overridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 2467 of file shape_poly_set.cpp.
References GetIndexableSubshapeCount(), and m_triangulatedPolys.
bool SHAPE_POLY_SET::GetNeighbourIndexes | ( | int | aGlobalIndex, |
int * | aPrevious, | ||
int * | aNext | ||
) |
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a contour in the polygon set.
They are often aGlobalIndex-1 and aGlobalIndex+1, but not for the first and last corner of the contour.
aGlobalIndex | is index of the corner, globally indexed between all edges in all contours |
aPrevious | is the globalIndex of the previous corner of the same contour. |
aNext | is the globalIndex of the next corner of the same contour. |
Definition at line 394 of file shape_poly_set.cpp.
References GetGlobalIndex(), GetRelativeIndices(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, m_polys, SHAPE_POLY_SET::VERTEX_INDEX::m_vertex, and next().
Referenced by ZONE::MoveEdge().
bool SHAPE_POLY_SET::GetRelativeIndices | ( | int | aGlobalIdx, |
SHAPE_POLY_SET::VERTEX_INDEX * | aRelativeIndices | ||
) | const |
Convert a global vertex index —i.e., a number that globally identifies a vertex in a concatenated list of all vertices in all contours— and get the index of the vertex relative to the contour relative to the polygon in which it is.
aGlobalIdx | is the global index of the corner whose structured index wants to be found |
aRelativeIndices | is a pointer to the set of relative indices to store. |
Definition at line 122 of file shape_poly_set.cpp.
References CPolygon(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, SHAPE_POLY_SET::VERTEX_INDEX::m_vertex, OutlineCount(), and SHAPE_LINE_CHAIN::PointCount().
Referenced by CVertex(), ZONE::GetCornerPosition(), GetNeighbourIndexes(), InsertVertex(), IsVertexInHole(), IterateFromVertexWithHoles(), RemoveVertex(), ZONE::SetCornerPosition(), ZONE::SetSelectedCorner(), and SetVertex().
bool SHAPE_POLY_SET::HasHoles | ( | ) | const |
Return true if the polygon set has any holes that share a vertex.
Definition at line 1234 of file shape_poly_set.cpp.
References m_polys.
Referenced by PAD::AddPrimitivePoly(), and CacheTriangulation().
|
overridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 2450 of file shape_poly_set.cpp.
References IsTriangulationUpToDate().
bool SHAPE_POLY_SET::HasTouchingHoles | ( | ) | const |
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFastMode meaning, see function booleanOp.
Definition at line 2417 of file shape_poly_set.cpp.
References CPolygon(), hasTouchingHoles(), and OutlineCount().
|
private |
Definition at line 2429 of file shape_poly_set.cpp.
Referenced by HasTouchingHoles().
|
inline |
Return the aIndex-th subpolygon in the set.
Definition at line 706 of file shape_poly_set.h.
References m_polys.
Referenced by Area(), BuildFootprintPolygonOutlines(), BuildPolysetFromOrientedPaths(), ZONE::CalculateFilledArea(), ConvertPolygonToBlocks(), EXPORTER_PCB_VRML::ExportVrmlBoard(), DSN::SPECCTRA_DB::fillBOUNDARY(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), ZONE::HitTestCutout(), FABMASTER::loadFootprints(), FABMASTER::loadShapePolySet(), FABMASTER::loadZone(), polygonArea(), ZONE::RemoveCutout(), and TransformRingToPolygon().
|
inline |
Return the reference to aIndex-th outline in the set.
Definition at line 667 of file shape_poly_set.h.
References m_polys.
Referenced by BOARD_ADAPTER::addSolidAreasShapes(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), ZONE::AppendCorner(), Area(), BOOST_AUTO_TEST_CASE(), BuildBBoxCaches(), BuildFootprintPolygonOutlines(), ZONE::CalculateFilledArea(), containsSingle(), ConvertPolygonToBlocks(), KIGFX::PCB_PAINTER::draw(), EXPORTER_PCB_VRML::ExportVrmlBoard(), DSN::SPECCTRA_DB::fillBOUNDARY(), FullPointCount(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape(), ZONE::HitTestCutout(), GEOM_TEST::IsPolySetValid(), PlotLayerOutlines(), polygonArea(), ZONE::RemoveCutout(), and HYPERLYNX_EXPORTER::writeNetObjects().
|
private |
Definition at line 817 of file shape_poly_set.cpp.
References m_polys.
Referenced by booleanOp(), and Inflate().
void SHAPE_POLY_SET::Inflate | ( | int | aAmount, |
int | aCircleSegCount, | ||
CORNER_STRATEGY | aCornerStrategy = ROUND_ALL_CORNERS |
||
) |
Perform outline inflation/deflation.
Polygons can have holes, but not linked holes with main outlines, if aFactor < 0. For those use InflateWithLinkedHoles() to avoid odd corners where the link segments meet the outline.
aAmount | is the number of units to offset edges. |
aCircleSegCount | is the number of segments per 360 degrees to use in curve approx |
aCornerStrategy | ALLOW_ACUTE_CORNERS to preserve all angles, CHAMFER_ACUTE_CORNERS to chop angles less than 90°, ROUND_ACUTE_CORNERS to round off angles less than 90°, ROUND_ALL_CORNERS to round regardless of angles |
Definition at line 726 of file shape_poly_set.cpp.
References ALLOW_ACUTE_CORNERS, CHAMFER_ACUTE_CORNERS, CHAMFER_ALL_CORNERS, importTree(), m_polys, ROUND_ACUTE_CORNERS, ROUND_ALL_CORNERS, and SEG_CNT_MAX.
Referenced by FOOTPRINT::BuildPolyCourtyards(), ZONE::BuildSmoothedPoly(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), ZONE_FILLER::computeRawFilledArea(), BOARD_ADAPTER::createPadWithClearance(), Deflate(), ZONE_FILLER::fillSingleZone(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), InflateWithLinkedHoles(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), EAGLE_PLUGIN::loadPolygon(), EAGLE_PLUGIN::packagePolygon(), PlotSolderMaskLayer(), PAD::TransformShapeWithClearanceToPolygon(), and ZONE::TransformSmoothedOutlineToPolygon().
void SHAPE_POLY_SET::InflateWithLinkedHoles | ( | int | aFactor, |
int | aCircleSegmentsCount, | ||
POLYGON_MODE | aFastMode | ||
) |
Perform outline inflation/deflation, using round corners.
Polygons can have holes and/or linked holes with main outlines. The resulting polygons are also polygons with linked holes to main outlines. For aFastMode meaning, see function booleanOp .Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the outer ring to the inner holes For aFastMode meaning, see function booleanOp
Definition at line 717 of file shape_poly_set.cpp.
References Fracture(), Inflate(), and Unfracture().
Referenced by PlotStandardLayer(), ZONE::TransformShapeWithClearanceToPolygon(), and ZONE::TransformSolidAreasShapesToPolygon().
void SHAPE_POLY_SET::InsertVertex | ( | int | aGlobalIndex, |
const VECTOR2I & | aNewVertex | ||
) |
Adds a vertex in the globally indexed position aGlobalIndex.
aGlobalIndex | is the global index of the position in which the new vertex will be inserted. |
aNewVertex | is the new inserted vertex.Return the index-th vertex in a given hole outline within a given outline |
Definition at line 276 of file shape_poly_set.cpp.
References Append(), GetRelativeIndices(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, m_polys, SHAPE_POLY_SET::VERTEX_INDEX::m_vertex, and TotalVertices().
Referenced by PCB_POINT_EDITOR::addCorner().
|
inline |
Definition at line 1203 of file shape_poly_set.h.
References m_polys.
Referenced by LIB_SHAPE::AddPoint(), BOARD_ADAPTER::addShapeWithClearance(), Collide(), BOARD_ADAPTER::createPadWithClearance(), CONVERT_TOOL::CreatePolys(), TRACKS_CLEANER::deleteTracksInPads(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DRC_ENGINE::EvalRules(), CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands(), PCB_BASE_FRAME::FocusOnItems(), EDA_SHAPE::getBoundingBox(), ZONE::HatchBorder(), ALTIUM_PCB::HelperShapeSetLocalCoord(), BOARD_INSPECTION_TOOL::InspectClearance(), PCB_PARSER::parseZONE(), BRDITEMS_PLOTTER::PlotFilledAreas(), PlotStandardLayer(), PAD_TOOL::recombinePad(), and EE_POINT_EDITOR::removeCornerCondition().
|
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.
bool SHAPE_POLY_SET::IsPolygonSelfIntersecting | ( | int | aPolygonIndex | ) | const |
Check whether the aPolygonIndex-th polygon in the set is self intersecting.
aPolygonIndex | is the index of the polygon that wants to be checked. |
Definition at line 441 of file shape_poly_set.cpp.
References CIterateSegmentsWithHoles(), SEG::Collide(), and SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::IsAdjacent().
Referenced by IsSelfIntersecting().
bool SHAPE_POLY_SET::IsSelfIntersecting | ( | ) | const |
Check whether any of the polygons in the set is self intersecting.
Definition at line 468 of file shape_poly_set.cpp.
References IsPolygonSelfIntersecting(), and m_polys.
Referenced by PCB_POINT_EDITOR::validatePolygon().
|
inlineoverridevirtual |
bool SHAPE_POLY_SET::IsTriangulationUpToDate | ( | ) | const |
Definition at line 2235 of file shape_poly_set.cpp.
References checksum(), MD5_HASH::IsValid(), m_hash, and m_triangulationValid.
Referenced by KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::OPENGL_GAL::DrawPolygon(), HasIndexableSubshapes(), operator=(), SHAPE_POLY_SET(), and PNS_KICAD_IFACE_BASE::syncZone().
bool SHAPE_POLY_SET::IsVertexInHole | ( | int | aGlobalIdx | ) |
Check whether the aGlobalIndex-th vertex belongs to a hole.
aGlobalIdx | is the index of the vertex. |
Definition at line 2006 of file shape_poly_set.cpp.
References GetRelativeIndices(), and SHAPE_POLY_SET::VERTEX_INDEX::m_contour.
|
inline |
Return an object to iterate through the points of the polygons between aFirst
and aLast
.
aFirst | is the first polygon whose points will be iterated. |
aLast | is the last polygon whose points will be iterated. |
aIterateHoles | is a flag to indicate whether the points of the holes should be iterated. |
Definition at line 752 of file shape_poly_set.h.
References SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentContour, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentPolygon, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentVertex, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_iterateHoles, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_lastPolygon, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_poly, and OutlineCount().
Referenced by PCB_POINT_EDITOR::addCorner(), and ZONE::Iterate().
|
inline |
aOutline | is the index of the polygon to be iterated. |
Definition at line 771 of file shape_poly_set.h.
References Iterate().
|
inline |
Definition at line 790 of file shape_poly_set.h.
References OutlineCount().
Referenced by Iterate(), and IterateWithHoles().
|
inline |
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (default: without)
Definition at line 839 of file shape_poly_set.h.
References GetRelativeIndices(), IterateWithHoles(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentContour, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentPolygon, SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::m_currentVertex, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, and SHAPE_POLY_SET::VERTEX_INDEX::m_vertex.
|
inline |
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (default: without)
Definition at line 860 of file shape_poly_set.h.
References SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_currentContour, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_currentPolygon, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_currentSegment, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_iterateHoles, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_lastPolygon, SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::m_poly, and OutlineCount().
Referenced by TestConcaveSquareFillet(), TestSquareFillet(), and PCB_DIM_LEADER::updateGeometry().
|
inline |
Return an iterator object, for iterating aPolygonIdx-th polygon edges.
Definition at line 892 of file shape_poly_set.h.
References IterateSegments().
|
inline |
Returns an iterator object, for all outlines in the set (no holes)
Definition at line 904 of file shape_poly_set.h.
References OutlineCount().
Referenced by IterateSegments(), and IterateSegmentsWithHoles().
|
inline |
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition at line 916 of file shape_poly_set.h.
References IterateSegments(), and OutlineCount().
Referenced by ConvertOutlineToPolygon(), ZONE::HatchBorder(), and BOARD::TestZoneIntersection().
|
inline |
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition at line 922 of file shape_poly_set.h.
References IterateSegments().
|
inline |
aOutline | the index of the polygon to be iterated. |
Definition at line 781 of file shape_poly_set.h.
References Iterate().
Referenced by findVertex(), ZONE::HatchBorder(), ZONE::IterateWithHoles(), and BOARD::TestZoneIntersection().
|
inline |
Definition at line 799 of file shape_poly_set.h.
References Iterate(), and OutlineCount().
Referenced by IterateFromVertexWithHoles(), and RemoveNullSegments().
void SHAPE_POLY_SET::Mirror | ( | bool | aX = true , |
bool | aY = false , |
||
const VECTOR2I & | aRef = { 0, 0 } |
||
) |
Mirror the line points about y or x (or both)
aX | If true, mirror about the y axis (flip x coordinate) |
aY | If true, mirror about the x axis |
aRef | sets the reference point about which to mirror |
Definition at line 1829 of file shape_poly_set.cpp.
References CacheTriangulation(), m_polys, m_triangulationValid, and path.
Referenced by GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), FP_SHAPE::Flip(), FOOTPRINT::Flip(), EDA_SHAPE::flip(), FABMASTER::loadFootprints(), FP_SHAPE::Mirror(), and ZONE::Mirror().
|
overridevirtual |
Implements SHAPE.
Definition at line 1814 of file shape_poly_set.cpp.
References checksum(), m_hash, m_polys, m_triangulatedPolys, and path.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), ALTIUM_PCB::HelperShapeSetLocalCoord(), GERBER_DRAW_ITEM::HitTest(), FABMASTER::loadFootprints(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers(), FP_SHAPE::Move(), EDA_SHAPE::move(), ZONE::Move(), GERBER_DRAW_ITEM::MoveAB(), FOOTPRINT::MoveAnchorPosition(), GERBER_DRAW_ITEM::MoveXY(), DS_DRAW_ITEM_POLYPOLYGONS::SetPosition(), FOOTPRINT::SetPosition(), TransformOvalToPolygon(), TransformRoundChamferedRectToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), and TransformTrapezoidToPolygon().
|
inherited |
Definition at line 695 of file wrlfacet.cpp.
References SHAPE::facets.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
int SHAPE_POLY_SET::NewHole | ( | int | aOutline = -1 | ) |
Adds a new outline to the set and returns its index.
Definition at line 213 of file shape_poly_set.cpp.
References m_polys, and SHAPE_LINE_CHAIN::SetClosed().
Referenced by BuildPolysetFromOrientedPaths(), ConvertOutlineToPolygon(), ZONE::NewHole(), and TransformRingToPolygon().
int SHAPE_POLY_SET::NewOutline | ( | ) |
Creates a new hole in a given outline.
Definition at line 201 of file shape_poly_set.cpp.
References m_polys, and SHAPE_LINE_CHAIN::SetClosed().
Referenced by AR_AUTOPLACER::addFpBody(), addHoleToPolygon(), ZONE_FILLER::addKnockout(), AR_AUTOPLACER::addPad(), LIB_SHAPE::AddPoint(), ZONE::AppendCorner(), EDA_SHAPE::beginEdit(), BuildBoardPolygonOutlines(), BuildFootprintPolygonOutlines(), BuildPolysetFromOrientedPaths(), KI_TEST::CommonTestData::CommonTestData(), ConvertOutlineToPolygon(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), D_CODE::ConvertShapeToPolygon(), CornerListToPolygon(), BITMAPCONV_INFO::createOutputData(), BOARD_ADAPTER::createPadWithClearance(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), fillArcPOLY(), PCB_BASE_FRAME::FocusOnItems(), FOOTPRINT::GetBoundingHull(), getRectangleAlongCentreLine(), EDA_SHAPE::hitTest(), FABMASTER::loadFootprints(), EAGLE_PLUGIN::loadPolygon(), FABMASTER::loadShapePolySet(), FABMASTER::loadZone(), LEGACY_PLUGIN::loadZONE_CONTAINER(), PCB_PARSER::parseZONE(), DXF_PLOTTER::PlotPoly(), PlotStandardLayer(), RENDER_3D_OPENGL::reload(), EDA_SHAPE::rotate(), KIGFX::PREVIEW::POLYGON_ITEM::SetPoints(), EDA_SHAPE::SetPolyPoints(), SHAPE_POLY_SET(), DS_DATA_ITEM_POLYGONS::SyncDrawItems(), TransformArcToPolygon(), EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(), TransformCircleToPolygon(), TransformOvalToPolygon(), EDA_SHAPE::TransformShapeWithClearanceToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), and EE_POINT_EDITOR::updateParentItem().
int SHAPE_POLY_SET::NormalizeAreaOutlines | ( | ) |
Convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s).
Removes null segments.
Definition at line 1266 of file shape_poly_set.cpp.
References AddOutline(), BooleanSubtract(), OutlineCount(), PM_FAST, PM_STRICTLY_SIMPLE, Polygon(), RemoveNullSegments(), and Simplify().
Referenced by BITMAPCONV_INFO::createOutputData().
SHAPE_POLY_SET & SHAPE_POLY_SET::operator= | ( | const SHAPE_POLY_SET & | aOther | ) |
Definition at line 2203 of file shape_poly_set.cpp.
References GetHash(), IsTriangulationUpToDate(), m_hash, m_polys, m_triangulatedPolys, m_triangulationValid, TriangulatedPolyCount(), and TriangulatedPolygon().
|
inline |
Definition at line 679 of file shape_poly_set.h.
References m_polys.
Referenced by EE_POINT_EDITOR::addCorner(), ZONE_FILLER::addHatchFillTypeOnZone(), LIB_SHAPE::AddPoint(), Area(), EDA_SHAPE::beginEdit(), BOOST_AUTO_TEST_CASE(), BuildFootprintPolygonOutlines(), BuildPolysetFromOrientedPaths(), ZONE::BuildSmoothedPoly(), EDA_SHAPE::calcEdit(), calcIsInsideArea(), ZONE::CalculateFilledArea(), PCB_GRID_HELPER::computeAnchors(), EDA_SHAPE::continueEdit(), ConvertPolygonToBlocks(), FOOTPRINT::CoverageRatio(), CONVERT_TOOL::CreateLines(), BITMAPCONV_INFO::createOutputData(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), APERTURE_MACRO::DrawApertureMacroShape(), EDA_SHAPE::endEdit(), DSN::SPECCTRA_DB::fillBOUNDARY(), AR_AUTOPLACER::fillMatrix(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), GERBER_PLOTTER::FlashPadChamferRoundRect(), PSLIKE_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadCustom(), HPGL_PLOTTER::FlashPadCustom(), DXF_PLOTTER::FlashPadCustom(), PSLIKE_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadRoundRect(), HPGL_PLOTTER::FlashPadRoundRect(), DXF_PLOTTER::FlashPadRoundRect(), PCB_PLUGIN::format(), formatPoly(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PCB_SHAPE::GetFocusPosition(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), LIB_SHAPE::GetSelectMenuText(), EDA_SHAPE::hitTest(), PNS::SOLID::HoleHull(), PNS::SOLID::Hull(), GEOM_TEST::IsPolySetValid(), FABMASTER::loadFootprints(), FABMASTER::loadZone(), EDIT_POINTS_FACTORY::Make(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), PCB_PARSER::parseZONE(), LIB_SHAPE::Plot(), PlotDrawingSheet(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), BRDITEMS_PLOTTER::PlotPcbShape(), polygonArea(), LIB_SHAPE::print(), GERBER_DRAW_ITEM::PrintGerberPoly(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), DRC_RTREE::QueryColliding(), RENDER_3D_OPENGL::reload(), EE_POINT_EDITOR::removeCorner(), EE_POINT_EDITOR::removeCornerCondition(), PCB_POINT_EDITOR::removeCornerCondition(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), EDA_SHAPE::scale(), SHAPE_POLY_SET(), ZONE_FILLER::subtractHigherPriorityZones(), TransformArcToPolygon(), EE_POINT_EDITOR::updatePoints(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().
|
inline |
|
inline |
Return the number of vertices in a given outline/hole.
Definition at line 657 of file shape_poly_set.h.
References m_polys.
Referenced by PCB_POINT_EDITOR::addCorner(), ZONE_FILLER::addHatchFillTypeOnZone(), PAD::addPadPrimitivesToPolygon(), ZONE::AddPolygon(), PAD::AddPrimitivePoly(), BOARD_ADAPTER::addSolidAreasShapes(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), ZONE::AppendCorner(), Area(), booleanOp(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BuildBBoxCaches(), BuildBoardPolygonOutlines(), BuildConvexHull(), BuildFootprintPolygonOutlines(), CacheTriangulation(), calcIsInsideArea(), ZONE::CalculateFilledArea(), CIterate(), CIterateSegments(), CIterateSegmentsWithHoles(), CIterateWithHoles(), ZONE_FILLER::computeRawFilledArea(), Contains(), convertPolygon(), ConvertPolygonToBlocks(), RENDER_3D_OPENGL::createBoard(), BITMAPCONV_INFO::createOutputData(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CONVERT_TOOL::CreatePolys(), KIGFX::DS_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), APERTURE_MACRO::DrawApertureMacroShape(), D_CODE::DrawFlashedPolygon(), D_CODE::DrawFlashedShape(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), AR_AUTOPLACER::drawPlacementRoutingMatrix(), KIGFX::CAIRO_GAL_BASE::DrawPolygon(), KIGFX::OPENGL_GAL::DrawPolygon(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), KIGFX::PREVIEW::POLYGON_ITEM::drawPreviewShape(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), EDA_SHAPE::DupPolyPointsList(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), EXPORTER_PCB_VRML::ExportVrmlBoard(), EXPORTER_PCB_VRML::ExportVrmlPolygonSet(), ZONE_FILLER::Fill(), fillArcPOLY(), DSN::SPECCTRA_DB::fillBOUNDARY(), GEOM_TEST::FilletPolySet(), PSLIKE_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadCustom(), HPGL_PLOTTER::FlashPadCustom(), DXF_PLOTTER::FlashPadCustom(), PCB_PLUGIN::format(), FullPointCount(), RENDER_3D_OPENGL::generateHoles(), RENDER_3D_OPENGL::generateLayerList(), RENDER_3D_OPENGL::generateViasAndPads(), APERTURE_MACRO::GetApertureMacroShape(), PAD::GetBestAnchorPosition(), GERBER_DRAW_ITEM::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), GetRelativeIndices(), HasTouchingHoles(), DS_DRAW_ITEM_POLYPOLYGONS::HitTest(), ZONE::HitTestCutout(), isCopperOutside(), GEOM_TEST::IsPolySetValid(), Iterate(), IterateSegments(), IterateSegmentsWithHoles(), IterateWithHoles(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), FABMASTER::loadPolygon(), NormalizeAreaOutlines(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::operator bool(), DIALOG_PAD_PROPERTIES::padValuesOK(), partitionPolyIntoRegularCellGrid(), PlotDrawingSheet(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotFootprintGraphicItem(), PlotLayerOutlines(), BRDITEMS_PLOTTER::PlotPcbShape(), DXF_PLOTTER::PlotPoly(), PlotSolderMaskLayer(), PlotStandardLayer(), polygon_triangulation_main(), polygonArea(), GERBER_DRAW_ITEM::Print(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), DRC_RTREE::QueryColliding(), RENDER_3D_RAYTRACE::Reload(), ZONE::RemoveCutout(), Subset(), PNS_KICAD_IFACE_BASE::syncZone(), TestConcaveSquareFillet(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), TestSquareFillet(), HYPERLYNX_EXPORTER::writeBoardInfo(), HYPERLYNX_EXPORTER::writeNetObjects(), GBR_TO_PCB_EXPORTER::writePcbPolygon(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().
|
overridevirtual |
Reimplemented from SHAPE.
Definition at line 1330 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Append(), m_polys, SHAPE_LINE_CHAIN::SetClosed(), VECTOR2< T >::x, and VECTOR2< T >::y.
bool SHAPE_POLY_SET::PointOnEdge | ( | const VECTOR2I & | aP | ) | const |
Check if point aP lies on an edge or vertex of some of the outlines or holes.
aP | is the point to check. |
Definition at line 1422 of file shape_poly_set.cpp.
References m_polys.
|
inline |
Definition at line 712 of file shape_poly_set.h.
References m_polys.
Referenced by CacheTriangulation(), chamferFilletPolygon(), ZONE_FILLER::computeRawFilledArea(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), ZONE_FILLER::Fill(), PCB_PLUGIN::format(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::Get(), SHAPE_POLY_SET::SEGMENT_ITERATOR_TEMPLATE< T >::Get(), GetGlobalIndex(), FABMASTER::loadFootprints(), NormalizeAreaOutlines(), polygon_triangulation_main(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), and Subset().
|
inline |
void SHAPE_POLY_SET::RemoveAllContours | ( | ) |
Definition at line 1567 of file shape_poly_set.cpp.
References m_polys.
Referenced by buildBoardBoundingBoxPoly(), BuildBoardPolygonOutlines(), AR_AUTOPLACER::buildFpAreas(), FOOTPRINT::BuildPolyCourtyards(), D_CODE::Clear_D_CODE_Data(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), D_CODE::ConvertShapeToPolygon(), BOARD_ADAPTER::createBoardPolygon(), BITMAPCONV_INFO::createOutputData(), BOARD_ADAPTER::destroyLayers(), EXPORTER_PCB_VRML::ExportStandardLayers(), EXPORTER_PCB_VRML::ExportVrmlSolderMask(), ZONE_FILLER::Fill(), RENDER_3D_OPENGL::generateViasAndPads(), APERTURE_MACRO::GetApertureMacroShape(), FOOTPRINT::GetBoundingHull(), PAD::MergePrimitivesAsPolygon(), PlotLayerOutlines(), RENDER_3D_OPENGL::reload(), ZONE::RemoveAllContours(), EDA_SHAPE::rotate(), KIGFX::PREVIEW::POLYGON_ITEM::SetPoints(), EDA_SHAPE::SetPolyPoints(), and EE_POINT_EDITOR::updateParentItem().
void SHAPE_POLY_SET::RemoveContour | ( | int | aContourIdx, |
int | aPolygonIdx = -1 |
||
) |
Delete the aContourIdx-th contour of the aPolygonIdx-th polygon in the set.
aContourIdx | is the index of the contour in the aPolygonIdx-th polygon to be removed. |
aPolygonIdx | is the index of the polygon in which the to-be-removed contour is. Defaults to the last polygon in the set. |
Definition at line 1573 of file shape_poly_set.cpp.
References m_polys.
Referenced by PCB_POINT_EDITOR::removeCorner().
int SHAPE_POLY_SET::RemoveNullSegments | ( | ) |
Look for null segments; ie, segments whose ends are exactly the same and deletes them.
Definition at line 1583 of file shape_poly_set.cpp.
References SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::GetIndex(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), IterateWithHoles(), and RemoveVertex().
Referenced by chamferFilletPolygon(), and NormalizeAreaOutlines().
void SHAPE_POLY_SET::RemoveVertex | ( | int | aGlobalIndex | ) |
Delete the aGlobalIndex-th vertex.
aGlobalIndex | is the global index of the to-be-removed vertex. |
Definition at line 1755 of file shape_poly_set.cpp.
References GetRelativeIndices().
Referenced by PCB_POINT_EDITOR::removeCorner(), and RemoveNullSegments().
void SHAPE_POLY_SET::RemoveVertex | ( | VERTEX_INDEX | aRelativeIndices | ) |
Delete the vertex indexed by aRelativeIndex (index of polygon, contour and vertex).
aRelativeIndices | is the set of relative indices of the to-be-removed vertex.Remove all outlines & holes (clears) the polygon set. |
Definition at line 1767 of file shape_poly_set.cpp.
References SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, m_polys, and SHAPE_POLY_SET::VERTEX_INDEX::m_vertex.
|
overridevirtual |
Rotate all vertices by a given angle.
aCenter | is the rotation center. |
aAngle | is the rotation angle in radians. |
Implements SHAPE.
Definition at line 1842 of file shape_poly_set.cpp.
References CacheTriangulation(), m_polys, m_triangulationValid, and path.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), D_CODE::ConvertShapeToPolygon(), ALTIUM_PCB::HelperShapeSetLocalCoord(), FABMASTER::loadFootprints(), EDA_SHAPE::rotate(), ZONE::Rotate(), FOOTPRINT::SetOrientation(), TransformOvalToPolygon(), TransformRoundChamferedRectToPolygon(), FP_TEXT::TransformShapeWithClearanceToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), TransformTrapezoidToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), and PCB_DIM_LEADER::updateGeometry().
void SHAPE_POLY_SET::SetVertex | ( | const VERTEX_INDEX & | aIndex, |
const VECTOR2I & | aPos | ||
) |
Accessor function to set the position of a specific point.
aIndex | #VERTEX_INDEX of the point to move. |
aPos | destination position of the specified point. |
Definition at line 1784 of file shape_poly_set.cpp.
References SHAPE_POLY_SET::VERTEX_INDEX::m_contour, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, m_polys, and SHAPE_POLY_SET::VERTEX_INDEX::m_vertex.
Referenced by ZONE::MoveEdge(), ZONE::SetCornerPosition(), SetVertex(), and PCB_POINT_EDITOR::updateItem().
void SHAPE_POLY_SET::SetVertex | ( | int | aGlobalIndex, |
const VECTOR2I & | aPos | ||
) |
Set the vertex based on the global index.
Throws if the index doesn't exist.
aGlobalIndex | global index of the to-be-moved vertex |
aPos | New position on the vertexReturn total number of vertices stored in the set. |
Definition at line 1773 of file shape_poly_set.cpp.
References GetRelativeIndices(), and SetVertex().
void SHAPE_POLY_SET::Simplify | ( | POLYGON_MODE | aFastMode | ) |
Definition at line 1258 of file shape_poly_set.cpp.
References booleanOp(), and empty().
Referenced by PAD::addPadPrimitivesToPolygon(), BOARD_ADAPTER::addShapeWithClearance(), BOOST_AUTO_TEST_CASE(), ZONE_FILLER::buildCopperItemClearances(), BOARD_ADAPTER::createBoardPolygon(), BOARD_ADAPTER::createLayers(), BITMAPCONV_INFO::createOutputData(), Fracture(), APERTURE_MACRO::GetApertureMacroShape(), BOARD::GetBoardPolygonOutlines(), PNS::SOLID::HoleHull(), PNS::SOLID::Hull(), DSN::SPECCTRA_DB::makeIMAGE(), NormalizeAreaOutlines(), ALTIUM_PCB::ParseArcs6Data(), PlotLayerOutlines(), PlotSolderMaskLayer(), TransformArcToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), Unfracture(), HYPERLYNX_EXPORTER::writeNetObjects(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().
SEG::ecoord SHAPE_POLY_SET::SquaredDistance | ( | VECTOR2I | aPoint, |
VECTOR2I * | aNearest = nullptr |
||
) | const |
Compute the minimum distance squared between aPoint and all the polygons in the set.
Squared distances are used because they avoid the cost of doing square-roots.
aPoint | is the point whose distance to the set has to be measured. |
aNearest | [out] an optional pointer to be filled in with the point on the polyset which is closest to aPoint. |
Definition at line 1956 of file shape_poly_set.cpp.
References VECTOR2< T >::ECOORD_MAX, m_polys, and SquaredDistanceToPolygon().
Referenced by BOOST_AUTO_TEST_CASE(), and Collide().
SEG::ecoord SHAPE_POLY_SET::SquaredDistance | ( | const SEG & | aSegment, |
VECTOR2I * | aNearest = nullptr |
||
) | const |
Compute the minimum distance squared between aSegment and all the polygons in the set.
Squared distances are used because they avoid the cost of doing square-roots.
aSegment | is the segment whose distance to the polygon set has to be measured. |
aSegmentWidth | is the width of the segment; defaults to zero. |
aNearest | [out] an optional pointer to be filled in with the point on the polyset which is closest to aSegment. |
Definition at line 1981 of file shape_poly_set.cpp.
References VECTOR2< T >::ECOORD_MAX, m_polys, and SquaredDistanceToPolygon().
SEG::ecoord SHAPE_POLY_SET::SquaredDistanceToPolygon | ( | VECTOR2I | aPoint, |
int | aIndex, | ||
VECTOR2I * | aNearest | ||
) | const |
Compute the minimum distance between the aIndex-th polygon and aPoint.
aPoint | is the point whose distance to the aIndex-th polygon has to be measured. |
aIndex | is the index of the polygon whose distance to aPoint has to be measured. |
aNearest | [out] an optional pointer to be filled in with the point on the polyset which is closest to aPoint. |
Definition at line 1883 of file shape_poly_set.cpp.
References CIterateSegmentsWithHoles(), and containsSingle().
Referenced by SquaredDistance().
SEG::ecoord SHAPE_POLY_SET::SquaredDistanceToPolygon | ( | const SEG & | aSegment, |
int | aIndex, | ||
VECTOR2I * | aNearest | ||
) | const |
Compute the minimum distance between the aIndex-th polygon and aSegment with a possible width.
aSegment | is the segment whose distance to the aIndex-th polygon has to be measured. |
aIndex | is the index of the polygon whose distance to aPoint has to be measured. |
aNearest | [out] an optional pointer to be filled in with the point on the polyset which is closest to aSegment. |
Definition at line 1919 of file shape_poly_set.cpp.
References SEG::A, SEG::B, CIterateSegmentsWithHoles(), and containsSingle().
SHAPE_POLY_SET SHAPE_POLY_SET::Subset | ( | int | aFirstPolygon, |
int | aLastPolygon | ||
) |
Return a subset of the polygons in this set, the ones between aFirstPolygon and aLastPolygon.
aFirstPolygon | is the first polygon to be included in the returned set. |
aLastPolygon | is the last polygon to be excluded of the returned set. |
Definition at line 344 of file shape_poly_set.cpp.
References m_polys, OutlineCount(), and Polygon().
Referenced by UnitSet().
int SHAPE_POLY_SET::TotalVertices | ( | ) | const |
Delete aIdx-th polygon from the set.
Definition at line 1856 of file shape_poly_set.cpp.
Referenced by PCB_POINT_EDITOR::buildForPolyOutline(), EDA_SHAPE::Compare(), ZONE::GetNumCorners(), ZONE::HitTest(), InsertVertex(), PCB_POINT_EDITOR::updateItem(), and PCB_POINT_EDITOR::updatePoints().
|
inline |
Return the number of outlines in the set.
Definition at line 654 of file shape_poly_set.h.
References m_triangulatedPolys.
Referenced by ConvertPolygonToTriangles(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), operator=(), and SHAPE_POLY_SET().
|
inline |
Definition at line 722 of file shape_poly_set.h.
References m_triangulatedPolys.
Referenced by ConvertPolygonToTriangles(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), operator=(), SHAPE_POLY_SET(), and PNS_KICAD_IFACE_BASE::syncZone().
|
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(), Collide(), collideShapes(), collideSingleShapes(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS::SOLID::HoleHull(), PNS::SOLID::Hull(), and SHAPE_FILE_IO::Write().
void SHAPE_POLY_SET::Unfracture | ( | POLYGON_MODE | aFastMode | ) |
Return true if the polygon set has any holes.
Definition at line 1249 of file shape_poly_set.cpp.
References m_polys, path, Simplify(), and unfractureSingle().
Referenced by InflateWithLinkedHoles(), PGPartitionFixture::PGPartitionFixture(), and polygon_triangulation_main().
|
private |
Definition at line 1072 of file shape_poly_set.cpp.
References SEG::A, SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::Area(), SEG::B, SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CSegment(), next(), operator!=(), operator==(), SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::SetClosed(), SHAPE_LINE_CHAIN::Simplify(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Unfracture().
|
inline |
Return the reference to aHole-th hole in the aIndex-th outline.
Definition at line 700 of file shape_poly_set.h.
References Subset().
int SHAPE_POLY_SET::VertexCount | ( | int | aOutline = -1 , |
int | aHole = -1 |
||
) | const |
Return the number of points in the shape poly set.
mainly for reports
Definition at line 298 of file shape_poly_set.cpp.
References m_polys.
Referenced by Collide(), D_CODE::DrawFlashedPolygon(), GERBER_FILE_IMAGE::Execute_G_Command(), EDA_SHAPE::GetPointCount(), FABMASTER::loadFootprints(), FABMASTER::loadShapePolySet(), and FABMASTER::loadZone().
|
private |
Definition at line 1455 of file shape_poly_set.h.
Referenced by CacheTriangulation(), GetHash(), IsTriangulationUpToDate(), Move(), operator=(), and SHAPE_POLY_SET().
|
private |
Definition at line 1450 of file shape_poly_set.h.
Referenced by AddHole(), AddOutline(), Append(), ArcCount(), BBox(), BBoxFromCaches(), booleanOp(), Chamfer(), checksum(), CHole(), ClearArcs(), Contains(), containsSingle(), COutline(), CPolygon(), CVertex(), DeletePolygon(), Fillet(), Format(), Fracture(), FullPointCount(), GetArcs(), GetGlobalIndex(), GetNeighbourIndexes(), HasHoles(), Hole(), HoleCount(), importTree(), Inflate(), InsertVertex(), IsEmpty(), IsSelfIntersecting(), Mirror(), Move(), NewHole(), NewOutline(), operator=(), Outline(), OutlineCount(), Parse(), PointOnEdge(), Polygon(), RemoveAllContours(), RemoveContour(), RemoveVertex(), Rotate(), SetVertex(), SquaredDistance(), Subset(), TotalVertices(), Unfracture(), and VertexCount().
|
private |
Definition at line 1452 of file shape_poly_set.h.
Referenced by CacheTriangulation(), Collide(), GetIndexableSubshapeCount(), GetIndexableSubshapes(), Move(), operator=(), SHAPE_POLY_SET(), TriangulatedPolyCount(), and TriangulatedPolygon().
|
private |
Definition at line 1454 of file shape_poly_set.h.
Referenced by CacheTriangulation(), IsTriangulationUpToDate(), Mirror(), operator=(), Rotate(), and SHAPE_POLY_SET().
|
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().