28#ifndef __SHAPE_POLY_SET_H
29#define __SHAPE_POLY_SET_H
41#include "router/clipper_kicad/clipper.hpp"
42#include <geometry/seg.h>
43#include <geometry/shape.h>
44#include <geometry/shape_line_chain.h>
46#include <math/vector2d.h>
70 typedef std::vector<SHAPE_LINE_CHAIN>
POLYGON;
86 virtual void Rotate(
double aAngle,
const VECTOR2I& aCenter = { 0, 0 } )
override {};
88 virtual void Move(
const VECTOR2I& aVector )
override {};
90 virtual bool IsSolid()
const override {
return true; }
92 virtual bool IsClosed()
const override {
return true; }
94 virtual const BOX2I BBox(
int aClearance = 0 )
const override;
96 virtual const VECTOR2I GetPoint(
int aIndex )
const override
100 case 0:
return parent->m_vertices[a];
101 case 1:
return parent->m_vertices[b];
102 case 2:
return parent->m_vertices[c];
103 default: assert(
false);
108 virtual const SEG GetSegment(
int aIndex )
const override
112 case 0:
return SEG( parent->m_vertices[a], parent->m_vertices[b] );
113 case 1:
return SEG( parent->m_vertices[b], parent->m_vertices[c] );
114 case 2:
return SEG( parent->m_vertices[c], parent->m_vertices[a] );
115 default: assert(
false);
120 virtual size_t GetPointCount()
const override {
return 3; }
121 virtual size_t GetSegmentCount()
const override {
return 3; }
125 TRIANGULATED_POLYGON* parent;
128 TRIANGULATED_POLYGON();
129 TRIANGULATED_POLYGON(
const TRIANGULATED_POLYGON& aOther );
130 ~TRIANGULATED_POLYGON();
140 auto tri = m_triangles[ index ];
141 a = m_vertices[ tri.a ];
142 b = m_vertices[ tri.b ];
143 c = m_vertices[ tri.c ];
146 TRIANGULATED_POLYGON& operator=(
const TRIANGULATED_POLYGON& aOther );
148 void AddTriangle(
int a,
int b,
int c );
150 void AddVertex(
const VECTOR2I& aP )
152 m_vertices.push_back( aP );
155 size_t GetTriangleCount()
const
157 return m_triangles.size();
160 std::deque<TRI>& Triangles()
165 size_t GetVertexCount()
const
167 return m_vertices.size();
172 for(
auto& vertex : m_vertices )
177 std::deque<TRI> m_triangles;
178 std::deque<VECTOR2I> m_vertices;
214 return m_currentVertex + 1 ==
215 m_poly->CPolygon( m_currentPolygon )[m_currentContour].PointCount();
223 return m_currentPolygon == m_lastPolygon;
226 operator bool()
const
228 if( m_currentPolygon < m_lastPolygon )
234 const auto& currentPolygon = m_poly->CPolygon( m_currentPolygon );
236 return m_currentContour < (int) currentPolygon.size() - 1
237 || m_currentVertex < currentPolygon[m_currentContour].PointCount();
254 if( m_currentVertex >=
255 m_poly->CPolygon( m_currentPolygon )[m_currentContour].PointCount() )
262 int totalContours = m_poly->CPolygon( m_currentPolygon ).size();
264 if( m_currentContour >= totalContours )
266 m_currentContour = 0;
274 if( m_currentVertex >= m_poly->CPolygon( m_currentPolygon )[0].PointCount() )
282 void operator++(
int dummy )
294 return m_poly->Polygon( m_currentPolygon )[m_currentContour].CPoint( m_currentVertex );
302 const T* operator->()
325 int m_currentPolygon;
326 int m_currentContour;
344 return m_currentPolygon == m_lastPolygon;
347 operator bool()
const
349 return m_currentPolygon <= m_lastPolygon;
366 last = m_poly->CPolygon( m_currentPolygon )[m_currentContour].SegmentCount();
369 if( m_currentSegment >= last )
371 m_currentSegment = 0;
376 int totalContours = m_poly->CPolygon( m_currentPolygon ).size();
378 if( m_currentContour >= totalContours )
380 m_currentContour = 0;
387 last = m_poly->CPolygon( m_currentPolygon )[0].SegmentCount();
390 if( m_currentSegment >= last )
392 m_currentSegment = 0;
398 void operator++(
int dummy )
410 return m_poly->Polygon( m_currentPolygon )[m_currentContour].Segment( m_currentSegment );
441 if( m_poly == aOther.m_poly && m_currentPolygon == aOther.m_currentPolygon &&
442 m_currentContour == aOther.m_currentContour )
446 numSeg = m_poly->CPolygon( m_currentPolygon )[m_currentContour].SegmentCount();
452 int indexDiff = std::abs( m_currentSegment - aOther.m_currentSegment );
454 return ( indexDiff == 1 ) || ( indexDiff == (numSeg - 1) );
464 int m_currentPolygon;
465 int m_currentContour;
466 int m_currentSegment;
472 typedef ITERATOR_TEMPLATE<VECTOR2I> ITERATOR;
473 typedef ITERATOR_TEMPLATE<const VECTOR2I> CONST_ITERATOR;
476 typedef SEGMENT_ITERATOR_TEMPLATE<SEG> SEGMENT_ITERATOR;
477 typedef SEGMENT_ITERATOR_TEMPLATE<const SEG> CONST_SEGMENT_ITERATOR;
502 void CacheTriangulation(
bool aPartition =
true );
503 bool IsTriangulationUpToDate()
const;
507 virtual bool HasIndexableSubshapes()
const override;
509 virtual size_t GetIndexableSubshapeCount()
const override;
511 virtual void GetIndexableSubshapes( std::vector<SHAPE*>& aSubshapes )
override;
535 bool GetGlobalIndex( VERTEX_INDEX aRelativeIndices,
int& aGlobalIdx )
const;
544 int NewHole(
int aOutline = -1 );
559 void GetArcs( std::vector<SHAPE_ARC>& aArcBuffer )
const;
577 int Append(
int x,
int y,
int aOutline = -1,
int aHole = -1,
bool aAllowDuplication =
false );
583 void Append(
const VECTOR2I& aP,
int aOutline = -1,
int aHole = -1 );
650 int VertexCount(
int aOutline = -1,
int aHole = -1 )
const;
659 if( ( aOutline < 0 ) || ( aOutline >= (
int) m_polys.size() )
660 || ( m_polys[aOutline].size() < 2 ) )
665 return m_polys[aOutline].size() - 1;
671 return m_polys[aIndex][0];
676 return m_polys[aIndex][0];
692 return Subset( aPolygonIndex, aPolygonIndex + 1 );
698 return m_polys[aOutline][aHole + 1];
704 return m_polys[aIndex];
707 const POLYGON& Polygon(
int aIndex )
const
709 return m_polys[aIndex];
712 const TRIANGULATED_POLYGON* TriangulatedPolygon(
int aIndex )
const
714 return m_triangulatedPolys[aIndex].get();
719 return m_polys[aIndex][0];
724 return m_polys[aOutline][aHole + 1];
727 const POLYGON& CPolygon(
int aIndex )
const
729 return m_polys[aIndex];
747 iter.m_currentPolygon = aFirst;
748 iter.m_lastPolygon = aLast < 0 ?
OutlineCount() - 1 : aLast;
749 iter.m_currentContour = 0;
750 iter.m_currentVertex = 0;
751 iter.m_iterateHoles = aIterateHoles;
763 return Iterate( aOutline, aOutline );
773 return Iterate( aOutline, aOutline,
true );
795 CONST_ITERATOR CIterate(
int aFirst,
int aLast,
bool aIterateHoles =
false )
const
800 iter.m_currentPolygon = aFirst;
801 iter.m_lastPolygon = aLast < 0 ?
OutlineCount() - 1 : aLast;
802 iter.m_currentContour = 0;
803 iter.m_currentVertex = 0;
804 iter.m_iterateHoles = aIterateHoles;
809 CONST_ITERATOR CIterate(
int aOutline )
const
811 return CIterate( aOutline, aOutline );
814 CONST_ITERATOR CIterateWithHoles(
int aOutline )
const
816 return CIterate( aOutline, aOutline,
true );
819 CONST_ITERATOR CIterate()
const
824 CONST_ITERATOR CIterateWithHoles()
const
838 throw( std::out_of_range(
"aGlobalIndex-th vertex does not exist" ) );
841 iter.m_currentPolygon = indices.
m_polygon;
842 iter.m_currentContour = indices.
m_contour;
843 iter.m_currentVertex = indices.
m_vertex;
855 iter.m_currentPolygon = aFirst;
856 iter.m_lastPolygon = aLast < 0 ?
OutlineCount() - 1 : aLast;
857 iter.m_currentContour = 0;
858 iter.m_currentSegment = 0;
859 iter.m_iterateHoles = aIterateHoles;
867 bool aIterateHoles =
false )
const
872 iter.m_currentPolygon = aFirst;
873 iter.m_lastPolygon = aLast < 0 ?
OutlineCount() - 1 : aLast;
874 iter.m_currentContour = 0;
875 iter.m_currentSegment = 0;
876 iter.m_iterateHoles = aIterateHoles;
940 PM_STRICTLY_SIMPLE =
false
996 void Inflate(
int aAmount,
int aCircleSegCount,
999 void Deflate(
int aAmount,
int aCircleSegmentsCount,
1002 Inflate( -aAmount, aCircleSegmentsCount, aCornerStrategy );
1045 const std::string
Format()
const override;
1048 bool Parse( std::stringstream& aStream )
override;
1060 void Mirror(
bool aX =
true,
bool aY =
false,
const VECTOR2I& aRef = { 0, 0 } );
1068 void Rotate(
double aAngle,
const VECTOR2I& aCenter = { 0, 0 } )
override;
1076 const BOX2I BBox(
int aClearance = 0 )
const override;
1098 bool Collide(
const SHAPE* aShape,
int aClearance = 0,
int* aActual =
nullptr,
1099 VECTOR2I* aLocation =
nullptr )
const override;
1119 bool Collide(
const VECTOR2I& aP,
int aClearance = 0,
int* aActual =
nullptr,
1120 VECTOR2I* aLocation =
nullptr )
const override;
1140 bool Collide(
const SEG& aSeg,
int aClearance = 0,
int* aActual =
nullptr,
1141 VECTOR2I* aLocation =
nullptr )
const override;
1154 int aClearance = 0 )
const;
1167 int aClearance = 0 )
const;
1177 const BOX2I BBoxFromCaches()
const;
1189 bool Contains(
const VECTOR2I& aP,
int aSubpolyIndex = -1,
int aAccuracy = 0,
1190 bool aUseBBoxCaches =
false )
const;
1193 bool IsEmpty()
const
1195 return m_polys.empty();
1213 void RemoveAllContours();
1223 void RemoveContour(
int aContourIdx,
int aPolygonIdx = -1 );
1254 void DeletePolygon(
int aIdx );
1364 void fractureSingle(
POLYGON& paths );
1365 void unfractureSingle (
POLYGON& path );
1367 const std::vector<CLIPPER_Z_VALUE>& aZValueBuffer,
1368 const std::vector<SHAPE_ARC>& aArcBuffe );
1382 void booleanOp( ClipperLibKiCad::ClipType aType,
const SHAPE_POLY_SET& aOtherShape,
1385 void booleanOp( ClipperLibKiCad::ClipType aType,
const SHAPE_POLY_SET& aShape,
1402 bool containsSingle(
const VECTOR2I& aP,
int aSubpolyIndex,
int aAccuracy,
1403 bool aUseBBoxCaches =
false )
const;
1429 POLYGON chamferFilletPolygon( CORNER_MODE aMode,
unsigned int aDistance,
1430 int aIndex,
int aErrorMax );
1433 bool hasTouchingHoles(
const POLYGON& aPoly )
const;
1438 typedef std::vector<POLYGON> POLYSET;
1442 std::vector<std::unique_ptr<TRIANGULATED_POLYGON>> m_triangulatedPolys;
1444 bool m_triangulationValid =
false;
Definition clipper.hpp:193
Definition shape_arc.h:36
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Definition shape_line_chain.h:81
Base class for iterating over all vertices in a given SHAPE_POLY_SET.
Definition shape_poly_set.h:205
bool IsLastPolygon() const
Definition shape_poly_set.h:221
VERTEX_INDEX GetIndex()
Definition shape_poly_set.h:310
bool IsEndContour() const
Definition shape_poly_set.h:212
void Advance()
Advance the indices of the current vertex/outline/contour, checking whether the vertices in the holes...
Definition shape_poly_set.h:244
Base class for iterating over all segments in a given SHAPE_POLY_SET.
Definition shape_poly_set.h:337
bool IsLastPolygon() const
Definition shape_poly_set.h:342
bool IsAdjacent(SEGMENT_ITERATOR_TEMPLATE< T > aOther) const
Definition shape_poly_set.h:437
void Advance()
Advance the indices of the current vertex/outline/contour, checking whether the vertices in the holes...
Definition shape_poly_set.h:356
VERTEX_INDEX GetIndex() const
Definition shape_poly_set.h:421
Definition shape_poly_set.h:73
Represent a set of closed polygons.
Definition shape_poly_set.h:65
static const SHAPE_POLY_SET BuildPolysetFromOrientedPaths(const std::vector< SHAPE_LINE_CHAIN > &aPaths, bool aReverseOrientation=false, bool aEvenOdd=false)
Build a SHAPE_POLY_SET from a bunch of outlines in provided in random order.
Definition shape_poly_set.cpp:2531
SEG::ecoord SquaredDistance(VECTOR2I aPoint, VECTOR2I *aNearest=nullptr) const
Compute the minimum distance squared between aPoint and all the polygons in the set.
Definition shape_poly_set.cpp:1956
SHAPE_POLY_SET Chamfer(int aDistance)
Return a chamfered version of the polygon set.
Definition shape_poly_set.cpp:2019
const std::string Format() const override
Definition shape_poly_set.cpp:1299
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
Definition shape_poly_set.cpp:684
bool HasHoles() const
Return true if the polygon set has any holes that share a vertex.
Definition shape_poly_set.cpp:1234
bool PointOnEdge(const VECTOR2I &aP) const
Check if point aP lies on an edge or vertex of some of the outlines or holes.
Definition shape_poly_set.cpp:1422
ITERATOR IterateWithHoles(int aOutline)
Definition shape_poly_set.h:771
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
Definition shape_poly_set.cpp:1063
ITERATOR IterateWithHoles()
Definition shape_poly_set.h:789
void ClearArcs()
Appends a vertex at the end of the given outline/hole (default: the last outline)
Definition shape_poly_set.cpp:556
POLYGON_MODE
Operations on polygons use a aFastMode param if aFastMode is PM_FAST (true) the result can be a weak ...
Definition shape_poly_set.h:938
void InsertVertex(int aGlobalIndex, const VECTOR2I &aNewVertex)
Adds a vertex in the globally indexed position aGlobalIndex.
Definition shape_poly_set.cpp:276
CORNER_STRATEGY
< define how inflate transform build inflated polygon
Definition shape_poly_set.h:971
@ ALLOW_ACUTE_CORNERS
just inflate the polygon. Acute angles create spikes
Definition shape_poly_set.h:972
@ CHAMFER_ACUTE_CORNERS
Acute angles are chamfered.
Definition shape_poly_set.h:973
@ ROUND_ACUTE_CORNERS
Acute angles are rounded.
Definition shape_poly_set.h:974
@ CHAMFER_ALL_CORNERS
All angles are chamfered.
Definition shape_poly_set.h:975
@ ROUND_ALL_CORNERS
All angles are rounded.
Definition shape_poly_set.h:978
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
Definition shape_poly_set.cpp:480
int VertexCount(int aOutline=-1, int aHole=-1) const
Return the number of points in the shape poly set.
Definition shape_poly_set.cpp:298
double Area()
Count the number of arc shapes present.
Definition shape_poly_set.cpp:513
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
Definition shape_poly_set.cpp:1784
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
Definition shape_poly_set.cpp:678
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,...
Definition shape_poly_set.cpp:1484
ITERATOR Iterate(int aOutline)
Definition shape_poly_set.h:761
bool Parse(std::stringstream &aStream) override
Definition shape_poly_set.cpp:1330
int TotalVertices() const
Delete aIdx-th polygon from the set.
Definition shape_poly_set.cpp:1856
int FullPointCount() const
Returns the number of holes in a given outline.
Definition shape_poly_set.cpp:323
void GetArcs(std::vector< SHAPE_ARC > &aArcBuffer) const
Removes all arc references from all the outlines and holes in the polyset.
Definition shape_poly_set.cpp:543
bool IsVertexInHole(int aGlobalIdx)
Check whether the aGlobalIndex-th vertex belongs to a hole.
Definition shape_poly_set.cpp:2006
void Inflate(int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
Definition shape_poly_set.cpp:726
int NormalizeAreaOutlines()
Convert a self-intersecting polygon to one (or more) non self-intersecting polygon(s).
Definition shape_poly_set.cpp:1266
void RemoveVertex(int aGlobalIndex)
Delete the aGlobalIndex-th vertex.
Definition shape_poly_set.cpp:1755
SEGMENT_ITERATOR IterateSegments(int aPolygonIdx)
Return an iterator object, for iterating aPolygonIdx-th polygon edges.
Definition shape_poly_set.h:882
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
Definition shape_poly_set.cpp:1842
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset union between a and b, store the result in it self For aFastMode meaning,...
Definition shape_poly_set.cpp:690
SEGMENT_ITERATOR IterateSegmentsWithHoles(int aOutline)
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition shape_poly_set.h:912
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 lis...
Definition shape_poly_set.cpp:122
bool IsPolygonSelfIntersecting(int aPolygonIndex) const
Check whether the aPolygonIndex-th polygon in the set is self intersecting.
Definition shape_poly_set.cpp:441
SHAPE_POLY_SET Subset(int aFirstPolygon, int aLastPolygon)
Return a subset of the polygons in this set, the ones between aFirstPolygon and aLastPolygon.
Definition shape_poly_set.cpp:344
SHAPE_POLY_SET UnitSet(int aPolygonIndex)
Return the reference to aHole-th hole in the aIndex-th outline.
Definition shape_poly_set.h:690
int RemoveNullSegments()
Look for null segments; ie, segments whose ends are exactly the same and deletes them.
Definition shape_poly_set.cpp:1583
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
Definition shape_poly_set.h:657
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
Definition shape_poly_set.cpp:230
std::vector< SHAPE_LINE_CHAIN > POLYGON
< represents a single polygon outline with holes.
Definition shape_poly_set.h:70
SEGMENT_ITERATOR IterateSegments()
Returns an iterator object, for all outlines in the set (no holes)
Definition shape_poly_set.h:894
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext)
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a cont...
Definition shape_poly_set.cpp:394
ITERATOR Iterate()
Definition shape_poly_set.h:780
CONST_SEGMENT_ITERATOR CIterateSegments() const
Returns an iterator object, for all outlines in the set (with holes)
Definition shape_poly_set.h:900
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Return the area of this poly set.
Definition shape_poly_set.cpp:494
void RemoveContour(int aContourIdx, int aPolygonIdx=-1)
Delete the aContourIdx-th contour of the aPolygonIdx-th polygon in the set.
Definition shape_poly_set.cpp:1573
void Mirror(bool aX=true, bool aY=false, const VECTOR2I &aRef={ 0, 0 })
Mirror the line points about y or x (or both)
Definition shape_poly_set.cpp:1829
int ArcCount() const
Appends all the arcs in this polyset to aArcBuffer.
Definition shape_poly_set.cpp:529
void Unfracture(POLYGON_MODE aFastMode)
Return true if the polygon set has any holes.
Definition shape_poly_set.cpp:1249
bool GetGlobalIndex(VERTEX_INDEX aRelativeIndices, int &aGlobalIdx) const
Compute the global index of a vertex from the relative indices of polygon, contour and vertex.
Definition shape_poly_set.cpp:162
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Return the aIndex-th subpolygon in the set.
Definition shape_poly_set.h:696
bool IsSolid() const override
Definition shape_poly_set.h:1071
int NewOutline()
Creates a new hole in a given outline.
Definition shape_poly_set.cpp:201
CONST_SEGMENT_ITERATOR CIterateSegments(int aPolygonIdx) const
Return an iterator object, for all outlines in the set (no holes).
Definition shape_poly_set.h:888
bool CollideEdge(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Check whether aPoint collides with any edge of any of the contours of the polygon.
Definition shape_poly_set.cpp:1693
unsigned int TriangulatedPolyCount() const
Return the number of outlines in the set.
Definition shape_poly_set.h:644
int NewHole(int aOutline=-1)
Adds a new outline to the set and returns its index.
Definition shape_poly_set.cpp:213
SEG::ecoord SquaredDistanceToPolygon(VECTOR2I aPoint, int aIndex, VECTOR2I *aNearest) const
Compute the minimum distance between the aIndex-th polygon and aPoint.
Definition shape_poly_set.cpp:1883
CONST_SEGMENT_ITERATOR CIterateSegmentsWithHoles() const
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition shape_poly_set.h:918
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 (def...
Definition shape_poly_set.h:850
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Return an object to iterate through the points of the polygons between aFirst and aLast.
Definition shape_poly_set.h:742
CONST_SEGMENT_ITERATOR CIterateSegments(int aFirst, int aLast, bool aIterateHoles=false) const
Return an iterator object, for iterating aPolygonIdx-th polygon edges.
Definition shape_poly_set.h:866
ITERATOR IterateFromVertexWithHoles(int aGlobalIdx)
Return an iterator object, for iterating between aFirst and aLast outline, with or without holes (def...
Definition shape_poly_set.h:829
bool CollideVertex(const VECTOR2I &aPoint, VERTEX_INDEX &aClosestVertex, int aClearance=0) const
Check whether aPoint collides with any vertex of any of the contours of the polygon.
Definition shape_poly_set.cpp:1654
void BuildBBoxCaches() const
Construct BBoxCaches for Contains(), below.
Definition shape_poly_set.cpp:1722
POLYGON FilletPolygon(unsigned int aRadius, int aErrorMax, int aIndex)
Return a filleted version of the aIndex-th polygon.
Definition shape_poly_set.cpp:1876
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
Definition shape_poly_set.cpp:357
int OutlineCount() const
Return the number of vertices in a given outline/hole.
Definition shape_poly_set.h:647
SHAPE_POLY_SET Fillet(int aRadius, int aErrorMax)
Return a filleted version of the polygon set.
Definition shape_poly_set.cpp:2030
void Move(const VECTOR2I &aVector) override
Definition shape_poly_set.cpp:1814
bool HasTouchingHoles() const
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFastMo...
Definition shape_poly_set.cpp:2417
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
Definition shape_poly_set.cpp:116
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.
Definition shape_poly_set.cpp:1734
void InflateWithLinkedHoles(int aFactor, int aCircleSegmentsCount, POLYGON_MODE aFastMode)
Perform outline inflation/deflation, using round corners.
Definition shape_poly_set.cpp:717
POLYGON ChamferPolygon(unsigned int aDistance, int aIndex)
Return a chamfered version of the aIndex-th polygon.
Definition shape_poly_set.cpp:1870
SEGMENT_ITERATOR IterateSegmentsWithHoles()
Return an iterator object, for the aOutline-th outline in the set (with holes).
Definition shape_poly_set.h:906
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Definition shape_poly_set.cpp:1389
bool IsSelfIntersecting() const
Check whether any of the polygons in the set is self intersecting.
Definition shape_poly_set.cpp:468
An abstract shape on 2D plane.
Definition shape.h:117
Definition shape_poly_set.h:76
virtual const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
Definition shape_poly_set.cpp:2479
virtual void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Definition shape_poly_set.h:86
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
Definition shape_poly_set.h:187
int m_vertex
Definition shape_poly_set.h:190
int m_polygon
Definition shape_poly_set.h:188
int m_contour
Definition shape_poly_set.h:189