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 | |
typedef std::vector< SHAPE_LINE_CHAIN > | POLYGON |
represents a single polygon outline with holes. | |
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. | |
SHAPE_POLY_SET (const POLYGON &aPolygon) | |
Construct a SHAPE_POLY_SET with the first polygon given by aPolygon. | |
SHAPE_POLY_SET (const SHAPE_POLY_SET &aOther) | |
Copy constructor SHAPE_POLY_SET Performs a deep copy of aOther into this . | |
~SHAPE_POLY_SET () | |
SHAPE_POLY_SET & | operator= (const SHAPE_POLY_SET &aOther) |
SHAPE_POLY_SET & | operator= (SHAPE_POLY_SET &&aOther) noexcept |
virtual void | CacheTriangulation (bool aPartition=true, bool aSimplify=false) |
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations. | |
bool | IsTriangulationUpToDate () const |
HASH_128 | GetHash () const |
virtual bool | HasIndexableSubshapes () const override |
virtual size_t | GetIndexableSubshapeCount () const override |
virtual void | GetIndexableSubshapes (std::vector< const SHAPE * > &aSubshapes) const 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. | |
bool | GetGlobalIndex (VERTEX_INDEX aRelativeIndices, int &aGlobalIdx) const |
Compute the global index of a vertex from the relative indices of polygon, contour and vertex. | |
SHAPE * | Clone () const override |
Return a dynamically allocated copy of the shape. | |
SHAPE_POLY_SET | CloneDropTriangulation () const |
int | NewOutline () |
Creates a new empty polygon in the set and returns its index. | |
int | NewHole (int aOutline=-1) |
Creates a new hole in a given outline. | |
int | AddOutline (const SHAPE_LINE_CHAIN &aOutline) |
Adds a new outline to the set and returns its index. | |
int | AddHole (const SHAPE_LINE_CHAIN &aHole, int aOutline=-1) |
Adds a new hole to the given outline (default: last) and returns its index. | |
int | AddPolygon (const POLYGON &apolygon) |
Adds a polygon to the set. | |
double | Area () |
Return the area of this poly set. | |
int | ArcCount () const |
Count the number of arc shapes present. | |
void | GetArcs (std::vector< SHAPE_ARC > &aArcBuffer) const |
Appends all the arcs in this polyset to aArcBuffer. | |
void | ClearArcs () |
Removes all arc references from all the outlines and holes in the polyset. | |
int | Append (int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false) |
Appends a vertex at the end of the given outline/hole (default: the last outline) | |
void | Append (const SHAPE_POLY_SET &aSet) |
Merge polygons from two sets. | |
void | Append (const VECTOR2I &aP, int aOutline=-1, int aHole=-1) |
Append a vertex at the end of the given outline/hole (default: the last outline) | |
int | Append (const SHAPE_ARC &aArc, int aOutline=-1, int aHole=-1, std::optional< int > aMaxError={}) |
Append a new arc to the contour indexed by aOutline and aHole (defaults to the outline of the last polygon). | |
void | InsertVertex (int aGlobalIndex, const VECTOR2I &aNewVertex) |
Adds a vertex in the globally indexed position aGlobalIndex. | |
const VECTOR2I & | CVertex (int aIndex, int aOutline, int aHole) const |
Return the index-th vertex in a given hole outline within a given outline. | |
const VECTOR2I & | CVertex (int aGlobalIndex) const |
Return the aGlobalIndex-th vertex in the poly set. | |
const VECTOR2I & | CVertex (VERTEX_INDEX aIndex) const |
Return the index-th vertex in a given hole outline within a given outline. | |
bool | GetNeighbourIndexes (int aGlobalIndex, int *aPrevious, int *aNext) const |
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a contour in the polygon set. | |
bool | IsPolygonSelfIntersecting (int aPolygonIndex) const |
Check whether the aPolygonIndex-th polygon in the set is self intersecting. | |
bool | IsSelfIntersecting () const |
Check whether any of the polygons in the set is self intersecting. | |
unsigned int | TriangulatedPolyCount () const |
Return the number of triangulated polygons. | |
int | OutlineCount () const |
Return the number of outlines in the set. | |
int | VertexCount (int aOutline=-1, int aHole=-1) const |
Return the number of vertices in a given outline/hole. | |
int | FullPointCount () const |
Return the number of points in the shape poly set. | |
int | HoleCount (int aOutline) const |
Returns the number of holes in a given outline. | |
SHAPE_LINE_CHAIN & | Outline (int aIndex) |
Return the reference to aIndex-th outline in the set. | |
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. | |
SHAPE_POLY_SET | UnitSet (int aPolygonIndex) |
SHAPE_LINE_CHAIN & | Hole (int aOutline, int aHole) |
Return the reference to aHole-th hole in the aIndex-th outline. | |
POLYGON & | Polygon (int aIndex) |
Return the aIndex-th subpolygon in the set. | |
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 |
const std::vector< POLYGON > & | CPolygons () 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 . | |
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) |
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) | |
CONST_SEGMENT_ITERATOR | CIterateSegments (int aFirst, int aLast, bool aIterateHoles=false) const |
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (default: without) | |
SEGMENT_ITERATOR | IterateSegments (int aPolygonIdx) |
Return an iterator object, for iterating aPolygonIdx-th polygon edges. | |
CONST_SEGMENT_ITERATOR | CIterateSegments (int aPolygonIdx) const |
Return an iterator object, for iterating aPolygonIdx-th polygon edges. | |
SEGMENT_ITERATOR | IterateSegments () |
Return an iterator object, for all outlines in the set (no holes). | |
CONST_SEGMENT_ITERATOR | CIterateSegments () const |
Returns an iterator object, for all outlines in the set (no holes) | |
SEGMENT_ITERATOR | IterateSegmentsWithHoles () |
Returns an iterator object, for all outlines in the set (with holes) | |
SEGMENT_ITERATOR | IterateSegmentsWithHoles (int aOutline) |
Return an iterator object, for the aOutline-th outline in the set (with holes). | |
CONST_SEGMENT_ITERATOR | CIterateSegmentsWithHoles () const |
Return an iterator object, for the aOutline-th outline in the set (with holes). | |
CONST_SEGMENT_ITERATOR | CIterateSegmentsWithHoles (int aOutline) const |
Return an iterator object, for the aOutline-th outline in the set (with holes). | |
void | BooleanAdd (const SHAPE_POLY_SET &b) |
Perform boolean polyset union. | |
void | BooleanSubtract (const SHAPE_POLY_SET &b) |
Perform boolean polyset difference. | |
void | BooleanIntersection (const SHAPE_POLY_SET &b) |
Perform boolean polyset intersection. | |
void | BooleanXor (const SHAPE_POLY_SET &b) |
Perform boolean polyset exclusive or. | |
void | BooleanAdd (const SHAPE_POLY_SET &a, const SHAPE_POLY_SET &b) |
Perform boolean polyset union between a and b, store the result in it self. | |
void | BooleanSubtract (const SHAPE_POLY_SET &a, const SHAPE_POLY_SET &b) |
Perform boolean polyset difference between a and b, store the result in it self. | |
void | BooleanIntersection (const SHAPE_POLY_SET &a, const SHAPE_POLY_SET &b) |
Perform boolean polyset intersection between a and b, store the result in it self. | |
void | BooleanXor (const SHAPE_POLY_SET &a, const SHAPE_POLY_SET &b) |
Perform boolean polyset exclusive or between a and b, store the result in it self. | |
void | RebuildHolesFromContours () |
Extract all contours from this polygon set, then recreate polygons with holes. | |
void | Inflate (int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false) |
Perform outline inflation/deflation. | |
void | Deflate (int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError) |
void | OffsetLineChain (const SHAPE_LINE_CHAIN &aLine, int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify) |
Perform offsetting of a line chain. | |
void | InflateWithLinkedHoles (int aFactor, CORNER_STRATEGY aCornerStrategy, int aMaxError) |
Perform outline inflation/deflation, using round corners. | |
void | Fracture () |
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the outer ring to the inner holes. | |
void | Unfracture () |
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes. | |
bool | HasHoles () const |
Return true if the polygon set has any holes. | |
bool | HasTouchingHoles () const |
Return true if the polygon set has any holes that share a vertex. | |
void | Simplify () |
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) | |
void | SimplifyOutlines (int aMaxError=0) |
Simplifies the lines in the polyset. | |
int | NormalizeAreaOutlines () |
Convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s). | |
const std::string | Format (bool aCplusPlus=true) const override |
bool | Parse (std::stringstream &aStream) override |
void | Move (const VECTOR2I &aVector) override |
void | Mirror (const VECTOR2I &aRef, FLIP_DIRECTION aFlipDirection) |
Mirror the line points about y or x (or both) | |
void | Rotate (const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override |
Rotate all vertices by a given angle. | |
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. | |
bool | PointOnEdge (const VECTOR2I &aP, int aAccuracy=0) const |
Check if point aP lies on an edge or vertex of some of the outlines or holes. | |
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. | |
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. | |
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). | |
bool | CollideVertex (const VECTOR2I &aPoint, VERTEX_INDEX *aClosestVertex=nullptr, int aClearance=0) const |
Check whether aPoint collides with any vertex of any of the contours of the polygon. | |
bool | CollideEdge (const VECTOR2I &aPoint, VERTEX_INDEX *aClosestVertex=nullptr, int aClearance=0) const |
Check whether aPoint collides with any edge of any of the contours of the polygon. | |
bool | PointInside (const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const override |
Check if point aP lies inside a closed shape. | |
void | BuildBBoxCaches () const |
Construct BBoxCaches for Contains(), below. | |
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. | |
bool | IsEmpty () const |
Return true if the set is empty (no polygons at all) | |
void | RemoveVertex (int aGlobalIndex) |
Delete the aGlobalIndex-th vertex. | |
void | RemoveVertex (VERTEX_INDEX aRelativeIndices) |
Delete the vertex indexed by aRelativeIndex (index of polygon, contour and vertex). | |
void | RemoveAllContours () |
Remove all outlines & holes (clears) the polygon set. | |
void | RemoveContour (int aContourIdx, int aPolygonIdx=-1) |
Delete the aContourIdx-th contour of the aPolygonIdx-th polygon in the set. | |
void | RemoveOutline (int aOutlineIdx) |
Delete the aOutlineIdx-th outline of the set including its contours and holes. | |
int | RemoveNullSegments () |
Look for null segments; ie, segments whose ends are exactly the same and deletes them. | |
void | SetVertex (const VERTEX_INDEX &aIndex, const VECTOR2I &aPos) |
Accessor function to set the position of a specific point. | |
void | SetVertex (int aGlobalIndex, const VECTOR2I &aPos) |
Set the vertex based on the global index. | |
int | TotalVertices () const |
Return total number of vertices stored in the set. | |
void | DeletePolygon (int aIdx) |
Delete aIdx-th polygon from the set. | |
void | DeletePolygonAndTriangulationData (int aIdx, bool aUpdateHash=true) |
Delete aIdx-th polygon and its triangulation data from the set. | |
void | UpdateTriangulationDataHash () |
POLYGON | ChamferPolygon (unsigned int aDistance, int aIndex) |
Return a chamfered version of the aIndex-th polygon. | |
POLYGON | FilletPolygon (unsigned int aRadius, int aErrorMax, int aIndex) |
Return a filleted version of the aIndex-th polygon. | |
SHAPE_POLY_SET | Chamfer (int aDistance) |
Return a chamfered version of the polygon set. | |
SHAPE_POLY_SET | Fillet (int aRadius, int aErrorMax) |
Return a filleted version of the polygon set. | |
SEG::ecoord | SquaredDistanceToPolygon (VECTOR2I aPoint, int aIndex, VECTOR2I *aNearest) const |
Compute the minimum distance between the aIndex-th polygon and aPoint. | |
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. | |
SEG::ecoord | SquaredDistance (const VECTOR2I &aPoint, bool aOutlineOnly, VECTOR2I *aNearest) const |
Compute the minimum distance squared between aPoint and all the polygons in the set. | |
SEG::ecoord | SquaredDistance (const VECTOR2I &aPoint, bool aOutlineOnly=false) const override |
SEG::ecoord | SquaredDistanceToSeg (const SEG &aSegment, VECTOR2I *aNearest=nullptr) const |
Compute the minimum distance squared between aSegment and all the polygons in the set. | |
bool | IsVertexInHole (int aGlobalIdx) |
Check whether the aGlobalIndex-th vertex belongs to a hole. | |
void | BuildPolysetFromOrientedPaths (const std::vector< SHAPE_LINE_CHAIN > &aPaths, bool aEvenOdd=false) |
Build a SHAPE_POLY_SET from a bunch of outlines in provided in random order. | |
void | TransformToPolygon (SHAPE_POLY_SET &aBuffer, int aError, ERROR_LOC aErrorLoc) const override |
Fills a SHAPE_POLY_SET with a polygon representation of this shape. | |
const std::vector< SEG > | GenerateHatchLines (const std::vector< double > &aSlopes, int aSpacing, int aLineLength) const |
int | GetClearance (const SHAPE *aOther) const |
Return the actual minimum distance between two shapes. | |
bool | IsNull () const |
Return true if the shape is a null shape. | |
virtual bool | Collide (const SHAPE *aShape, int aClearance, VECTOR2I *aMTV) const |
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision. | |
virtual VECTOR2I | Centre () const |
Compute a center-of-mass of the shape. | |
virtual int | Distance (const VECTOR2I &aP) const |
Returns the minimum distance from a given point to this shape. | |
bool | NearestPoints (const SHAPE *aOther, VECTOR2I &aPtThis, VECTOR2I &aPtOther) const |
Return the two points that mark the closest distance between this shape and aOther. | |
virtual VECTOR2I | GetStart () const |
virtual VECTOR2I | GetEnd () const |
virtual int | GetWidth () const |
virtual void | SetWidth (int aWidth) |
FACET * | NewFacet () |
SGNODE * | CalcShape (SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false) |
SHAPE_TYPE | Type () const |
Return the type of the shape. | |
wxString | TypeName () const |
Static Public Attributes | |
static const int | MIN_PRECISION_IU = 4 |
This is the minimum precision for all the points in a shape. | |
Protected Types | |
typedef VECTOR2I::extended_type | ecoord |
Protected Member Functions | |
void | cacheTriangulation (bool aPartition, bool aSimplify, std::vector< std::unique_ptr< TRIANGULATED_POLYGON > > *aHintData) |
Protected Attributes | |
std::vector< POLYGON > | m_polys |
std::vector< std::unique_ptr< TRIANGULATED_POLYGON > > | m_triangulatedPolys |
std::atomic< bool > | m_triangulationValid = false |
std::mutex | m_triangulationMutex |
SHAPE_TYPE | m_type |
< type of our shape | |
Private Types | |
enum | DROP_TRIANGULATION_FLAG { SINGLETON } |
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... | |
Private Member Functions | |
SHAPE_POLY_SET (const SHAPE_POLY_SET &aOther, DROP_TRIANGULATION_FLAG) | |
void | fractureSingle (POLYGON &paths) |
void | unfractureSingle (POLYGON &path) |
void | importTree (Clipper2Lib::PolyTree64 &tree, const std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, const std::vector< SHAPE_ARC > &aArcBuffe) |
void | importPaths (Clipper2Lib::Paths64 &paths, const std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, const std::vector< SHAPE_ARC > &aArcBuffe) |
void | importPolyPath (const std::unique_ptr< Clipper2Lib::PolyPath64 > &aPolyPath, const std::vector< CLIPPER_Z_VALUE > &aZValueBuffer, const std::vector< SHAPE_ARC > &aArcBuffer) |
void | inflate2 (int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy, bool aSimplify=false) |
void | inflateLine2 (const SHAPE_LINE_CHAIN &aLine, int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy, bool aSimplify=false) |
void | splitCollinearOutlines () |
bool | isExteriorWaist (const SEG &aSegA, const SEG &aSegB) const |
Check if two line segments are collinear and overlap. | |
void | booleanOp (Clipper2Lib::ClipType aType, const SHAPE_POLY_SET &aOtherShape) |
This is the engine to execute all polygon boolean transforms (AND, OR, ... and polygon simplification (merging overlapping polygons). | |
void | booleanOp (Clipper2Lib::ClipType aType, const SHAPE_POLY_SET &aShape, const SHAPE_POLY_SET &aOtherShape) |
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. | |
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. | |
bool | hasTouchingHoles (const POLYGON &aPoly) const |
Return true if the polygon set has any holes that touch share a vertex. | |
HASH_128 | checksum () const |
Private Attributes | |
HASH_128 | m_hash |
bool | m_hashValid = false |
std::list< FACET * > | facets |
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 67 of file shape_poly_set.h.
typedef ITERATOR_TEMPLATE<const VECTOR2I> SHAPE_POLY_SET::CONST_ITERATOR |
Definition at line 516 of file shape_poly_set.h.
typedef SEGMENT_ITERATOR_TEMPLATE<const SEG> SHAPE_POLY_SET::CONST_SEGMENT_ITERATOR |
Definition at line 520 of file shape_poly_set.h.
|
protectedinherited |
Definition at line 515 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 73 of file shape_poly_set.h.
Definition at line 519 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 1554 of file shape_poly_set.h.
|
private |
Enumerator | |
---|---|
SINGLETON |
Definition at line 1488 of file shape_poly_set.h.
SHAPE_POLY_SET::SHAPE_POLY_SET | ( | ) |
Definition at line 74 of file shape_poly_set.cpp.
References SH_POLY_SET, and SHAPE::SHAPE().
Referenced by Append(), BooleanAdd(), BooleanAdd(), BooleanIntersection(), BooleanIntersection(), booleanOp(), booleanOp(), BooleanSubtract(), BooleanSubtract(), BooleanXor(), BooleanXor(), cacheTriangulation(), Chamfer(), CIterate(), CIterateSegments(), Clone(), CloneDropTriangulation(), Collide(), Fillet(), Format(), NormalizeAreaOutlines(), operator=(), operator=(), KIFONT::OUTLINE_GLYPH::OUTLINE_GLYPH(), KIFONT::OUTLINE_GLYPH::OUTLINE_GLYPH(), KIFONT::OUTLINE_GLYPH::OUTLINE_GLYPH(), RebuildHolesFromContours(), SHAPE_POLY_SET(), SHAPE_POLY_SET(), Simplify(), Subset(), TransformToPolygon(), and UnitSet().
SHAPE_POLY_SET::SHAPE_POLY_SET | ( | const BOX2D & | aRect | ) |
Definition at line 80 of file shape_poly_set.cpp.
References Append(), BOX2< Vec >::GetBottom(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), NewOutline(), Outline(), SHAPE_LINE_CHAIN::SetClosed(), SH_POLY_SET, and SHAPE::SHAPE().
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 92 of file shape_poly_set.cpp.
References AddOutline(), SH_POLY_SET, and SHAPE::SHAPE().
SHAPE_POLY_SET::SHAPE_POLY_SET | ( | const POLYGON & | aPolygon | ) |
Construct a SHAPE_POLY_SET with the first polygon given by aPolygon.
aPolygon | is a polygon |
Definition at line 99 of file shape_poly_set.cpp.
References AddPolygon(), SH_POLY_SET, and SHAPE::SHAPE().
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 106 of file shape_poly_set.cpp.
References GetHash(), IsTriangulationUpToDate(), m_hash, m_hashValid, m_polys, m_triangulationValid, SHAPE::SHAPE(), and SHAPE_POLY_SET().
SHAPE_POLY_SET::~SHAPE_POLY_SET | ( | ) |
Definition at line 143 of file shape_poly_set.cpp.
|
private |
Definition at line 133 of file shape_poly_set.cpp.
References m_hash, m_hashValid, m_polys, m_triangulationValid, SHAPE::SHAPE(), and SHAPE_POLY_SET().
int SHAPE_POLY_SET::AddHole | ( | const SHAPE_LINE_CHAIN & | aHole, |
int | aOutline = -1 ) |
Adds a new hole to the given outline (default: last) and returns its index.
Definition at line 566 of file shape_poly_set.cpp.
References m_polys.
Referenced by KIGEOM::AddHoleIfValid(), addHolesToPolygon(), BuildBoardPolygonOutlines(), BuildFootprintPolygonOutlines(), KI_TEST::BuildHollowSquare(), cacheTriangulation(), ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItemOnLayer(), ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItemOnLayer(), CADSTAR_ARCHIVE_PARSER::SHAPE::ConvertToPolySet(), BOARD::GetBoardPolygonOutlines(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), FABMASTER::loadFootprints(), FABMASTER::loadShapePolySet(), ALTIUM_PCB::ParseRegions6Data(), PCB_IO_KICAD_SEXPR_PARSER::parseRenderCache(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), ZONE_CREATE_HELPER::performZoneCutout(), and playground_main_func().
int SHAPE_POLY_SET::AddOutline | ( | const SHAPE_LINE_CHAIN & | aOutline | ) |
Adds a new outline to the set and returns its index.
Definition at line 548 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::IsClosed(), and m_polys.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), addOutlinesToPolygon(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), buildBoardBoundingBoxPoly(), KI_TEST::BuildHollowSquare(), KI_TEST::BuildPolyset(), ConvertImageToPolygons(), ConvertPolygonToBlocks(), ALTIUM_PCB::ConvertShapeBasedRegions6ToBoardItemOnLayer(), ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItemOnLayer(), CADSTAR_ARCHIVE_PARSER::SHAPE::ConvertToPolySet(), MULTICHANNEL_TOOL::copyRuleAreaContents(), FOOTPRINT::CoverageRatio(), BOARD_ADAPTER::createPadWithMargin(), KIGFX::GERBVIEW_PAINTER::draw(), ZONE_FILLER::Fill(), ZONE_FILLER::fillCopperZone(), GEOM_TEST::FilletPolySet(), FOOTPRINT::GetBoundingHull(), FOOTPRINT::GetBoundingHull(), PNS::HOLE::Hull(), PNS::SOLID::Hull(), FEATURES_MANAGER::InitFeatureList(), KIGFX::knockoutText(), DSN::SPECCTRA_DB::makeIMAGE(), CONVERT_TOOL::makePolysFromChainedSegs(), PAD::MergePrimitivesAsPolygon(), NormalizeAreaOutlines(), PCB_IO_EAGLE::packagePolygon(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParseFootprint(), ALTIUM_PCB::ParseRegions6Data(), PCB_IO_KICAD_SEXPR_PARSER::parseRenderCache(), partitionPolyIntoRegularCellGrid(), ZONE_CREATE_HELPER::performZoneCutout(), PlotStandardLayer(), SHAPE_POLY_SET(), TestConcaveSquareFillet(), TestSquareFillet(), EDA_SHAPE::TransformShapeToPolygon(), SHAPE_LINE_CHAIN::TransformToPolygon(), SHAPE_SIMPLE::TransformToPolygon(), and EDA_SHAPE::UpdateHatching().
int SHAPE_POLY_SET::AddPolygon | ( | const POLYGON & | apolygon | ) |
Adds a polygon to the set.
Definition at line 585 of file shape_poly_set.cpp.
References m_polys.
Referenced by SHAPE_POLY_SET(), and kiapi::common::UnpackPolySet().
int SHAPE_POLY_SET::Append | ( | const SHAPE_ARC & | aArc, |
int | aOutline = -1, | ||
int | aHole = -1, | ||
std::optional< int > | aMaxError = {} ) |
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) |
aMaxError | optional; accuracy of the arc representation in IU |
Definition at line 291 of file shape_poly_set.cpp.
References m_polys.
void SHAPE_POLY_SET::Append | ( | const SHAPE_POLY_SET & | aSet | ) |
Merge polygons from two sets.
Definition at line 2467 of file shape_poly_set.cpp.
References m_polys, and SHAPE_POLY_SET().
void SHAPE_POLY_SET::Append | ( | const VECTOR2I & | aP, |
int | aOutline = -1, | ||
int | aHole = -1 ) |
Append a vertex at the end of the given outline/hole (default: the last outline)
Definition at line 2473 of file shape_poly_set.cpp.
References Append(), VECTOR2< T >::x, and VECTOR2< T >::y.
int SHAPE_POLY_SET::Append | ( | int | x, |
int | y, | ||
int | aOutline = -1, | ||
int | aHole = -1, | ||
bool | aAllowDuplication = false ) |
Appends a vertex at the end of the given outline/hole (default: the last outline)
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 268 of file shape_poly_set.cpp.
References m_polys.
Referenced by addHoleToPolygon(), ZONE_FILLER::addKnockout(), PAD::AddPrimitivePoly(), PCB_IO_IPC2581::addShape(), Append(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BuildBoardPolygonOutlines(), PCB_TEXT::buildBoundingHull(), ZONE_FILLER::buildCopperItemClearances(), BuildFootprintPolygonOutlines(), TEARDROP_MANAGER::computeAnchorPoints(), AM_PRIMITIVE::ConvertBasicShapeToPolygon(), ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), CornerListToPolygon(), BITMAPCONV_INFO::createOutputData(), BOARD_ADAPTER::createPadWithMargin(), STEP_PCB_MODEL::CreatePCB(), CONVERT_TOOL::CreatePolys(), TEARDROP_MANAGER::createTeardrop(), TEARDROP_MANAGER::createTeardropMask(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), fillArcPOLY(), PCB_BASE_FRAME::FocusOnItems(), GenerateLayerPoly(), FOOTPRINT::GetBoundingHull(), FOOTPRINT::GetBoundingHull(), getRectangleAlongCentreLine(), EDA_SHAPE::hitTest(), InsertVertex(), KIGFX::knockoutText(), FABMASTER::loadFootprints(), PCB_IO_EAGLE::loadPolygon(), FABMASTER::loadShapePolySet(), SCH_IO_EAGLE::loadSymbolPolyLine(), PCB_IO_KICAD_LEGACY::loadZONE_CONTAINER(), DSN::SPECCTRA_DB::makeIMAGE(), CONVERT_TOOL::makePolysFromClosedGraphics(), ZONE_CREATE_HELPER::OnComplete(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), DXF_PLOTTER::PlotPoly(), BRDITEMS_PLOTTER::PlotShape(), PlotStandardLayer(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), SHAPE_POLY_SET(), DS_DATA_ITEM_POLYGONS::SyncDrawItems(), TransformArcToPolygon(), TransformCircleToPolygon(), TransformOvalToPolygon(), TransformRingToPolygon(), TransformRoundChamferedRectToPolygon(), EDA_SHAPE::TransformShapeToPolygon(), PAD::TransformShapeToPolygon(), PCB_TEXTBOX::TransformShapeToPolygon(), ZONE::TransformShapeToPolygon(), ZONE::TransformSmoothedOutlineToPolygon(), ZONE::TransformSolidAreasShapesToPolygon(), PCB_TEXT::TransformTextToPolySet(), PCB_TEXTBOX::TransformTextToPolySet(), TransformToPolygon(), TransformTrapezoidToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PCB_DIM_RADIAL::updateGeometry(), and PCB_SHAPE::UpdateHatching().
int SHAPE_POLY_SET::ArcCount | ( | ) | const |
Count the number of arc shapes present.
Definition at line 609 of file shape_poly_set.cpp.
References ArcCount(), and m_polys.
Referenced by ArcCount(), and booleanOp().
double SHAPE_POLY_SET::Area | ( | ) |
Return the area of this poly set.
Definition at line 593 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Area(), Hole(), HoleCount(), Outline(), and OutlineCount().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), DRAWING_TOOL::DrawVia(), ZONE_FILLER::Fill(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PCB_TRACK::GetMsgPanelInfo(), polygonArea(), and DRC_TEST_PROVIDER_TEXT_DIMS::Run().
|
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 2168 of file shape_poly_set.cpp.
References BBox(), BOX2< Vec >::Inflate(), m_polys, and BOX2< Vec >::Merge().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), PCB_TABLE::Autosize(), BBox(), KIFONT::OUTLINE_GLYPH::BoundingBox(), PCB_TEXT::buildBoundingHull(), PCB_BASE_FRAME::FocusOnItems(), GERBER_DRAW_ITEM::GetBoundingBox(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), KIGFX::knockoutText(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParseFootprint(), partitionPolyIntoRegularCellGrid(), PCB_CONTROL::PlaceCharacteristics(), PlotStandardLayer(), BRDITEMS_PLOTTER::PlotText(), KIGFX::VIEW::SetCenter(), BOARD::TestZoneIntersection(), KIGFX::PREVIEW::CENTRELINE_RECT_ITEM::ViewBBox(), and GERBER_DRAW_ITEM::ViewGetLOD().
const BOX2I SHAPE_POLY_SET::BBoxFromCaches | ( | ) | const |
Definition at line 2185 of file shape_poly_set.cpp.
References m_polys, and BOX2< Vec >::Merge().
Referenced by ZONE_FILLER::connect_nearby_polys(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones().
void SHAPE_POLY_SET::BooleanAdd | ( | const SHAPE_POLY_SET & | a, |
const SHAPE_POLY_SET & | b ) |
Perform boolean polyset union between a and b, store the result in it self.
Definition at line 890 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
void SHAPE_POLY_SET::BooleanAdd | ( | const SHAPE_POLY_SET & | b | ) |
Perform boolean polyset union.
Definition at line 866 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
Referenced by DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees(), FEATURES_MANAGER::AddShape(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), ZONE::BuildSmoothedPoly(), GenerateLayerPoly(), FOOTPRINT::GetCoverageArea(), PCB_TUNING_PATTERN::getOutline(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), CONVERT_TOOL::makePolysFromClosedGraphics(), PAD::MergePrimitivesAsPolygon(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), ALTIUM_PCB::ParseRegions6Data(), PCB_IO_KICAD_SEXPR_PARSER::parseZONE(), DXF_PLOTTER::PlotPoly(), and POLYGON_MERGE_ROUTINE::ProcessSubsequentPolygon().
void SHAPE_POLY_SET::BooleanIntersection | ( | const SHAPE_POLY_SET & | a, |
const SHAPE_POLY_SET & | b ) |
Perform boolean polyset intersection between a and b, store the result in it self.
Definition at line 902 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
void SHAPE_POLY_SET::BooleanIntersection | ( | const SHAPE_POLY_SET & | b | ) |
Perform boolean polyset intersection.
Definition at line 878 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), STEP_PCB_MODEL::AddPadShape(), BOOST_AUTO_TEST_CASE(), ZONE::BuildSmoothedPoly(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), TEARDROP_MANAGER::computeAnchorPoints(), ConvertPolygonToBlocks(), FOOTPRINT::CoverageRatio(), EXPORTER_PCB_VRML::ExportStandardLayers(), ZONE_FILLER::Fill(), ZONE_FILLER::fillCopperZone(), PCB_BASE_FRAME::FocusOnItems(), isCopperOutside(), partitionPolyIntoRegularCellGrid(), playground_main_func(), POLYGON_INTERSECT_ROUTINE::ProcessSubsequentPolygon(), PAD::Recombine(), RENDER_3D_OPENGL::reload(), and TransformOvalToPolygon().
|
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 Clipper2Lib::ClipType ) |
aOtherShape | is the SHAPE_LINE_CHAIN to combine with me. |
Definition at line 752 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
Referenced by BooleanAdd(), BooleanAdd(), BooleanIntersection(), BooleanIntersection(), booleanOp(), BooleanSubtract(), BooleanSubtract(), BooleanXor(), BooleanXor(), and Simplify().
|
private |
Definition at line 758 of file shape_poly_set.cpp.
References ArcCount(), importTree(), CLIPPER_Z_VALUE::m_FirstArcIdx, m_polys, CLIPPER_Z_VALUE::m_SecondArcIdx, OutlineCount(), and SHAPE_POLY_SET().
void SHAPE_POLY_SET::BooleanSubtract | ( | const SHAPE_POLY_SET & | a, |
const SHAPE_POLY_SET & | b ) |
Perform boolean polyset difference between a and b, store the result in it self.
Definition at line 896 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
void SHAPE_POLY_SET::BooleanSubtract | ( | const SHAPE_POLY_SET & | b | ) |
Perform boolean polyset difference.
Definition at line 872 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), addHoleToPolygon(), EXPORTER_STEP::buildBoard3DShapes(), ZONE::BuildSmoothedPoly(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), BITMAPCONV_INFO::createOutputData(), TRACKS_CLEANER::deleteTracksInPads(), PAD::doCheckPad(), EXPORTER_PCB_VRML::ExportVrmlSolderMask(), ZONE_FILLER::fillCopperZone(), ZONE_FILLER::fillNonCopperZone(), PCB_BASE_FRAME::FocusOnItems(), RENDER_3D_OPENGL::generateViasAndPads(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), KIGFX::knockoutText(), ZONE_FILLER::knockoutThermalReliefs(), NormalizeAreaOutlines(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), ZONE_CREATE_HELPER::performZoneCutout(), PlotClippedSilkLayer(), POLYGON_SUBTRACT_ROUTINE::ProcessSubsequentPolygon(), RENDER_3D_RAYTRACE_BASE::Reload(), RENDER_3D_OPENGL::reload(), DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run(), KIGFX::VIEW::SetCenter(), ZONE_FILLER::subtractHigherPriorityZones(), PCB_TEXT::TransformTextToPolySet(), and PCB_TEXTBOX::TransformTextToPolySet().
void SHAPE_POLY_SET::BooleanXor | ( | const SHAPE_POLY_SET & | a, |
const SHAPE_POLY_SET & | b ) |
Perform boolean polyset exclusive or between a and b, store the result in it self.
Definition at line 908 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
void SHAPE_POLY_SET::BooleanXor | ( | const SHAPE_POLY_SET & | b | ) |
Perform boolean polyset exclusive or.
Definition at line 884 of file shape_poly_set.cpp.
References booleanOp(), and SHAPE_POLY_SET().
Referenced by playground_main_func().
void SHAPE_POLY_SET::BuildBBoxCaches | ( | ) | const |
Construct BBoxCaches for Contains(), below.
Definition at line 2552 of file shape_poly_set.cpp.
References CHole(), COutline(), SHAPE_LINE_CHAIN::GenerateBBoxCache(), HoleCount(), and OutlineCount().
Referenced by ZONE_FILLER::fillCopperZone(), and DRC_CACHE_GENERATOR::Run().
void SHAPE_POLY_SET::BuildPolysetFromOrientedPaths | ( | const std::vector< SHAPE_LINE_CHAIN > & | aPaths, |
bool | aEvenOdd = false ) |
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 |
aEvenOdd | forces the even-off fill rule (default is non zero) |
Definition at line 3269 of file shape_poly_set.cpp.
References importTree(), and path.
|
inlinevirtual |
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. |
aSimplify | = force the algorithm to simplify the POLY_SET before triangulating |
Reimplemented in KIFONT::OUTLINE_GLYPH.
Definition at line 581 of file shape_poly_set.h.
References cacheTriangulation().
Referenced by KIFONT::OUTLINE_GLYPH::CacheTriangulation(), Collide(), MULTICHANNEL_TOOL::copyRuleAreaContents(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), Mirror(), polygon_triangulation_main(), Rotate(), and PNS_KICAD_IFACE_BASE::syncZone().
|
protected |
Definition at line 3000 of file shape_poly_set.cpp.
References AddHole(), checksum(), ClearArcs(), DeletePolygon(), Fracture(), HasHoles(), Hole(), HoleCount(), IsSelfIntersecting(), m_hash, m_hashValid, m_triangulatedPolys, m_triangulationMutex, m_triangulationValid, Outline(), OutlineCount(), partitionPolyIntoRegularCellGrid(), Polygon(), SHAPE_POLY_SET(), Simplify(), SimplifyOutlines(), POLYGON_TRIANGULATION::TesselatePolygon(), TRIANGULATE_TRACE, and TRIANGULATESIMPLIFICATIONLEVEL.
Referenced by KIFONT::OUTLINE_GLYPH::CacheTriangulation(), and CacheTriangulation().
|
inherited |
Definition at line 703 of file wrlfacet.cpp.
References IFSG_NODE::AddChildNode(), IFSG_INDEX::AddIndex(), IFSG_NODE::AddRefNode(), facets, IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), IFSG_FACESET::NewNode(), IFSG_SHAPE::NewNode(), IFSG_COLORS::SetColorList(), IFSG_COORDS::SetCoordsList(), IFSG_NORMALS::SetNormalList(), SGPOINT::x, SGPOINT::y, and SGPOINT::z.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
|
inlinevirtualinherited |
Compute a center-of-mass of the shape.
Definition at line 232 of file shape.h.
References BBox(), and BOX2< Vec >::Centre().
Referenced by PCB_CONTROL::ApplyDesignBlockLayout(), PNS::TOPOLOGY::AssembleDiffPair(), Collide(), and pickSegment().
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 2854 of file shape_poly_set.cpp.
References ChamferPolygon(), m_polys, and SHAPE_POLY_SET().
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 263 of file corner_operations.cpp.
References std::abs(), SHAPE_LINE_CHAIN::Append(), CHAMFERED, distance(), GetArcToSegmentCount(), KiROUND(), Polygon(), RADIANS_T, radius, RemoveNullSegments(), and SHAPE_LINE_CHAIN::SetClosed().
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 2701 of file shape_poly_set.cpp.
References CHAMFERED, and chamferFilletPolygon().
Referenced by Chamfer().
|
private |
Definition at line 3124 of file shape_poly_set.cpp.
References MMH3_HASH::add(), MMH3_HASH::digest(), m_polys, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by cacheTriangulation(), DeletePolygonAndTriangulationData(), GetHash(), IsTriangulationUpToDate(), Move(), and UpdateTriangulationDataHash().
|
inline |
Definition at line 810 of file shape_poly_set.h.
References m_polys.
Referenced by TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyset(), BuildBBoxCaches(), collide(), containsSingle(), KIGFX::PCB_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape(), GEOM_TEST::IsPolySetValid(), ZONE_CREATE_HELPER::performZoneCutout(), PlotLayerOutlines(), and HYPERLYNX_EXPORTER::writeNetObjects().
|
inline |
Definition at line 909 of file shape_poly_set.h.
References CIterate(), and OutlineCount().
Referenced by CIterate(), CIterate(), CIterateWithHoles(), and CIterateWithHoles().
|
inline |
Definition at line 885 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, OutlineCount(), and SHAPE_POLY_SET().
Referenced by processClosedShape().
|
inline |
Definition at line 899 of file shape_poly_set.h.
References CIterate().
|
inline |
Returns an iterator object, for all outlines in the set (no holes)
Definition at line 990 of file shape_poly_set.h.
References CIterateSegments(), and OutlineCount().
Referenced by CIterateSegments(), CIterateSegments(), CIterateSegmentsWithHoles(), and CIterateSegmentsWithHoles().
|
inline |
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (default: without)
Definition at line 956 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, OutlineCount(), and SHAPE_POLY_SET().
Referenced by nearestPointsSingleShapes(), projectPointOnSegment(), and segPolyIntersection().
|
inline |
Return an iterator object, for iterating aPolygonIdx-th polygon edges.
Definition at line 978 of file shape_poly_set.h.
References CIterateSegments().
|
inline |
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition at line 1008 of file shape_poly_set.h.
References CIterateSegments(), and OutlineCount().
Referenced by CREEPAGE_GRAPH::Addshape(), CollideEdge(), GenerateHatchLines(), IsPolygonSelfIntersecting(), SquaredDistanceToPolygon(), and SquaredDistanceToPolygon().
|
inline |
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition at line 1014 of file shape_poly_set.h.
References CIterateSegments().
|
inline |
Definition at line 914 of file shape_poly_set.h.
References CIterate(), and OutlineCount().
Referenced by CollideVertex(), and GenerateHatchLines().
|
inline |
Definition at line 904 of file shape_poly_set.h.
References CIterate().
Referenced by POLYGON_POINT_EDIT_BEHAVIOR::BuildForPolyOutline(), PCB_GRID_HELPER::computeAnchors(), and hash_fp_item().
void SHAPE_POLY_SET::ClearArcs | ( | ) |
Removes all arc references from all the outlines and holes in the polyset.
Definition at line 636 of file shape_poly_set.cpp.
References ClearArcs(), and m_polys.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), STEP_PCB_MODEL::AddPadShape(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), EXPORTER_STEP::buildBoard3DShapes(), ZONE::BuildSmoothedPoly(), cacheTriangulation(), ClearArcs(), collidesWithArea(), CONVERT_TOOL::CreatePolys(), ZONE_FILLER::fillNonCopperZone(), PCB_BASE_FRAME::FocusOnItems(), PCB_TUNING_PATTERN::getOutline(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), isCopperOutside(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), mergeZones(), POLYGON_INTERSECT_ROUTINE::ProcessSubsequentPolygon(), POLYGON_MERGE_ROUTINE::ProcessSubsequentPolygon(), POLYGON_SUBTRACT_ROUTINE::ProcessSubsequentPolygon(), and ZONE_FILLER::subtractHigherPriorityZones().
|
overridevirtual |
Return a dynamically allocated copy of the shape.
copy | of the shape |
Reimplemented from SHAPE.
Definition at line 148 of file shape_poly_set.cpp.
References SHAPE::SHAPE(), and SHAPE_POLY_SET().
SHAPE_POLY_SET SHAPE_POLY_SET::CloneDropTriangulation | ( | ) | const |
Definition at line 154 of file shape_poly_set.cpp.
References SHAPE_POLY_SET(), and SINGLETON.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), FEATURES_MANAGER::AddShape(), ZONE::BuildSmoothedPoly(), collidesWithArea(), ZONE_FILLER::fillCopperZone(), GERBER_PLOTTER::FlashPadCustom(), FEATURES_MANAGER::InitFeatureList(), isCopperOutside(), BRDITEMS_PLOTTER::PlotShape(), PlotStandardLayer(), RENDER_3D_OPENGL::reload(), DRC_TEST_PROVIDER_DISALLOW::Run(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), DXF_PLOTTER::ThickPoly(), EDA_SHAPE::UpdateHatching(), HYPERLYNX_EXPORTER::writeNetObjects(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().
|
virtualinherited |
Check if the boundary of shape (this) lies closer to the shape aShape than aClearance, indicating a collision.
aShape | shape to check collision against |
aClearance | minimum clearance |
aMTV | [out] minimum translation vector |
aActual | [out] an optional pointer to an int to store the actual distance in the event of a collision. |
aLocation | [out] an option pointer to a point to store a nearby location in the event of a collision. |
Reimplemented in SHAPE_COMPOUND, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 1195 of file shape_collisions.cpp.
References collideShapes(), and SHAPE().
|
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 2218 of file shape_poly_set.cpp.
References SEG::Square(), and SquaredDistanceToSeg().
|
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 2263 of file shape_poly_set.cpp.
References actual, CacheTriangulation(), circle(), SHAPE::Collide(), Collide(), SHAPE_SEGMENT::GetSeg(), SHAPE_SEGMENT::GetWidth(), location, m_triangulatedPolys, SH_CIRCLE, SH_SEGMENT, SHAPE::SHAPE(), SHAPE_POLY_SET(), and SHAPE_BASE::Type().
Referenced by Collide(), collideSingleShapes(), collidesWithArea(), collidesWithCourtyard(), PAD::doCheckPad(), DRAWING_TOOL::DrawVia(), ZONE_FILLER::Fill(), EDA_SHAPE::hitTest(), FOOTPRINT::HitTestAccurate(), PCB_SELECTION_TOOL::hitTestDistance(), ZONE_FILLER::knockoutThermalReliefs(), DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstZones(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer(), and DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZonesToZones().
|
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 2239 of file shape_poly_set.cpp.
References IsEmpty(), SEG::Square(), SquaredDistance(), and VertexCount().
bool SHAPE_POLY_SET::CollideEdge | ( | const VECTOR2I & | aPoint, |
SHAPE_POLY_SET::VERTEX_INDEX * | aClosestVertex = nullptr, | ||
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 2519 of file shape_poly_set.cpp.
References CIterateSegmentsWithHoles(), SEG::Square(), and SEG::SquaredDistance().
Referenced by EDA_SHAPE::hitTest(), and SCHEMATIC::RecalculateConnections().
bool SHAPE_POLY_SET::CollideVertex | ( | const VECTOR2I & | aPoint, |
SHAPE_POLY_SET::VERTEX_INDEX * | aClosestVertex = nullptr, | ||
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 2479 of file shape_poly_set.cpp.
References CIterateWithHoles(), delta, and SEG::Square().
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 2564 of file shape_poly_set.cpp.
References containsSingle(), m_polys, and OutlineCount().
Referenced by AUTOPLACE_TOOL::autoplaceOffboard(), CollectKnockedOutSegments(), ZONE_FILLER::fillCopperZone(), CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad(), GERBER_DRAW_ITEM::HitTest(), PAD::HitTest(), PATH_CONNECTION::isValid(), segPolyIntersection(), and BOARD::TestZoneIntersection().
|
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 2620 of file shape_poly_set.cpp.
References CHole(), HoleCount(), m_polys, SHAPE_LINE_CHAIN_BASE::PointInside(), and PointInside().
Referenced by Contains(), GenerateHatchLines(), SquaredDistanceToPolygon(), and SquaredDistanceToPolygon().
|
inline |
Definition at line 805 of file shape_poly_set.h.
References m_polys.
Referenced by CN_LIST::Add(), PAD::AddPrimitivePoly(), FEATURES_MANAGER::AddShape(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), CN_ZONE_LAYER::AnchorCount(), PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyset(), PCB_CONTROL::ApplyDesignBlockLayout(), BuildBBoxCaches(), BuildConvexHull(), PAD::buildEffectiveShape(), buildPadOutlineAsPolygon(), CN_VISITOR::checkZoneZoneConnection(), ConvertPolygonToBlocks(), MULTICHANNEL_TOOL::copyRuleAreaContents(), GENCAD_EXPORTER::createPadsShapesSection(), CONVERT_TOOL::CreatePolys(), KIGFX::PCB_PAINTER::Draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), KIGFX::CAIRO_GAL_BASE::DrawPolygon(), KIGFX::OPENGL_GAL::DrawPolygon(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), EXPORTER_PCB_VRML::ExportVrmlPolygonSet(), CN_ZONE_LAYER::GetAnchor(), FOOTPRINT::GetBoundingHull(), SHAPE::GetClearance(), FOOTPRINT::GetEffectiveShape(), CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape(), API_HANDLER_PCB::handleGetPadShapeAsPolygon(), CONNECTIVITY_DATA::IsConnectedOnLayer(), FABMASTER::loadGraphics(), FABMASTER::loadPolygon(), PCB_IO_EAGLE::loadPolygon(), SCH_RULE_AREA::MakeEffectiveShapes(), EDA_SHAPE::makeEffectiveShapes(), DSN::SPECCTRA_DB::makePADSTACK(), SHAPE_LINE_CHAIN::OffsetLine(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), PlotLayerOutlines(), DXF_PLOTTER::PlotPoly(), BRDITEMS_PLOTTER::PlotShape(), SHAPE::PointInside(), PointInside(), SHAPE::SquaredDistance(), DXF_PLOTTER::ThickPoly(), PLOTTER::ThickPoly(), DXF_PLOTTER::ThickSegment(), HYPERLYNX_EXPORTER::writeBoardInfo(), HYPERLYNX_EXPORTER::writeNetObjects(), and GBR_TO_PCB_EXPORTER::writePcbPolygon().
|
inline |
Definition at line 815 of file shape_poly_set.h.
References m_polys.
Referenced by GetRelativeIndices(), HasTouchingHoles(), STEP_PCB_MODEL::MakeShapes(), and PlotStandardLayer().
|
inline |
Definition at line 820 of file shape_poly_set.h.
References m_polys.
Referenced by EXPORTER_STEP::buildFootprint3DShapes(), STEP_PCB_MODEL::CreatePCB(), STEP_PCB_MODEL::MakeShapes(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParseFootprint(), and PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer().
const VECTOR2I & SHAPE_POLY_SET::CVertex | ( | int | aGlobalIndex | ) | const |
Return the aGlobalIndex-th vertex in the poly set.
Definition at line 418 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 | ( | int | aIndex, |
int | aOutline, | ||
int | aHole ) const |
Return the index-th vertex in a given hole outline within a given outline.
Definition at line 399 of file shape_poly_set.cpp.
References m_polys.
Referenced by PCB_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::chamferCorner(), EDA_SHAPE::Compare(), CVertex(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), GERBER_FILE_IMAGE::Execute_G_Command(), findVertex(), GenerateHatchLines(), EDIT_TOOL::ModifyLines(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_zones::operator()(), EDA_SHAPE::operator==(), SCH_EDITOR_CONTROL::Paste(), shapeNeedsUpdate(), EDA_SHAPE::Similarity(), POLYGON_POINT_EDIT_BEHAVIOR::UpdatePointsFromOutline(), and zoneNeedsUpdate().
const VECTOR2I & SHAPE_POLY_SET::CVertex | ( | SHAPE_POLY_SET::VERTEX_INDEX | index | ) | const |
Return the index-th vertex in a given hole outline within a given outline.
Definition at line 430 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 1068 of file shape_poly_set.h.
References Inflate().
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), FEATURES_MANAGER::AddShape(), EXPORTER_STEP::buildFootprint3DShapes(), DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees(), EXPORTER_STEP::buildTrack3DShape(), collidesWithArea(), KIGFX::PCB_PAINTER::draw(), ZONE_FILLER::fillCopperZone(), ZONE_FILLER::fillNonCopperZone(), PCB_BASE_FRAME::FocusOnItems(), GenerateLayerPoly(), DRC_TEST_PROVIDER_DISALLOW::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), KIGFX::VIEW::SetCenter(), DXF_PLOTTER::ThickPoly(), and DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow().
void SHAPE_POLY_SET::DeletePolygon | ( | int | aIdx | ) |
Delete aIdx-th polygon from the set.
Definition at line 2429 of file shape_poly_set.cpp.
References m_polys.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), BOOST_AUTO_TEST_CASE(), cacheTriangulation(), ZONE_FILLER::fillCopperZone(), and PlotStandardLayer().
void SHAPE_POLY_SET::DeletePolygonAndTriangulationData | ( | int | aIdx, |
bool | aUpdateHash = true ) |
Delete aIdx-th polygon and its triangulation data from the set.
If called with aUpdateHash false, caller must call UpdateTriangulationDataHash().
Definition at line 2435 of file shape_poly_set.cpp.
References checksum(), m_hash, m_hashValid, m_polys, m_triangulatedPolys, and m_triangulationValid.
|
virtualinherited |
Returns the minimum distance from a given point to this shape.
Always returns zero if the point is inside a closed shape and aOutlineOnly is false.
aP | is the point to test |
Reimplemented in SHAPE_COMPOUND, and SHAPE_LINE_CHAIN.
Definition at line 109 of file shape.cpp.
References SquaredDistance().
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 2865 of file shape_poly_set.cpp.
References FilletPolygon(), m_polys, and SHAPE_POLY_SET().
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 2707 of file shape_poly_set.cpp.
References chamferFilletPolygon(), and FILLETED.
Referenced by Fillet(), and GEOM_TEST::FilletPolySet().
|
overridevirtual |
Reimplemented from SHAPE.
Definition at line 2078 of file shape_poly_set.cpp.
References m_polys, and SHAPE_POLY_SET().
void SHAPE_POLY_SET::Fracture | ( | ) |
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the outer ring to the inner holes.
Definition at line 1665 of file shape_poly_set.cpp.
References fractureSingle(), m_polys, and Simplify().
Referenced by addHoleToPolygon(), PCB_IO_IPC2581::addKnockoutText(), PAD::AddPrimitivePoly(), FEATURES_MANAGER::AddShape(), cacheTriangulation(), BITMAPCONV_INFO::createOutputData(), KIGFX::PCB_PAINTER::draw(), CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape(), CALLBACK_GAL::DrawGlyph(), AR_AUTOPLACER::drawPlacementRoutingMatrix(), EXPORTER_PCB_VRML::ExportStandardLayers(), EXPORTER_PCB_VRML::ExportVrmlSolderMask(), ZONE_FILLER::fillCopperZone(), AR_AUTOPLACER::fillMatrix(), ZONE_FILLER::fillNonCopperZone(), InflateWithLinkedHoles(), FEATURES_MANAGER::InitFeatureList(), KIGFX::knockoutText(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), FABMASTER::loadPolygon(), PAD::MergePrimitivesAsPolygon(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), ALTIUM_PCB::ParseRegions6Data(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), DXF_PLOTTER::PlotPoly(), PlotPolySet(), BRDITEMS_PLOTTER::PlotShape(), BRDITEMS_PLOTTER::PlotText(), RENDER_3D_RAYTRACE_BASE::Reload(), DRC_TEST_PROVIDER_DISALLOW::Run(), TransformRingToPolygon(), PAD::TransformShapeToPolygon(), and ZONE::TransformSmoothedOutlineToPolygon().
|
private |
Definition at line 1657 of file shape_poly_set.cpp.
References ENABLECACHEFRIENDLYFRACTURE, fractureSingleCacheFriendly(), and fractureSingleSlow().
Referenced by Fracture().
int SHAPE_POLY_SET::FullPointCount | ( | ) | const |
Return the number of points in the shape poly set.
mainly for reports
Definition at line 365 of file shape_poly_set.cpp.
References HoleCount(), m_polys, and OutlineCount().
Referenced by STEP_PCB_MODEL::AddPolygonShapes(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), EXPORTER_STEP::buildBoard3DShapes(), STEP_PCB_MODEL::CreatePCB(), FOOTPRINT::GetBoundingHull(), IsPolygonSelfIntersecting(), DRC_TEST_PROVIDER_CONNECTION_WIDTH::Run(), and DRC_TEST_PROVIDER_ZONE_CONNECTIONS::Run().
const std::vector< SEG > SHAPE_POLY_SET::GenerateHatchLines | ( | const std::vector< double > & | aSlopes, |
int | aSpacing, | ||
int | aLineLength ) const |
Definition at line 3311 of file shape_poly_set.cpp.
References SEG::A, std::abs(), SEG::B, CIterateSegmentsWithHoles(), CIterateWithHoles(), containsSingle(), CVertex(), SEG::IntersectsLine(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by EDA_SHAPE::UpdateHatching().
void SHAPE_POLY_SET::GetArcs | ( | std::vector< SHAPE_ARC > & | aArcBuffer | ) | const |
Appends all the arcs in this polyset to aArcBuffer.
Definition at line 623 of file shape_poly_set.cpp.
References m_polys.
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inherited |
Return the actual minimum distance between two shapes.
distance | in IU |
POLY_SETs contain a bunch of polygons that are triangulated. But there are way more triangles than necessary for collision detection. Triangles check three vertices each but for the outline, we only need one. These are also fractured, so we don't need to worry about holes
Definition at line 55 of file shape.cpp.
References SHAPE_POLY_SET::COutline(), SHAPE_BASE::GetIndexableSubshapeCount(), SHAPE_BASE::GetIndexableSubshapes(), SHAPE_POLY_SET::OutlineCount(), SH_POLY_SET, SHAPE(), and SHAPE_BASE::Type().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.
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 200 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().
HASH_128 SHAPE_POLY_SET::GetHash | ( | ) | const |
Definition at line 2908 of file shape_poly_set.cpp.
References checksum(), m_hash, and m_hashValid.
Referenced by DSN::SPECCTRA_DB::makePADSTACK(), and SHAPE_POLY_SET().
|
overridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 3191 of file shape_poly_set.cpp.
References m_triangulatedPolys.
Referenced by GetIndexableSubshapes().
|
overridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 3202 of file shape_poly_set.cpp.
References GetIndexableSubshapeCount(), and m_triangulatedPolys.
bool SHAPE_POLY_SET::GetNeighbourIndexes | ( | int | aGlobalIndex, |
int * | aPrevious, | ||
int * | aNext ) const |
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 436 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 BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::chamferCorner().
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 160 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(), GetNeighbourIndexes(), InsertVertex(), IsVertexInHole(), IterateFromVertexWithHoles(), RemoveVertex(), and SetVertex().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, and SHAPE_SEGMENT.
Definition at line 286 of file shape.h.
Referenced by CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, SHAPE_RECT, and SHAPE_SEGMENT.
Definition at line 289 of file shape.h.
Referenced by SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN().
bool SHAPE_POLY_SET::HasHoles | ( | ) | const |
Return true if the polygon set has any holes.
Definition at line 1841 of file shape_poly_set.cpp.
References m_polys.
Referenced by PAD::AddPrimitivePoly(), cacheTriangulation(), CALLBACK_GAL::DrawGlyph(), and SHAPE_LINE_CHAIN::OffsetLine().
|
overridevirtual |
Reimplemented from SHAPE_BASE.
Definition at line 3185 of file shape_poly_set.cpp.
References IsTriangulationUpToDate().
bool SHAPE_POLY_SET::HasTouchingHoles | ( | ) | const |
Return true if the polygon set has any holes that share a vertex.
Definition at line 3152 of file shape_poly_set.cpp.
References CPolygon(), hasTouchingHoles(), and OutlineCount().
|
private |
Return true if the polygon set has any holes that touch share a vertex.
Definition at line 3164 of file shape_poly_set.cpp.
Referenced by HasTouchingHoles().
|
inline |
Return the reference to aHole-th hole in the aIndex-th outline.
Definition at line 784 of file shape_poly_set.h.
References m_polys.
Referenced by Area(), BuildFootprintPolygonOutlines(), cacheTriangulation(), checkSelfIntersections(), ConvertPolygonToBlocks(), CONVERT_TOOL::CreatePolys(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), FABMASTER::loadFootprints(), FABMASTER::loadShapePolySet(), polygonArea(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), and TransformRingToPolygon().
|
inline |
Returns the number of holes in a given outline.
Definition at line 746 of file shape_poly_set.h.
References m_polys.
Referenced by TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyset(), Area(), BOOST_AUTO_TEST_CASE(), BuildBBoxCaches(), BuildFootprintPolygonOutlines(), cacheTriangulation(), checkSelfIntersections(), collide(), containsSingle(), ConvertPolygonToBlocks(), CONVERT_TOOL::CreatePolys(), KIGFX::PCB_PAINTER::draw(), FullPointCount(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape(), GEOM_TEST::IsPolySetValid(), ZONE_CREATE_HELPER::performZoneCutout(), PlotLayerOutlines(), polygonArea(), DRC_RTREE::QueryColliding(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), and HYPERLYNX_EXPORTER::writeNetObjects().
|
private |
Definition at line 1176 of file shape_poly_set.cpp.
|
private |
Definition at line 1142 of file shape_poly_set.cpp.
References importPolyPath(), and m_polys.
Referenced by importPolyPath(), and importTree().
|
private |
Definition at line 1165 of file shape_poly_set.cpp.
References importPolyPath(), and m_polys.
Referenced by booleanOp(), BuildPolysetFromOrientedPaths(), inflate2(), and inflateLine2().
void SHAPE_POLY_SET::Inflate | ( | int | aAmount, |
CORNER_STRATEGY | aCornerStrategy, | ||
int | aMaxError, | ||
bool | aSimplify = false ) |
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. |
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 |
aMaxError | is the allowable deviation when rounding corners with an approximated polygon |
Definition at line 1124 of file shape_poly_set.cpp.
References std::abs(), FULL_CIRCLE, GetArcToSegmentCount(), and inflate2().
Referenced by BOARD_ADAPTER::addShape(), ZONE_FILLER::buildCopperItemClearances(), ZONE::BuildSmoothedPoly(), CADSTAR_PCB_ARCHIVE_LOADER::calculateZonePriorities(), BOARD_ADAPTER::createPadWithMargin(), CONVERT_TOOL::CreatePolys(), TEARDROP_MANAGER::createTeardropMask(), Deflate(), KIGFX::PCB_PAINTER::draw(), ZONE_FILLER::fillCopperZone(), ZONE_FILLER::fillNonCopperZone(), GenerateLayerPoly(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), InflateWithLinkedHoles(), PATH_CONNECTION::isValid(), CADSTAR_PCB_ARCHIVE_LOADER::loadCoppers(), PCB_IO_EAGLE::loadPolygon(), PCB_IO_EAGLE::packagePolygon(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), ALTIUM_PCB::ParsePolygons6Data(), BRDITEMS_PLOTTER::PlotShape(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DXF_PLOTTER::ThickPoly(), DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow(), EDA_SHAPE::TransformShapeToPolygon(), PAD::TransformShapeToPolygon(), ZONE::TransformSmoothedOutlineToPolygon(), PCB_TEXT::TransformTextToPolySet(), and PCB_TEXTBOX::TransformTextToPolySet().
|
private |
Definition at line 923 of file shape_poly_set.cpp.
References std::abs(), ALLOW_ACUTE_CORNERS, CHAMFER_ACUTE_CORNERS, CHAMFER_ALL_CORNERS, importTree(), M_PI, m_polys, ROUND_ACUTE_CORNERS, ROUND_ALL_CORNERS, and SEG_CNT_MAX.
Referenced by Inflate().
|
private |
Definition at line 1027 of file shape_poly_set.cpp.
References std::abs(), ALLOW_ACUTE_CORNERS, CHAMFER_ACUTE_CORNERS, CHAMFER_ALL_CORNERS, SHAPE_LINE_CHAIN::convertToClipper2(), importTree(), M_PI, path, ROUND_ACUTE_CORNERS, ROUND_ALL_CORNERS, and SEG_CNT_MAX.
Referenced by OffsetLineChain().
void SHAPE_POLY_SET::InflateWithLinkedHoles | ( | int | aFactor, |
CORNER_STRATEGY | aCornerStrategy, | ||
int | aMaxError ) |
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.
Definition at line 914 of file shape_poly_set.cpp.
References Fracture(), Inflate(), and Unfracture().
Referenced by FEATURES_MANAGER::AddPadShape(), PCB_IO_IPC2581::addShape(), PCB_IO_KICAD_LEGACY::loadZONE_CONTAINER(), PlotStandardLayer(), and ZONE::TransformShapeToPolygon().
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. |
Definition at line 318 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(), and PCB_POINT_EDITOR::chamferCorner().
|
inline |
Return true if the set is empty (no polygons at all)
Definition at line 1284 of file shape_poly_set.h.
References m_polys.
Referenced by addOutlinesToPolygon(), STEP_PCB_MODEL::AddPolygonShapes(), BOARD_ADAPTER::addShape(), Collide(), BOARD_ADAPTER::createPadWithMargin(), CONVERT_TOOL::CreatePolys(), TRACKS_CLEANER::deleteTracksInPads(), PAD::doCheckPad(), DRC_ENGINE::EvalRules(), PCB_BASE_FRAME::FocusOnItems(), BOARD_INSPECTION_TOOL::InspectClearance(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_KICAD_SEXPR_PARSER::parseZONE(), PlotStandardLayer(), BRDITEMS_PLOTTER::PlotZone(), PAD::Recombine(), SCH_POINT_EDITOR::removeCornerCondition(), KIGFX::VIEW::SetCenter(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::testCourtyardClearances(), and PCB_SHAPE::UpdateHatching().
Check if two line segments are collinear and overlap.
aSegA | First line segment |
aSegB | Second line segment |
Definition at line 1865 of file shape_poly_set.cpp.
References SEG::A, std::abs(), SEG::B, VECTOR2< T >::EuclideanNorm(), VECTOR2< T >::Perpendicular(), PointInside(), VECTOR2< T >::Resize(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by splitCollinearOutlines().
|
inlineinherited |
Return true if the shape is a null shape.
true | if null :-) |
Definition at line 166 of file shape.h.
References SHAPE_BASE::m_type, and SH_NULL.
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 486 of file shape_poly_set.cpp.
References SEG::A, std::abs(), SEG::B, CIterateSegmentsWithHoles(), SEG::Collide(), FullPointCount(), SEG::Index(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by IsSelfIntersecting().
bool SHAPE_POLY_SET::IsSelfIntersecting | ( | ) | const |
Check whether any of the polygons in the set is self intersecting.
Definition at line 536 of file shape_poly_set.cpp.
References IsPolygonSelfIntersecting(), and m_polys.
Referenced by cacheTriangulation().
|
inlineoverridevirtual |
Implements SHAPE.
Definition at line 1159 of file shape_poly_set.h.
bool SHAPE_POLY_SET::IsTriangulationUpToDate | ( | ) | const |
Definition at line 2917 of file shape_poly_set.cpp.
References checksum(), m_hash, m_hashValid, 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 2841 of file shape_poly_set.cpp.
References GetRelativeIndices(), and SHAPE_POLY_SET::VERTEX_INDEX::m_contour.
|
inline |
Definition at line 870 of file shape_poly_set.h.
References Iterate(), and OutlineCount().
Referenced by Iterate(), Iterate(), IterateWithHoles(), and IterateWithHoles().
|
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 832 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 PCB_POINT_EDITOR::chamferCorner().
|
inline |
aOutline | is the index of the polygon to be iterated. |
Definition at line 851 of file shape_poly_set.h.
References Iterate().
|
inline |
Definition at line 919 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 all outlines in the set (no holes).
Definition at line 984 of file shape_poly_set.h.
References IterateSegments(), and OutlineCount().
Referenced by IterateSegments(), IterateSegments(), IterateSegmentsWithHoles(), and IterateSegmentsWithHoles().
|
inline |
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (default: without)
Definition at line 940 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 972 of file shape_poly_set.h.
References IterateSegments().
|
inline |
Returns an iterator object, for all outlines in the set (with holes)
Definition at line 996 of file shape_poly_set.h.
References IterateSegments(), and OutlineCount().
Referenced by checkSelfIntersections(), GENCAD_EXPORTER::createBoardSection(), and BOARD::TestZoneIntersection().
|
inline |
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition at line 1002 of file shape_poly_set.h.
References IterateSegments().
|
inline |
Definition at line 879 of file shape_poly_set.h.
References Iterate(), and OutlineCount().
Referenced by IterateFromVertexWithHoles(), and RemoveNullSegments().
|
inline |
aOutline | the index of the polygon to be iterated. |
Definition at line 861 of file shape_poly_set.h.
References Iterate().
Referenced by findVertex(), and BOARD::TestZoneIntersection().
void SHAPE_POLY_SET::Mirror | ( | const VECTOR2I & | aRef, |
FLIP_DIRECTION | aFlipDirection ) |
Mirror the line points about y or x (or both)
aRef | sets the reference point about which to mirror |
aFlipDirection | is the direction to mirror the points. |
Definition at line 2660 of file shape_poly_set.cpp.
References CacheTriangulation(), m_polys, m_triangulationValid, and path.
Referenced by GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), and FABMASTER::loadFootprints().
|
overridevirtual |
Implements SHAPE.
Definition at line 2644 of file shape_poly_set.cpp.
References checksum(), m_hash, m_hashValid, m_polys, m_triangulatedPolys, and path.
Referenced by FEATURES_MANAGER::AddPadShape(), TEARDROP_MANAGER::computeAnchorPoints(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItemOnLayer(), SCH_FIELD::GetRenderCache(), GERBER_DRAW_ITEM::HitTest(), FABMASTER::loadFootprints(), CADSTAR_PCB_ARCHIVE_LOADER::loadLibraryCoppers(), playground_main_func(), TransformOvalToPolygon(), TransformRoundChamferedRectToPolygon(), PAD::TransformShapeToPolygon(), and TransformTrapezoidToPolygon().
|
inherited |
Return the two points that mark the closest distance between this shape and aOther.
Public interface for finding nearest points between two shapes.
If the shapes are overlapping, the points will be the same.
aOther | the other shape to compare with |
aPtThis | [out] the point on this shape closest to aOther |
aPtOther | [out] the point on aOther closest to this shape |
aA | first shape |
aB | second shape |
aPtA | [out] nearest point on first shape |
aPtB | [out] nearest point on second shape |
Definition at line 911 of file shape_nearest_points.cpp.
References nearestPoints(), and SHAPE().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inherited |
Definition at line 695 of file wrlfacet.cpp.
References facets.
Referenced by WRL1FACESET::TranslateToSG(), WRL2FACESET::TranslateToSG(), and X3DIFACESET::TranslateToSG().
int SHAPE_POLY_SET::NewHole | ( | int | aOutline = -1 | ) |
Creates a new hole in a given outline.
Definition at line 251 of file shape_poly_set.cpp.
References m_polys, and SHAPE_LINE_CHAIN::SetClosed().
Referenced by TransformRingToPolygon().
int SHAPE_POLY_SET::NewOutline | ( | ) |
Creates a new empty polygon in the set and returns its index.
Definition at line 239 of file shape_poly_set.cpp.
References m_polys, and SHAPE_LINE_CHAIN::SetClosed().
Referenced by addHoleToPolygon(), ZONE_FILLER::addKnockout(), PCB_IO_IPC2581::addShape(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BuildBoardPolygonOutlines(), PCB_TEXT::buildBoundingHull(), BuildFootprintPolygonOutlines(), TEARDROP_MANAGER::computeAnchorPoints(), AM_PRIMITIVE::ConvertBasicShapeToPolygon(), ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), CornerListToPolygon(), BITMAPCONV_INFO::createOutputData(), BOARD_ADAPTER::createPadWithMargin(), TEARDROP_MANAGER::createTeardrop(), TEARDROP_MANAGER::createTeardropMask(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), fillArcPOLY(), PCB_BASE_FRAME::FocusOnItems(), FOOTPRINT::GetBoundingHull(), FOOTPRINT::GetBoundingHull(), getRectangleAlongCentreLine(), EDA_SHAPE::hitTest(), TEST_EE_ITEM_FIXTURE::Instantiate(), KIGFX::knockoutText(), FABMASTER::loadFootprints(), PCB_IO_EAGLE::loadPolygon(), FABMASTER::loadShapePolySet(), FABMASTER::loadZone(), PCB_IO_KICAD_LEGACY::loadZONE_CONTAINER(), CONVERT_TOOL::makePolysFromClosedGraphics(), RULE_AREA_CREATE_HELPER::OnComplete(), PCB_IO_KICAD_SEXPR_PARSER::parseTextBoxContent(), PCB_IO_KICAD_SEXPR_PARSER::parseZONE(), DXF_PLOTTER::PlotPoly(), BRDITEMS_PLOTTER::PlotShape(), PlotStandardLayer(), SHAPE_POLY_SET(), DS_DATA_ITEM_POLYGONS::SyncDrawItems(), TransformArcToPolygon(), TransformCircleToPolygon(), TransformOvalToPolygon(), EDA_SHAPE::TransformShapeToPolygon(), PCB_TEXTBOX::TransformShapeToPolygon(), PCB_TEXT::TransformTextToPolySet(), PCB_TEXTBOX::TransformTextToPolySet(), ROUNDRECT::TransformToPolygon(), SHAPE_RECT::TransformToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), and PCB_DIM_RADIAL::updateGeometry().
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 2043 of file shape_poly_set.cpp.
References AddOutline(), BooleanSubtract(), OutlineCount(), Polygon(), RemoveNullSegments(), SHAPE_POLY_SET(), and Simplify().
Referenced by BITMAPCONV_INFO::createOutputData().
void SHAPE_POLY_SET::OffsetLineChain | ( | const SHAPE_LINE_CHAIN & | aLine, |
int | aAmount, | ||
CORNER_STRATEGY | aCornerStrategy, | ||
int | aMaxError, | ||
bool | aSimplify ) |
Perform offsetting of a line chain.
Replaces this polygon set with the result.
aLine | is the line to perform offsetting on. |
aAmount | is the number of units to offset the line chain. |
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 |
aMaxError | is the allowable deviation when rounding corners with an approximated polygon |
aSimplify | set to simplify the output polygon. |
Definition at line 1133 of file shape_poly_set.cpp.
References std::abs(), FULL_CIRCLE, GetArcToSegmentCount(), and inflateLine2().
Referenced by PCB_TUNING_PATTERN::getOutline(), and SHAPE_LINE_CHAIN::OffsetLine().
SHAPE_POLY_SET & SHAPE_POLY_SET::operator= | ( | const SHAPE_POLY_SET & | aOther | ) |
Definition at line 2876 of file shape_poly_set.cpp.
References IsTriangulationUpToDate(), m_hash, m_hashValid, m_polys, m_triangulatedPolys, m_triangulationValid, SHAPE_POLY_SET(), TriangulatedPolyCount(), and TriangulatedPolygon().
|
inlinenoexcept |
Definition at line 553 of file shape_poly_set.h.
References m_hash, m_hashValid, m_polys, m_triangulatedPolys, m_triangulationValid, and SHAPE_POLY_SET().
|
inline |
Return the reference to aIndex-th outline in the set.
Definition at line 757 of file shape_poly_set.h.
References m_polys.
Referenced by PCB_IO_IPC2581::addContourNode(), SCH_POINT_EDITOR::addCorner(), ZONE_FILLER::addHatchFillTypeOnZone(), PCB_IO_IPC2581::addOutlineNode(), addOutlinesToPolygon(), PCB_IO_IPC2581::addPackage(), BOARD_ADAPTER::addShape(), Area(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BuildBoardPolygonOutlines(), BuildFootprintPolygonOutlines(), ZONE::BuildSmoothedPoly(), ZONE_FILLER::buildThermalSpokes(), cacheTriangulation(), FOOTPRINT::CheckNetTies(), checkSelfIntersections(), KI_TEST::CheckShapePolySet(), collide(), collidesWithArea(), TEARDROP_MANAGER::computeAnchorPoints(), ZONE_FILLER::connect_nearby_polys(), ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer(), ConvertPolygonToBlocks(), FOOTPRINT::CoverageRatio(), BITMAPCONV_INFO::createOutputData(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), KIGFX::DS_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), CALLBACK_GAL::DrawGlyph(), DRAWING_TOOL::DrawVia(), GBR_TO_PCB_EXPORTER::export_flashed_copper_item(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), AR_AUTOPLACER::fillMatrix(), TEARDROP_MANAGER::findAnchorPointsOnTrack(), CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins(), GERBER_PLOTTER::FlashPadChamferRoundRect(), DXF_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadCustom(), PSLIKE_PLOTTER::FlashPadCustom(), DXF_PLOTTER::FlashPadRoundRect(), PSLIKE_PLOTTER::FlashPadRoundRect(), PCB_IO_KICAD_SEXPR::format(), PCB_IO_KICAD_SEXPR::format(), PCB_IO_KICAD_SEXPR::format(), formatPoly(), PCB_IO_IPC2581::generateProfile(), BOARD::GetBoardPolygonOutlines(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), PCB_SHAPE::GetFocusPosition(), PCB_TUNING_PATTERN::getOutline(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart(), EDA_SHAPE::hitTest(), PNS::HOLE::Hull(), PNS::SOLID::Hull(), TEST_EE_ITEM_FIXTURE::Instantiate(), GEOM_TEST::IsPolySetValid(), EDA_SHAPE::IsPolyShapeValid(), FABMASTER::loadFootprints(), FABMASTER::loadZone(), EDA_SHAPE::makeEffectiveShapes(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), RULE_AREA_CREATE_HELPER::OnComplete(), ZONE_CREATE_HELPER::OnComplete(), SHAPE_RECT::Outline(), PCB_IO_EASYEDAPRO_PARSER::ParseContour(), ALTIUM_PCB::ParsePolygons6Data(), SCH_IO_KICAD_SEXPR_PARSER::ParseSchematic(), SCH_IO_KICAD_SEXPR_PARSER::parseSchRuleArea(), PCB_IO_KICAD_SEXPR_PARSER::parseTextBoxContent(), PCB_IO_KICAD_SEXPR_PARSER::parseZONE(), ZONE_CREATE_HELPER::performZoneCutout(), playground_main_func(), PlotDrawingSheet(), BRDITEMS_PLOTTER::PlotShape(), BRDITEMS_PLOTTER::PlotText(), BRDITEMS_PLOTTER::PlotZone(), polygonArea(), processClosedShape(), DRC_RTREE::QueryColliding(), SCH_POINT_EDITOR::removeCorner(), SCH_POINT_EDITOR::removeCornerCondition(), DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), SCH_IO_KICAD_LEGACY_LIB_CACHE::savePolyLine(), SHAPE_POLY_SET(), EDIT_TOOL::SimplifyPolygons(), ZONE_FILLER::subtractHigherPriorityZones(), PNS_KICAD_IFACE_BASE::syncTextItem(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), DRC_TEST_PROVIDER_ZONE_CONNECTIONS::testZoneLayer(), DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow(), TransformArcToPolygon(), EDA_SHAPE::TransformShapeToPolygon(), ROUNDRECT::TransformToPolygon(), SHAPE_RECT::TransformToPolygon(), VERTEX_CONNECTOR::VERTEX_CONNECTOR(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().
|
inline |
Definition at line 762 of file shape_poly_set.h.
References m_polys.
|
inline |
Return the number of outlines in the set.
Definition at line 736 of file shape_poly_set.h.
References m_polys.
Referenced by FEATURES_MANAGER::AddContour(), PCB_IO_IPC2581::addContourNode(), PCB_POINT_EDITOR::addCorner(), ZONE_FILLER::addHatchFillTypeOnZone(), PCB_IO_IPC2581::addKnockoutText(), PCB_IO_IPC2581::addOutlineNode(), addOutlinesToPolygon(), EDA_DATA::AddPackage(), PCB_IO_IPC2581::addPackage(), FEATURES_MANAGER::AddPadShape(), PAD::AddPrimitivePoly(), FEATURES_MANAGER::AddShape(), PCB_IO_IPC2581::addShape(), TRIANGLE_DISPLAY_LIST::AddToMiddleContourns(), PNS_LOG_VIEWER_OVERLAY::AnnotatedPolyset(), Area(), booleanOp(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_FIXTURE_TEST_CASE(), BuildBBoxCaches(), BuildBoardPolygonOutlines(), BuildConvexHull(), BuildFootprintPolygonOutlines(), ZONE::BuildSmoothedPoly(), ZONE_FILLER::buildThermalSpokes(), cacheTriangulation(), PCB_POINT_EDITOR::chamferCorner(), FOOTPRINT::CheckNetTies(), checkSelfIntersections(), KI_TEST::CheckShapePolySet(), CIterate(), CIterate(), CIterateSegments(), CIterateSegments(), CIterateSegmentsWithHoles(), CIterateWithHoles(), collide(), collidesWithArea(), ZONE_FILLER::connect_nearby_polys(), Contains(), ConvertPolygonToBlocks(), RENDER_3D_OPENGL::createBoard(), BITMAPCONV_INFO::createOutputData(), GENCAD_EXPORTER::createPadsShapesSection(), STEP_PCB_MODEL::CreatePCB(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), CONVERT_TOOL::CreatePolys(), PAD::doCheckPad(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::drawApertureMacro(), KIGFX::GERBVIEW_PAINTER::drawFlashedShape(), CALLBACK_GAL::DrawGlyph(), AR_AUTOPLACER::drawPlacementRoutingMatrix(), KIGFX::CAIRO_GAL_BASE::DrawPolygon(), KIGFX::OPENGL_GAL::DrawPolygon(), KIGFX::GERBVIEW_PAINTER::drawPolygon(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), DRAWING_TOOL::DrawVia(), GERBER_FILE_IMAGE::Execute_DCODE_Command(), GBR_TO_PCB_EXPORTER::export_copper_item(), EXPORTER_PCB_VRML::ExportVrmlPolygonSet(), fillArcPOLY(), ZONE_FILLER::fillCopperZone(), GEOM_TEST::FilletPolySet(), DXF_PLOTTER::FlashPadCustom(), GERBER_PLOTTER::FlashPadCustom(), PSLIKE_PLOTTER::FlashPadCustom(), formatPoly(), FullPointCount(), RENDER_3D_OPENGL::generateHoles(), RENDER_3D_OPENGL::generateLayerList(), PCB_IO_IPC2581::generateLayerSetNet(), RENDER_3D_OPENGL::generateViasAndPads(), APERTURE_MACRO::GetApertureMacroShape(), BOARD::GetBoardPolygonOutlines(), GERBER_DRAW_ITEM::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), SHAPE::GetClearance(), PCB_SHAPE::GetCorners(), EDA_SHAPE::GetCornersInSequence(), DIALOG_BOARD_STATISTICS::getDataFromPCB(), FOOTPRINT::GetEffectiveShape(), PCB_TUNING_PATTERN::getOutline(), EDA_SHAPE::GetPointCount(), CADSTAR_PCB_ARCHIVE_LOADER::getPolySetFromCadstarShape(), GetRelativeIndices(), HasTouchingHoles(), FEATURES_MANAGER::InitFeatureList(), isCopperOutside(), GEOM_TEST::IsPolySetValid(), EDA_SHAPE::IsPolyShapeValid(), Iterate(), Iterate(), IterateSegments(), IterateSegments(), IterateSegmentsWithHoles(), IterateWithHoles(), FABMASTER::loadFootprints(), FABMASTER::loadGraphics(), FABMASTER::loadPolygon(), PCB_IO_EAGLE::loadPolygon(), SCH_RULE_AREA::MakeEffectiveShapes(), EDA_SHAPE::makeEffectiveShapes(), PAD::MergePrimitivesAsPolygon(), NormalizeAreaOutlines(), SHAPE_LINE_CHAIN::OffsetLine(), kiapi::common::PackPolySet(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParseFootprint(), ALTIUM_PCB::ParsePolygons6Data(), PCB_IO_KICAD_SEXPR_PARSER::parseRenderCache(), PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(), ZONE_CREATE_HELPER::performZoneCutout(), playground_main_func(), SCH_SHAPE::Plot(), PlotLayerOutlines(), DXF_PLOTTER::PlotPoly(), BRDITEMS_PLOTTER::PlotShape(), PlotStandardLayer(), BRDITEMS_PLOTTER::PlotText(), BRDITEMS_PLOTTER::PlotZone(), SHAPE::PointInside(), PointInside(), polygon_triangulation_main(), polygonArea(), POLYGON_INTERSECT_ROUTINE::ProcessSubsequentPolygon(), DRC_RTREE::QueryColliding(), RENDER_3D_RAYTRACE_BASE::Reload(), DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), DIALOG_FOOTPRINT_CHECKER::runChecks(), SHAPE::SquaredDistance(), Subset(), PNS_KICAD_IFACE_BASE::syncTextItem(), TestConcaveSquareFillet(), DRC_INTERACTIVE_COURTYARD_CLEARANCE::testCourtyardClearances(), DRC_TEST_PROVIDER_COURTYARD_CLEARANCE::testCourtyardClearances(), TestSquareFillet(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), EDA_SHAPE::TransformShapeToPolygon(), VERTEX_CONNECTOR::VERTEX_CONNECTOR(), HYPERLYNX_EXPORTER::writeBoardInfo(), HYPERLYNX_EXPORTER::writeNetObjects(), GBR_TO_PCB_EXPORTER::writePcbPolygon(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().
|
overridevirtual |
Reimplemented from SHAPE.
Definition at line 2109 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Append(), m_polys, SHAPE_LINE_CHAIN::SetClosed(), VECTOR2< T >::x, and VECTOR2< T >::y.
|
overridevirtual |
Check if point aP lies inside a closed shape.
Always returns false if this shape is not closed.
aPt | point to check |
aUseBBoxCache | gives better performance if the bounding box caches have been generated. |
Reimplemented from SHAPE.
Definition at line 3299 of file shape_poly_set.cpp.
References COutline(), OutlineCount(), and PointInside().
Referenced by containsSingle(), isExteriorWaist(), and PointInside().
bool SHAPE_POLY_SET::PointOnEdge | ( | const VECTOR2I & | aP, |
int | aAccuracy = 0 ) 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 2201 of file shape_poly_set.cpp.
References m_polys.
Referenced by PATH_CONNECTION::isValid().
|
inline |
Return the aIndex-th subpolygon in the set.
Definition at line 790 of file shape_poly_set.h.
References m_polys.
Referenced by FEATURES_MANAGER::AddContour(), PCB_IO_IPC2581::addContourNode(), EDA_DATA::AddPackage(), cacheTriangulation(), chamferFilletPolygon(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), ZONE_FILLER::fillCopperZone(), PCB_IO_KICAD_SEXPR::format(), GetGlobalIndex(), FABMASTER::loadFootprints(), STEP_PCB_MODEL::MakeShapes(), NormalizeAreaOutlines(), kiapi::common::PackPolySet(), polygon_triangulation_main(), PCB_POINT_EDITOR::removeCorner(), PCB_POINT_EDITOR::removeCornerCondition(), and Subset().
|
inline |
Definition at line 795 of file shape_poly_set.h.
References m_polys.
void SHAPE_POLY_SET::RebuildHolesFromContours | ( | ) |
Extract all contours from this polygon set, then recreate polygons with holes.
Essentially XOR'ing, but faster. Self-intersecting polygons are not supported.
Definition at line 646 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::CPoint(), m_polys, path, SHAPE_LINE_CHAIN_BASE::PointInside(), process, result, and SHAPE_POLY_SET().
Referenced by PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParseFootprint(), and PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer().
void SHAPE_POLY_SET::RemoveAllContours | ( | ) |
Remove all outlines & holes (clears) the polygon set.
Definition at line 2346 of file shape_poly_set.cpp.
References m_polys, m_triangulatedPolys, and m_triangulationValid.
Referenced by buildBoardBoundingBoxPoly(), BuildBoardPolygonOutlines(), DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees(), GERBER_DRAW_ITEM::ConvertSegmentToPolygon(), BITMAPCONV_INFO::createOutputData(), EXPORTER_PCB_VRML::ExportStandardLayers(), EXPORTER_PCB_VRML::ExportVrmlSolderMask(), RENDER_3D_OPENGL::generateViasAndPads(), APERTURE_MACRO::GetApertureMacroShape(), PAD::MergePrimitivesAsPolygon(), PCB_IO_KICAD_SEXPR_PARSER::parseTextBoxContent(), and PlotLayerOutlines().
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 2354 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 2370 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 BOOST_AUTO_TEST_CASE(), chamferFilletPolygon(), and NormalizeAreaOutlines().
void SHAPE_POLY_SET::RemoveOutline | ( | int | aOutlineIdx | ) |
Delete the aOutlineIdx-th outline of the set including its contours and holes.
aOutlineIdx | is the index of the outline to be removed. |
Definition at line 2364 of file shape_poly_set.cpp.
References m_polys.
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 2585 of file shape_poly_set.cpp.
References GetRelativeIndices(), and RemoveVertex().
Referenced by PCB_POINT_EDITOR::chamferCorner(), PCB_POINT_EDITOR::removeCorner(), RemoveNullSegments(), and RemoveVertex().
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. |
Definition at line 2597 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. |
Implements SHAPE.
Definition at line 2673 of file shape_poly_set.cpp.
References CacheTriangulation(), m_polys, m_triangulationValid, and path.
Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), FEATURES_MANAGER::AddPadShape(), PCB_TEXT::buildBoundingHull(), TEARDROP_MANAGER::computeAnchorPoints(), ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer(), FABMASTER::loadFootprints(), BRDITEMS_PLOTTER::PlotText(), OUTSET_ROUTINE::ProcessItem(), TransformOvalToPolygon(), TransformRoundChamferedRectToPolygon(), PAD::TransformShapeToPolygon(), TransformTrapezoidToPolygon(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_LEADER::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), and PCB_DIM_RADIAL::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 2614 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 SetVertex(), and POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints().
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 vertex |
Definition at line 2603 of file shape_poly_set.cpp.
References GetRelativeIndices(), and SetVertex().
|
inlinevirtualinherited |
Reimplemented in SHAPE_ARC, SHAPE_LINE_CHAIN, and SHAPE_SEGMENT.
void SHAPE_POLY_SET::Simplify | ( | ) |
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
Definition at line 2021 of file shape_poly_set.cpp.
References booleanOp(), empty(), SHAPE_POLY_SET(), and splitCollinearOutlines().
Referenced by FEATURES_MANAGER::AddShape(), BOARD_ADAPTER::addShape(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), EXPORTER_STEP::buildBoard3DShapes(), ZONE_FILLER::buildCopperItemClearances(), DRC_TEST_PROVIDER_SOLDER_MASK::buildRTrees(), cacheTriangulation(), FOOTPRINT::CheckNetTies(), BOARD_ADAPTER::createLayers(), BITMAPCONV_INFO::createOutputData(), CONVERT_TOOL::CreatePolys(), Fracture(), GenerateLayerPoly(), BOARD::GetBoardPolygonOutlines(), PNS::HOLE::Hull(), PNS::SOLID::Hull(), DSN::SPECCTRA_DB::makeIMAGE(), STEP_PCB_MODEL::MakeShapes(), PAD::MergePrimitivesAsPolygon(), NormalizeAreaOutlines(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), PCB_IO_EASYEDAPRO_PARSER::ParseFootprint(), PlotLayerOutlines(), DRC_TEST_PROVIDER_SLIVER_CHECKER::Run(), DRC_TEST_PROVIDER_TEXT_DIMS::Run(), PNS_KICAD_IFACE_BASE::syncTextItem(), DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testZoneLayer(), PCB_TEXT::TransformTextToPolySet(), PCB_TEXTBOX::TransformTextToPolySet(), Unfracture(), HYPERLYNX_EXPORTER::writeNetObjects(), and GBR_TO_PCB_EXPORTER::writePcbZoneItem().
void SHAPE_POLY_SET::SimplifyOutlines | ( | int | aMaxError = 0 | ) |
Simplifies the lines in the polyset.
This checks intermediate points to see if they are collinear with their neighbors, and removes them if they are.
aMaxError | is the maximum error to allow when simplifying the lines. |
Definition at line 2031 of file shape_poly_set.cpp.
Referenced by EXPORTER_STEP::buildZones3DShape(), cacheTriangulation(), and EDIT_TOOL::SimplifyPolygons().
|
private |
Definition at line 1909 of file shape_poly_set.cpp.
References SHAPE_LINE_CHAIN::Append(), SEG::ApproxCollinear(), SHAPE_LINE_CHAIN::CPoint(), isExteriorWaist(), m_polys, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::SetClosed(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Simplify().
SEG::ecoord SHAPE_POLY_SET::SquaredDistance | ( | const VECTOR2I & | aPoint, |
bool | aOutlineOnly, | ||
VECTOR2I * | aNearest ) 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 2787 of file shape_poly_set.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, m_polys, and SquaredDistanceToPolygon().
Referenced by Collide(), and SquaredDistance().
|
inlineoverridevirtual |
Reimplemented from SHAPE.
Definition at line 1438 of file shape_poly_set.h.
References 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 2750 of file shape_poly_set.cpp.
References SEG::A, SEG::B, CIterateSegmentsWithHoles(), and containsSingle().
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 2714 of file shape_poly_set.cpp.
References CIterateSegmentsWithHoles(), and containsSingle().
Referenced by SquaredDistance(), and SquaredDistanceToSeg().
SEG::ecoord SHAPE_POLY_SET::SquaredDistanceToSeg | ( | 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 2816 of file shape_poly_set.cpp.
References VECTOR2< int32_t >::ECOORD_MAX, m_polys, and SquaredDistanceToPolygon().
Referenced by BOOST_AUTO_TEST_CASE(), Collide(), and DRC_TEST_PROVIDER_ANNULAR_WIDTH::Run().
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 386 of file shape_poly_set.cpp.
References m_polys, OutlineCount(), Polygon(), and SHAPE_POLY_SET().
Referenced by UnitSet().
int SHAPE_POLY_SET::TotalVertices | ( | ) | const |
Return total number of vertices stored in the set.
Definition at line 2687 of file shape_poly_set.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), POLYGON_POINT_EDIT_BEHAVIOR::BuildForPolyOutline(), KI_TEST::CheckShapePolySet(), EDA_SHAPE::Compare(), InsertVertex(), FOOTPRINT::cmp_drawings::operator()(), FOOTPRINT::cmp_zones::operator()(), shapeNeedsUpdate(), EDA_SHAPE::Similarity(), POLYGON_POINT_EDIT_BEHAVIOR::UpdateOutlineFromPoints(), POLYGON_POINT_EDIT_BEHAVIOR::UpdatePointsFromOutline(), and zoneNeedsUpdate().
|
inlineoverridevirtual |
Fills a SHAPE_POLY_SET with a polygon representation of this shape.
aBuffer | [out] will be filled with the polygonal representation of this shape. |
aError | controls the maximum allowed deviation when converting rounded shapes to segments |
aErrorLoc | controls where the error is placed when approximating rounded shapes |
Implements SHAPE.
Definition at line 1474 of file shape_poly_set.h.
References Append(), and SHAPE_POLY_SET().
|
inline |
Return the number of triangulated polygons.
Definition at line 733 of file shape_poly_set.h.
References m_triangulatedPolys.
Referenced by KIFONT::OUTLINE_GLYPH::CacheTriangulation(), ConvertPolygonToTriangles(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), operator=(), PNS_KICAD_IFACE_BASE::syncZone(), and KIFONT::OUTLINE_GLYPH::Triangulate().
|
inline |
Definition at line 800 of file shape_poly_set.h.
References m_triangulatedPolys.
Referenced by ConvertPolygonToTriangles(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), operator=(), PNS_KICAD_IFACE_BASE::syncZone(), and KIFONT::OUTLINE_GLYPH::Triangulate().
|
inlineinherited |
Return the type of the shape.
the | type |
Definition at line 98 of file shape.h.
References m_type.
Referenced by CREEPAGE_GRAPH::Addshape(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), PNS::BuildHullForPrimitiveShape(), PNS_LOG_VIEWER_FRAME::buildListTree(), Collide(), SHAPE_POLY_SET::Collide(), collideShapes(), collideSingleShapes(), PNS::OPTIMIZER::computeBreakouts(), ROUTER_PREVIEW_ITEM::drawShape(), PNS_LOG_VIEWER_FRAME::drawSimpleShape(), EDA_SHAPE::EDA_SHAPE(), SHAPE::GetClearance(), nearestPoints(), nearestPointsSingleShapes(), DRC_RTREE::QueryColliding(), STROKE_PARAMS::Stroke(), and SHAPE_FILE_IO::Write().
|
inlineinherited |
void SHAPE_POLY_SET::Unfracture | ( | ) |
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
Definition at line 1856 of file shape_poly_set.cpp.
References m_polys, path, Simplify(), and unfractureSingle().
Referenced by EXPORTER_STEP::buildZones3DShape(), InflateWithLinkedHoles(), and polygon_triangulation_main().
|
private |
Definition at line 1674 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(), hash_combine(), next(), operator!=(), operator==(), result, SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::SetClosed(), SHAPE_LINE_CHAIN::Simplify(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by Unfracture().
|
inline |
Definition at line 778 of file shape_poly_set.h.
References SHAPE_POLY_SET(), and Subset().
void SHAPE_POLY_SET::UpdateTriangulationDataHash | ( | ) |
Definition at line 2460 of file shape_poly_set.cpp.
References checksum(), m_hash, and m_hashValid.
int SHAPE_POLY_SET::VertexCount | ( | int | aOutline = -1, |
int | aHole = -1 ) const |
Return the number of vertices in a given outline/hole.
Definition at line 340 of file shape_poly_set.cpp.
References m_polys.
Referenced by BOOST_AUTO_TEST_CASE(), Collide(), GERBER_FILE_IMAGE::Execute_G_Command(), EDA_SHAPE::GetPointCount(), FABMASTER::loadFootprints(), and FABMASTER::loadShapePolySet().
|
privateinherited |
Definition at line 143 of file wrlfacet.h.
Referenced by CalcShape(), and NewFacet().
|
private |
Definition at line 1589 of file shape_poly_set.h.
Referenced by cacheTriangulation(), DeletePolygonAndTriangulationData(), GetHash(), IsTriangulationUpToDate(), Move(), operator=(), operator=(), SHAPE_POLY_SET(), SHAPE_POLY_SET(), and UpdateTriangulationDataHash().
|
private |
Definition at line 1590 of file shape_poly_set.h.
Referenced by cacheTriangulation(), DeletePolygonAndTriangulationData(), GetHash(), IsTriangulationUpToDate(), Move(), operator=(), operator=(), SHAPE_POLY_SET(), SHAPE_POLY_SET(), and UpdateTriangulationDataHash().
|
protected |
Definition at line 1582 of file shape_poly_set.h.
Referenced by AddHole(), AddOutline(), AddPolygon(), Append(), Append(), Append(), ArcCount(), BBox(), BBoxFromCaches(), booleanOp(), Chamfer(), checksum(), CHole(), ClearArcs(), Contains(), containsSingle(), COutline(), CPolygon(), CPolygons(), CVertex(), CVertex(), DeletePolygon(), DeletePolygonAndTriangulationData(), Fillet(), Format(), Fracture(), FullPointCount(), GetArcs(), GetGlobalIndex(), GetNeighbourIndexes(), HasHoles(), Hole(), HoleCount(), importPaths(), importPolyPath(), importTree(), inflate2(), InsertVertex(), IsEmpty(), IsSelfIntersecting(), Mirror(), Move(), NewHole(), NewOutline(), operator=(), operator=(), Outline(), Outline(), OutlineCount(), Parse(), PointOnEdge(), Polygon(), Polygon(), RebuildHolesFromContours(), RemoveAllContours(), RemoveContour(), RemoveOutline(), RemoveVertex(), Rotate(), SetVertex(), SHAPE_POLY_SET(), SHAPE_POLY_SET(), SimplifyOutlines(), splitCollinearOutlines(), SquaredDistance(), SquaredDistanceToSeg(), Subset(), TotalVertices(), Unfracture(), and VertexCount().
|
protected |
Definition at line 1583 of file shape_poly_set.h.
Referenced by cacheTriangulation(), Collide(), DeletePolygonAndTriangulationData(), GetIndexableSubshapeCount(), GetIndexableSubshapes(), KIFONT::OUTLINE_GLYPH::GetTriangulationData(), Move(), operator=(), operator=(), RemoveAllContours(), TriangulatedPolyCount(), and TriangulatedPolygon().
|
protected |
Definition at line 1586 of file shape_poly_set.h.
Referenced by cacheTriangulation().
|
protected |
Definition at line 1585 of file shape_poly_set.h.
Referenced by cacheTriangulation(), DeletePolygonAndTriangulationData(), IsTriangulationUpToDate(), Mirror(), operator=(), operator=(), RemoveAllContours(), Rotate(), SHAPE_POLY_SET(), and SHAPE_POLY_SET().
|
protectedinherited |
< type of our shape
Definition at line 119 of file shape.h.
Referenced by SHAPE::Format(), SHAPE::IsNull(), SHAPE_BASE(), Type(), and TypeName().
|
staticinherited |
This is the minimum precision for all the points in a shape.
Definition at line 131 of file shape.h.
Referenced by DIRECTION_45::BuildInitialTrace(), CompareLength(), CIRCLE::Contains(), EDIT_TOOL::FilletTracks(), CIRCLE::IntersectLine(), and LINE_FILLET_ROUTINE::ProcessLinePair().