KiCad PCB EDA Suite
convert_basic_shapes_to_polygon.h File Reference
#include <geometry/shape_poly_set.h>
#include <wx/gdicmn.h>

Go to the source code of this file.

Enumerations

enum  RECT_CHAMFER_POSITIONS : int {
  RECT_NO_CHAMFER = 0, RECT_CHAMFER_TOP_LEFT = 1, RECT_CHAMFER_TOP_RIGHT = 2, RECT_CHAMFER_BOTTOM_LEFT = 4,
  RECT_CHAMFER_BOTTOM_RIGHT = 8, RECT_CHAMFER_ALL
}
 

Functions

void TransformCircleToPolygon (SHAPE_POLY_SET &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
 Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines. More...
 
void TransformOvalToPolygon (SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aWidth, int aError)
 convert a oblong shape to a polygon, using multiple segments It is similar to TransformRoundedEndsSegmentToPolygon, but the polygon is outside the actual oblong shape (a segment with rounded ends) It is suitable to create oblong clearance areas. More...
 
void GetRoundRectCornerCenters (wxPoint aCenters[4], int aRadius, const wxPoint &aPosition, const wxSize &aSize, double aRotation)
 Helper function GetRoundRectCornerCenters Has meaning only for rounded rect Returns the centers of the rounded corners. More...
 
void TransformRoundChamferedRectToPolygon (SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aPosition, const wxSize &aSize, double aRotation, int aCornerRadius, double aChamferRatio, int aChamferCorners, int aError)
 convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corners arcs to multiple straight lines. More...
 
void TransformArcToPolygon (SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, wxPoint aStart, double aArcAngle, int aError, int aWidth)
 Function TransformArcToPolygon Creates a polygon from an Arc Convert arcs to multiple straight segments. More...
 
void TransformRingToPolygon (SHAPE_POLY_SET &aCornerBuffer, wxPoint aCentre, int aRadius, int aError, int aWidth)
 Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segments. More...
 

Enumeration Type Documentation

◆ RECT_CHAMFER_POSITIONS

Function Documentation

◆ GetRoundRectCornerCenters()

void GetRoundRectCornerCenters ( wxPoint  aCenters[4],
int  aRadius,
const wxPoint aPosition,
const wxSize &  aSize,
double  aRotation 
)

Helper function GetRoundRectCornerCenters Has meaning only for rounded rect Returns the centers of the rounded corners.

Parameters
aCentersis the buffer to store the 4 coordinates.
aRadius= the radius of the of the rounded corners.
aPosition= position of the round rect
aSize= size of the of the round rect.
aRotation= rotation of the of the round rect

Definition at line 187 of file convert_basic_shapes_to_polygon.cpp.

189 {
190  wxSize size( aSize/2 );
191 
192  size.x -= aRadius;
193  size.y -= aRadius;
194 
195  // Ensure size is > 0, to avoid generating unusable shapes
196  // which can crash kicad.
197  size.x = std::max( 1, size.x );
198  size.y = std::max( 1, size.y );
199 
200  aCenters[0] = wxPoint( -size.x, size.y );
201  aCenters[1] = wxPoint( size.x, size.y );
202  aCenters[2] = wxPoint( size.x, -size.y );
203  aCenters[3] = wxPoint( -size.x, -size.y );
204 
205  // Rotate the polygon
206  if( aRotation != 0.0 )
207  {
208  for( int ii = 0; ii < 4; ii++ )
209  RotatePoint( &aCenters[ii], aRotation );
210  }
211 
212  // move the polygon to the position
213  for( int ii = 0; ii < 4; ii++ )
214  aCenters[ii] += aPosition;
215 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208

References RotatePoint().

Referenced by TransformRoundChamferedRectToPolygon().

◆ TransformArcToPolygon()

void TransformArcToPolygon ( SHAPE_POLY_SET aCornerBuffer,
wxPoint  aCentre,
wxPoint  aStart,
double  aArcAngle,
int  aError,
int  aWidth 
)

Function TransformArcToPolygon Creates a polygon from an Arc Convert arcs to multiple straight segments.

Parameters
aCornerBuffer= a buffer to store the polygon
aCentre= centre of the arc or circle
aStart= start point of the arc, or a point on the circle
aArcAngle= arc angle in 0.1 degrees. For a circle, aArcAngle = 3600
aError= the IU allowed for error in approximation
aWidth= width (thickness) of the line

Definition at line 336 of file convert_basic_shapes_to_polygon.cpp.

338 {
339  wxPoint arc_start, arc_end;
340  int dist = EuclideanNorm( aCentre - aStart );
341  int numSegs = GetArcToSegmentCount( dist, aError, 360.0 );
342  int delta = 3600 / numSegs; // rotate angle in 0.1 degree
343 
344  arc_end = arc_start = aStart;
345 
346  if( aArcAngle != 3600 )
347  RotatePoint( &arc_end, aCentre, -aArcAngle );
348 
349  if( aArcAngle < 0 )
350  {
351  std::swap( arc_start, arc_end );
352  aArcAngle = -aArcAngle;
353  }
354 
355  // Compute the ends of segments and creates poly
356  wxPoint curr_end = arc_start;
357  wxPoint curr_start = arc_start;
358 
359  for( int ii = delta; ii < aArcAngle; ii += delta )
360  {
361  curr_end = arc_start;
362  RotatePoint( &curr_end, aCentre, -ii );
363  TransformOvalToPolygon( aCornerBuffer, curr_start, curr_end, aWidth, aError );
364  curr_start = curr_end;
365  }
366 
367  if( curr_end != arc_end )
368  TransformOvalToPolygon( aCornerBuffer, curr_end, arc_end, aWidth, aError );
369 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:133
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
void TransformOvalToPolygon(SHAPE_POLY_SET &aCornerBuffer, wxPoint aStart, wxPoint aEnd, int aWidth, int aError)
convert a oblong shape to a polygon, using multiple segments It is similar to TransformRoundedEndsSeg...
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)

References EuclideanNorm(), GetArcToSegmentCount(), RotatePoint(), and TransformOvalToPolygon().

Referenced by TRACK::TransformShapeWithClearanceToPolygon(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

◆ TransformCircleToPolygon()

void TransformCircleToPolygon ( SHAPE_POLY_SET aCornerBuffer,
wxPoint  aCenter,
int  aRadius,
int  aError 
)

Function TransformCircleToPolygon convert a circle to a polygon, using multiple straight lines.

Parameters
aCornerBuffer= a buffer to store the polygon
aCenter= the center of the circle
aRadius= the radius of the circle
aError= the IU allowed for error in approximation Note: the polygon is inside the circle, so if you want to have the polygon outside the circle, you should give aRadius calculated with a correction factor

Definition at line 64 of file convert_basic_shapes_to_polygon.cpp.

66 {
67  wxPoint corner_position;
68  int numSegs = GetArcToSegmentCount( aRadius, aError, 360.0 );
69  int delta = 3600 / numSegs; // rotate angle in 0.1 degree
70  int correction = GetCircleToPolyCorrection( aError );
71  int radius = aRadius + correction; // make segments outside the circles
72 
73  aCornerBuffer.NewOutline();
74 
75  for( int angle = 0; angle < 3600; angle += delta )
76  {
77  corner_position.x = radius;
78  corner_position.y = 0;
79  RotatePoint( &corner_position, angle );
80  corner_position += aCenter;
81  aCornerBuffer.Append( corner_position.x, corner_position.y );
82  }
83 
84  // Finish circle
85  corner_position.x = radius;
86  corner_position.y = 0;
87  corner_position += aCenter;
88  aCornerBuffer.Append( corner_position.x, corner_position.y );
89 }
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
int GetCircleToPolyCorrection(int aMaxError)
int NewOutline()
Creates a new empty polygon in the set and returns its index
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
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)

References PNS::angle(), SHAPE_POLY_SET::Append(), GetArcToSegmentCount(), GetCircleToPolyCorrection(), SHAPE_POLY_SET::NewOutline(), RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by ZONE_FILLER::addHatchFillTypeOnZone(), addHoleToPolygon(), ZONE_FILLER::buildCopperItemClearances(), ConvertOutlineToPolygon(), D_CODE::ConvertShapeToPolygon(), BOARD_ADAPTER::createLayers(), AM_PRIMITIVE::DrawBasicShape(), D_PAD::MergePrimitivesAsPolygon(), TRACK::TransformShapeWithClearanceToPolygon(), DRAWSEGMENT::TransformShapeWithClearanceToPolygon(), and D_PAD::TransformShapeWithClearanceToPolygon().

◆ TransformOvalToPolygon()

void TransformOvalToPolygon ( SHAPE_POLY_SET aCornerBuffer,
wxPoint  aStart,
wxPoint  aEnd,
int  aWidth,
int  aError 
)

convert a oblong shape to a polygon, using multiple segments It is similar to TransformRoundedEndsSegmentToPolygon, but the polygon is outside the actual oblong shape (a segment with rounded ends) It is suitable to create oblong clearance areas.

because multiple segments create a smaller area than the circle, the radius of the circle to approximate must be bigger ( radius*aCorrectionFactor) to create segments outside the circle.

Parameters
aCornerBuffer= a buffer to store the polygon
aStart= the first point of the segment
aEnd= the second point of the segment
aWidth= the width of the segment
aError= the IU allowed for error in approximation

Definition at line 92 of file convert_basic_shapes_to_polygon.cpp.

94 {
95  // To build the polygonal shape outside the actual shape, we use a bigger
96  // radius to build rounded ends.
97  // However, the width of the segment is too big.
98  // so, later, we will clamp the polygonal shape with the bounding box
99  // of the segment.
100  int radius = aWidth / 2;
101  int numSegs = GetArcToSegmentCount( radius, aError, 360.0 );
102  int delta = 3600 / numSegs; // rotate angle in 0.1 degree
103  int correction = GetCircleToPolyCorrection( aError );
104 
105  radius += correction; // make segments outside the circles
106 
107  // end point is the coordinate relative to aStart
108  wxPoint endp = aEnd - aStart;
109  wxPoint startp = aStart;
110  wxPoint corner;
111  SHAPE_POLY_SET polyshape;
112 
113  polyshape.NewOutline();
114 
115  // normalize the position in order to have endp.x >= 0
116  // it makes calculations more easy to understand
117  if( endp.x < 0 )
118  {
119  endp = aStart - aEnd;
120  startp = aEnd;
121  }
122 
123  // delta_angle is in radian
124  double delta_angle = atan2( (double)endp.y, (double)endp.x );
125  int seg_len = KiROUND( EuclideanNorm( endp ) );
126 
127  // Compute the outlines of the segment, and creates a polygon
128  // Note: the polygonal shape is built from the equivalent horizontal
129  // segment starting at {0,0}, and ending at {seg_len,0}
130 
131  // add right rounded end:
132 
133  for( int angle = 0; angle < 1800; angle += delta )
134  {
135  corner = wxPoint( 0, radius );
136  RotatePoint( &corner, angle );
137  corner.x += seg_len;
138  polyshape.Append( corner.x, corner.y );
139  }
140 
141  // Finish arc:
142  corner = wxPoint( seg_len, -radius );
143  polyshape.Append( corner.x, corner.y );
144 
145  // add left rounded end:
146  for( int angle = 0; angle < 1800; angle += delta )
147  {
148  corner = wxPoint( 0, -radius );
149  RotatePoint( &corner, angle );
150  polyshape.Append( corner.x, corner.y );
151  }
152 
153  // Finish arc:
154  corner = wxPoint( 0, radius );
155  polyshape.Append( corner.x, corner.y );
156 
157  // Now trim the edges of the polygonal shape which will be slightly outside the
158  // track width.
159  SHAPE_POLY_SET bbox;
160  bbox.NewOutline();
161  // Build the bbox (a horizontal rectangle).
162  int halfwidth = aWidth / 2; // Use the exact segment width for the bbox height
163  corner.x = -radius - 2; // use a bbox width slightly bigger to avoid
164  // creating useless corner at segment ends
165  corner.y = halfwidth;
166  bbox.Append( corner.x, corner.y );
167  corner.y = -halfwidth;
168  bbox.Append( corner.x, corner.y );
169  corner.x = radius + seg_len + 2;
170  bbox.Append( corner.x, corner.y );
171  corner.y = halfwidth;
172  bbox.Append( corner.x, corner.y );
173 
174  // Now, clamp the shape
176  // Note the final polygon is a simple, convex polygon with no hole
177  // due to the shape of initial polygons
178 
179  // Rotate and move the polygon to its right location
180  polyshape.Rotate( delta_angle, VECTOR2I( 0, 0 ) );
181  polyshape.Move( startp );
182 
183  aCornerBuffer.Append( polyshape);
184 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:133
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Function Rotate rotates all vertices by a given angle.
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET.
int GetCircleToPolyCorrection(int aMaxError)
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
int NewOutline()
Creates a new empty polygon in the set and returns its index
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
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)

References PNS::angle(), SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BooleanIntersection(), EuclideanNorm(), GetArcToSegmentCount(), GetCircleToPolyCorrection(), KiROUND(), SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, SHAPE_POLY_SET::Rotate(), RotatePoint(), wxPoint::x, and wxPoint::y.

Referenced by addTextSegmToPoly(), BOARD_ADAPTER::buildPadShapeThickOutlineAsPolygon(), DXF_PLOTTER::PlotPoly(), DXF_PLOTTER::ThickSegment(), TransformArcToPolygon(), D_PAD::TransformHoleWithClearanceToPolygon(), TRACK::TransformShapeWithClearanceToPolygon(), DRAWSEGMENT::TransformShapeWithClearanceToPolygon(), and D_PAD::TransformShapeWithClearanceToPolygon().

◆ TransformRingToPolygon()

void TransformRingToPolygon ( SHAPE_POLY_SET aCornerBuffer,
wxPoint  aCentre,
int  aRadius,
int  aError,
int  aWidth 
)

Function TransformRingToPolygon Creates a polygon from a ring Convert arcs to multiple straight segments.

Parameters
aCornerBuffer= a buffer to store the polygon
aCentre= centre of the arc or circle
aRadius= radius of the circle
aError= the IU allowed for error in approximation
aWidth= width (thickness) of the ring

Definition at line 372 of file convert_basic_shapes_to_polygon.cpp.

374 {
375  int inner_radius = aRadius - ( aWidth / 2 );
376  int outer_radius = inner_radius + aWidth;
377 
378  if( inner_radius <= 0 )
379  { //In this case, the ring is just a circle (no hole inside)
380  TransformCircleToPolygon( aCornerBuffer, aCentre, aRadius + ( aWidth / 2 ), aError );
381  return;
382  }
383 
384  SHAPE_POLY_SET buffer;
385 
386  TransformCircleToPolygon( buffer, aCentre, outer_radius, aError );
387 
388  // Build the hole:
389  buffer.NewHole();
390  TransformCircleToPolygon( buffer.Hole( 0, 0 ), aCentre, inner_radius, aError );
391 
393  aCornerBuffer.Append( buffer );
394 }
int NewHole(int aOutline=-1)
Creates a new hole in a given outline
SHAPE_LINE_CHAIN & Hole(int aOutline, int aHole)
Returns the reference to aHole-th hole in the aIndex-th outline
SHAPE_POLY_SET.
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aCornerBuffer, wxPoint aCenter, int aRadius, int aError)
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
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)

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::Fracture(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::NewHole(), SHAPE_POLY_SET::PM_FAST, and TransformCircleToPolygon().

Referenced by BOARD_ADAPTER::buildPadShapeThickOutlineAsPolygon(), AM_PRIMITIVE::DrawBasicShape(), and DRAWSEGMENT::TransformShapeWithClearanceToPolygon().

◆ TransformRoundChamferedRectToPolygon()

void TransformRoundChamferedRectToPolygon ( SHAPE_POLY_SET aCornerBuffer,
const wxPoint aPosition,
const wxSize &  aSize,
double  aRotation,
int  aCornerRadius,
double  aChamferRatio,
int  aChamferCorners,
int  aError 
)

convert a rectangle with rounded corners and/or chamfered corners to a polygon Convert rounded corners arcs to multiple straight lines.

This will generate at least 16 segments per circle

Parameters
aCornerBuffer= a buffer to store the polygon
aPosition= the coordinate of the center of the rectangle
aSize= the size of the rectangle
aCornerRadius= radius of rounded corners (can be 0)
aRotation= rotation in 0.1 degrees of the rectangle
aChamferRatio= ratio between smaller rect size and chamfer value
aChamferCorners= identifier of the corners to chamfer: 0 = no chamfer 1 = TOP_LEFT 2 = TOP_RIGHT 4 = BOTTOM_LEFT 8 = BOTTOM_RIGHT One can have more than one chamfered corner by ORing the corner identifers
aError= the IU allowed for error in approximation

Definition at line 218 of file convert_basic_shapes_to_polygon.cpp.

222 {
223  // Build the basic shape in orientation 0.0, position 0,0 for chamfered corners
224  // or in actual position/orientation for round rect only
225  wxPoint corners[4];
226  GetRoundRectCornerCenters( corners, aCornerRadius,
227  aChamferCorners ? wxPoint( 0, 0 ) : aPosition,
228  aSize, aChamferCorners ? 0.0 : aRotation );
229 
230  SHAPE_POLY_SET outline;
231  outline.NewOutline();
232 
233  for( const wxPoint& corner : corners)
234  outline.Append( corner );
235 
236  int numSegs = GetArcToSegmentCount( aCornerRadius, aError, 360.0 );
237 
238  // Choppy corners on rounded-corner rectangles look awful so enforce a minimum of
239  // 4 segments per corner.
240  if( numSegs < 16 )
241  numSegs = 16;
242 
243  // To build the polygonal shape outside the actual shape, we use a bigger
244  // radius to build rounded corners.
245 
246  int correction = GetCircleToPolyCorrection( aError );
247  int radius = aCornerRadius + correction; // make segments outside the circles
248  outline.Inflate( radius, numSegs );
249 
250  if( correction > 1.0 )
251  {
252  // Refinement: clamp the inflated polygonal shape by the rectangular shape
253  // containing the rounded polygon
254  SHAPE_POLY_SET bbox; // the rectangular shape
255  bbox.NewOutline();
256 
257  for( const wxPoint& corner : corners )
258  bbox.Append( corner );
259 
260  // Just build the rectangular bbox
261  bbox.Inflate( aCornerRadius, 1, SHAPE_POLY_SET::CORNER_STRATEGY::ALLOW_ACUTE_CORNERS );
262 
263  // Now, clamp the shape
265  // Note the final polygon is a simple, convex polygon with no hole
266  // due to the shape of initial polygons
267  }
268 
269  if( aChamferCorners == RECT_NO_CHAMFER ) // no chamfer
270  {
271  // Add the outline:
272  aCornerBuffer.Append( outline );
273  return;
274  }
275 
276  // Now we have the round rect outline, in position 0,0 orientation 0.0.
277  // Chamfer the corner(s).
278  int chamfer_value = aChamferRatio * std::min( aSize.x, aSize.y );
279 
280  SHAPE_POLY_SET chamfered_corner; // corner shape for the current corner to chamfer
281 
282  int corner_id[4] =
283  {
286  };
287  // Depending on the corner position, signX[] and signY[] give the sign of chamfer
288  // coordinates relative to the corner position
289  // The first corner is the top left corner, then top right, bottom left and bottom right
290  int signX[4] = {1, -1, 1,-1 };
291  int signY[4] = {1, 1, -1,-1 };
292 
293  for( int ii = 0; ii < 4; ii++ )
294  {
295  if( (corner_id[ii] & aChamferCorners) == 0 )
296  continue;
297 
298  VECTOR2I corner_pos( -signX[ii]*aSize.x/2, -signY[ii]*aSize.y/2 );
299 
300  if( aCornerRadius )
301  {
302  // We recreate a rectangular area covering the full rounded corner (max size = aSize/2)
303  // to rebuild the corner before chamfering, to be sure the rounded corner shape does not
304  // overlap the chamfered corner shape:
305  chamfered_corner.RemoveAllContours();
306  chamfered_corner.NewOutline();
307  chamfered_corner.Append( 0, 0 );
308  chamfered_corner.Append( 0, signY[ii] * aSize.y / 2 );
309  chamfered_corner.Append( signX[ii] * aSize.x / 2, signY[ii] * aSize.y / 2 );
310  chamfered_corner.Append( signX[ii] * aSize.x / 2, 0 );
311  chamfered_corner.Move( corner_pos );
312  outline.BooleanAdd( chamfered_corner, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
313  }
314 
315  // Now chamfer this corner
316  chamfered_corner.RemoveAllContours();
317  chamfered_corner.NewOutline();
318  chamfered_corner.Append( 0, 0 );
319  chamfered_corner.Append( 0, signY[ii] * chamfer_value );
320  chamfered_corner.Append( signX[ii] * chamfer_value, 0 );
321  chamfered_corner.Move( corner_pos );
322  outline.BooleanSubtract( chamfered_corner, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
323  }
324 
325  // Rotate and move the outline:
326  if( aRotation != 0.0 )
327  outline.Rotate( DECIDEG2RAD( -aRotation ), VECTOR2I( 0, 0 ) );
328 
329  outline.Move( VECTOR2I( aPosition ) );
330 
331  // Add the outline:
332  aCornerBuffer.Append( outline );
333 }
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
VECTOR2 defines a general 2D-vector/point.
Definition: vector2d.h:61
void Rotate(double aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Function Rotate rotates all vertices by a given angle.
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Performs outline inflation/deflation.
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Move(const VECTOR2I &aVector) override
SHAPE_POLY_SET.
int GetCircleToPolyCorrection(int aMaxError)
void BooleanIntersection(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset intersection For aFastMode meaning, see function booleanOp
int NewOutline()
Creates a new empty polygon in the set and returns its index
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
double DECIDEG2RAD(double deg)
Definition: trigo.h:223
void GetRoundRectCornerCenters(wxPoint aCenters[4], int aRadius, const wxPoint &aPosition, const wxSize &aSize, double aRotation)
Helper function GetRoundRectCornerCenters Has meaning only for rounded rect Returns the centers of th...
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset difference For aFastMode meaning, see function booleanOp
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
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)

References SHAPE_POLY_SET::Append(), SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::BooleanSubtract(), DECIDEG2RAD(), GetArcToSegmentCount(), GetCircleToPolyCorrection(), GetRoundRectCornerCenters(), SHAPE_POLY_SET::Inflate(), SHAPE_POLY_SET::Move(), SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, RECT_CHAMFER_BOTTOM_LEFT, RECT_CHAMFER_BOTTOM_RIGHT, RECT_CHAMFER_TOP_LEFT, RECT_CHAMFER_TOP_RIGHT, RECT_NO_CHAMFER, SHAPE_POLY_SET::RemoveAllContours(), and SHAPE_POLY_SET::Rotate().

Referenced by D_PAD::BuildEffectiveShapes(), export_vrml_padshape(), HPGL_PLOTTER::FlashPadRoundRect(), PSLIKE_PLOTTER::FlashPadRoundRect(), GERBER_PLOTTER::FlashPadRoundRect(), DXF_PLOTTER::FlashPadRoundRect(), DSN::SPECCTRA_DB::makePADSTACK(), and D_PAD::TransformShapeWithClearanceToPolygon().