KiCad PCB EDA Suite
zones_convert_brd_items_to_polygons_with_Boost.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 /* Functions to convert some board items to polygons
26  * (pads, tracks ..)
27  * This is used to calculate filled areas in copper zones.
28  * Filled areas are areas remainder of the full zone area after removed all polygons
29  * calculated from these items shapes and the clearance area
30  *
31  * Important note:
32  * Because filled areas must have a minimum thickness to match with Design rule, they are
33  * draw in 2 step:
34  * 1 - filled polygons are drawn
35  * 2 - polygon outlines are drawn with a "minimum thickness width" ( or with a minimum
36  * thickness pen )
37  * So outlines of filled polygons are calculated with the constraint they match with clearance,
38  * taking in account outlines have thickness
39  * This ensures:
40  * - areas meet the minimum thickness requirement.
41  * - shapes are smoothed.
42  */
43 
44 // Polygon calculations can use fast mode or force strickly simple polygons after calculations
45 // Forcing strickly simple polygons is time consuming, and we have not see issues in fast mode
46 // so we use fast mode when possible (intermediate calculations)
47 // (choice is SHAPE_POLY_SET::PM_STRICTLY_SIMPLE or SHAPE_POLY_SET::PM_FAST)
48 #define POLY_CALC_MODE SHAPE_POLY_SET::PM_FAST
49 
50 #include <cmath>
51 #include <sstream>
52 
53 #include <fctsys.h>
54 #include <wxPcbStruct.h>
55 #include <trigo.h>
56 
57 #include <class_board.h>
58 #include <class_module.h>
59 #include <class_track.h>
60 #include <class_edge_mod.h>
61 #include <class_drawsegment.h>
62 #include <class_pcb_text.h>
63 #include <class_zone.h>
64 #include <project.h>
65 
66 #include <pcbnew.h>
67 #include <zones.h>
69 
71 #include <geometry/shape_file_io.h>
72 #include <geometry/convex_hull.h>
73 
74 /* DEBUG OPTION:
75  * To emit zone data to a file when filling zones for the debugging purposes,
76  * set this 'true' and build.
77  */
78 static const bool s_DumpZonesWhenFilling = false;
79 
81  BOARD* aPcb, ZONE_CONTAINER* aZone,
82  double aArcCorrection,
83  double aRoundPadThermalRotation);
84 
85 extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
86  ZONE_CONTAINER* aZone_container );
87 
88 extern void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer,
89  D_PAD& aPad,
90  int aThermalGap,
91  int aCopperThickness,
92  int aMinThicknessValue,
93  int aCircleToSegmentsCount,
94  double aCorrectionFactor,
95  double aThermalRot );
96 
97 // Local Variables:
98 static double s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads
99 
101 {
102  int segsPerCircle;
103  double correctionFactor;
104 
105  // Set the number of segments in arc approximations
107  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF;
108  else
109  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
110 
111  /* calculates the coeff to compensate radius reduction of holes clearance
112  * due to the segment approx.
113  * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
114  * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount )
115  */
116  correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle );
117 
118  aFeatures.RemoveAllContours();
119 
120  int outline_half_thickness = m_ZoneMinThickness / 2;
121 
122  // When removing holes, the holes must be expanded by outline_half_thickness
123  // to take in account the thickness of the zone outlines
124  int zone_clearance = GetClearance() + outline_half_thickness;
125 
126  // When holes are created by non copper items (edge cut items), use only
127  // the m_ZoneClearance parameter (zone clearance with no netclass clearance)
128  int zone_to_edgecut_clearance = GetZoneClearance() + outline_half_thickness;
129 
130  /* store holes (i.e. tracks and pads areas as polygons outlines)
131  * in a polygon list
132  */
133 
134  /* items ouside the zone bounding box are skipped
135  * the bounding box is the zone bounding box + the biggest clearance found in Netclass list
136  */
137  EDA_RECT item_boundingbox;
138  EDA_RECT zone_boundingbox = GetBoundingBox();
139  int biggest_clearance = aPcb->GetDesignSettings().GetBiggestClearanceValue();
140  biggest_clearance = std::max( biggest_clearance, zone_clearance );
141  zone_boundingbox.Inflate( biggest_clearance );
142 
143  /*
144  * First : Add pads. Note: pads having the same net as zone are left in zone.
145  * Thermal shapes will be created later if necessary
146  */
147 
148  /* Use a dummy pad to calculate hole clearance when a pad is not on all copper layers
149  * and this pad has a hole
150  * This dummy pad has the size and shape of the hole
151  * Therefore, this dummy pad is a circle or an oval.
152  * A pad must have a parent because some functions expect a non null parent
153  * to find the parent board, and some other data
154  */
155  MODULE dummymodule( aPcb ); // Creates a dummy parent
156  D_PAD dummypad( &dummymodule );
157 
158  for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
159  {
160  D_PAD* nextpad;
161 
162  for( D_PAD* pad = module->PadsList(); pad != NULL; pad = nextpad )
163  {
164  nextpad = pad->Next(); // pad pointer can be modified by next code, so
165  // calculate the next pad here
166 
167  if( !pad->IsOnLayer( GetLayer() ) )
168  {
169  /* Test for pads that are on top or bottom only and have a hole.
170  * There are curious pads but they can be used for some components that are
171  * inside the board (in fact inside the hole. Some photo diodes and Leds are
172  * like this)
173  */
174  if( pad->GetDrillSize().x == 0 && pad->GetDrillSize().y == 0 )
175  continue;
176 
177  // Use a dummy pad to calculate a hole shape that have the same dimension as
178  // the pad hole
179  dummypad.SetSize( pad->GetDrillSize() );
180  dummypad.SetOrientation( pad->GetOrientation() );
181  dummypad.SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ?
183  dummypad.SetPosition( pad->GetPosition() );
184 
185  pad = &dummypad;
186  }
187 
188  // Note: netcode <=0 means not connected item
189  if( ( pad->GetNetCode() != GetNetCode() ) || ( pad->GetNetCode() <= 0 ) )
190  {
191  int item_clearance = pad->GetClearance() + outline_half_thickness;
192  item_boundingbox = pad->GetBoundingBox();
193  item_boundingbox.Inflate( item_clearance );
194 
195  if( item_boundingbox.Intersects( zone_boundingbox ) )
196  {
197  int clearance = std::max( zone_clearance, item_clearance );
198 
199  // PAD_SHAPE_CUSTOM can have a specific keepout, to avoid to break the shape
200  if( pad->GetShape() == PAD_SHAPE_CUSTOM &&
201  pad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
202  {
203  // the pad shape in zone can be its convex hull or
204  // the shape itself
205  SHAPE_POLY_SET outline( pad->GetCustomShapeAsPolygon() );
206  outline.Inflate( KiROUND( clearance*correctionFactor) , segsPerCircle );
207  pad->CustomShapeAsPolygonToBoardPosition( &outline,
208  pad->GetPosition(), pad->GetOrientation() );
209 
210  if( pad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
211  {
212  std::vector<wxPoint> convex_hull;
213  BuildConvexHull( convex_hull, outline );
214 
215  aFeatures.NewOutline();
216  for( unsigned ii = 0; ii < convex_hull.size(); ++ii )
217  aFeatures.Append( convex_hull[ii] );
218  }
219  else
220  aFeatures.Append( outline );
221  }
222  else
223  pad->TransformShapeWithClearanceToPolygon( aFeatures,
224  clearance,
225  segsPerCircle,
226  correctionFactor );
227  }
228 
229  continue;
230  }
231 
232  // Pads are removed from zone if the setup is PAD_ZONE_CONN_NONE
233  // or if they have a custom shape, because a thermal relief will break
234  // the shape
235  if( GetPadConnection( pad ) == PAD_ZONE_CONN_NONE ||
236  pad->GetShape() == PAD_SHAPE_CUSTOM )
237  {
238  int gap = zone_clearance;
239  int thermalGap = GetThermalReliefGap( pad );
240  gap = std::max( gap, thermalGap );
241  item_boundingbox = pad->GetBoundingBox();
242  item_boundingbox.Inflate( gap );
243 
244  if( item_boundingbox.Intersects( zone_boundingbox ) )
245  {
246  // PAD_SHAPE_CUSTOM has a specific keepout, to avoid to break the shape
247  // the pad shape in zone can be its convex hull or the shape itself
248  if( pad->GetShape() == PAD_SHAPE_CUSTOM &&
249  pad->GetCustomShapeInZoneOpt() == CUST_PAD_SHAPE_IN_ZONE_CONVEXHULL )
250  {
251  // the pad shape in zone can be its convex hull or
252  // the shape itself
253  SHAPE_POLY_SET outline( pad->GetCustomShapeAsPolygon() );
254  outline.Inflate( KiROUND( gap*correctionFactor) , segsPerCircle );
255  pad->CustomShapeAsPolygonToBoardPosition( &outline,
256  pad->GetPosition(), pad->GetOrientation() );
257 
258  std::vector<wxPoint> convex_hull;
259  BuildConvexHull( convex_hull, outline );
260 
261  aFeatures.NewOutline();
262  for( unsigned ii = 0; ii < convex_hull.size(); ++ii )
263  aFeatures.Append( convex_hull[ii] );
264  }
265  else
266  pad->TransformShapeWithClearanceToPolygon( aFeatures,
267  gap, segsPerCircle, correctionFactor );
268  }
269  }
270  }
271  }
272 
273  /* Add holes (i.e. tracks and vias areas as polygons outlines)
274  * in cornerBufferPolysToSubstract
275  */
276  for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
277  {
278  if( !track->IsOnLayer( GetLayer() ) )
279  continue;
280 
281  if( track->GetNetCode() == GetNetCode() && (GetNetCode() != 0) )
282  continue;
283 
284  int item_clearance = track->GetClearance() + outline_half_thickness;
285  item_boundingbox = track->GetBoundingBox();
286 
287  if( item_boundingbox.Intersects( zone_boundingbox ) )
288  {
289  int clearance = std::max( zone_clearance, item_clearance );
290  track->TransformShapeWithClearanceToPolygon( aFeatures,
291  clearance,
292  segsPerCircle,
293  correctionFactor );
294  }
295  }
296 
297  /* Add module edge items that are on copper layers
298  * Pcbnew allows these items to be on copper layers in microwave applictions
299  * This is a bad thing, but must be handled here, until a better way is found
300  */
301  for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
302  {
303  for( BOARD_ITEM* item = module->GraphicalItemsList(); item; item = item->Next() )
304  {
305  if( !item->IsOnLayer( GetLayer() ) && !item->IsOnLayer( Edge_Cuts ) )
306  continue;
307 
308  if( item->Type() != PCB_MODULE_EDGE_T )
309  continue;
310 
311  item_boundingbox = item->GetBoundingBox();
312 
313  if( item_boundingbox.Intersects( zone_boundingbox ) )
314  {
315  int zclearance = zone_clearance;
316 
317  if( item->IsOnLayer( Edge_Cuts ) )
318  // use only the m_ZoneClearance, not the clearance using
319  // the netclass value, because we do not have a copper item
320  zclearance = zone_to_edgecut_clearance;
321 
322  ( (EDGE_MODULE*) item )->TransformShapeWithClearanceToPolygon(
323  aFeatures, zclearance, segsPerCircle, correctionFactor );
324  }
325  }
326  }
327 
328  // Add graphic items (copper texts) and board edges
329  // Currently copper texts have no net, so only the zone_clearance
330  // is used.
331  for( auto item : aPcb->Drawings() )
332  {
333  if( item->GetLayer() != GetLayer() && item->GetLayer() != Edge_Cuts )
334  continue;
335 
336  int zclearance = zone_clearance;
337 
338  if( item->GetLayer() == Edge_Cuts )
339  // use only the m_ZoneClearance, not the clearance using
340  // the netclass value, because we do not have a copper item
341  zclearance = zone_to_edgecut_clearance;
342 
343  switch( item->Type() )
344  {
345  case PCB_LINE_T:
346  ( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
347  aFeatures,
348  zclearance, segsPerCircle, correctionFactor );
349  break;
350 
351  case PCB_TEXT_T:
352  ( (TEXTE_PCB*) item )->TransformBoundingBoxWithClearanceToPolygon(
353  aFeatures, zclearance );
354  break;
355 
356  default:
357  break;
358  }
359  }
360 
361  // Add zones outlines having an higher priority and keepout
362  for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
363  {
364  ZONE_CONTAINER* zone = GetBoard()->GetArea( ii );
365 
366  if( zone->GetLayer() != GetLayer() )
367  continue;
368 
369  if( !zone->GetIsKeepout() && zone->GetPriority() <= GetPriority() )
370  continue;
371 
372  if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() )
373  continue;
374 
375  // A highter priority zone or keepout area is found: remove this area
376  item_boundingbox = zone->GetBoundingBox();
377 
378  if( !item_boundingbox.Intersects( zone_boundingbox ) )
379  continue;
380 
381  // Add the zone outline area.
382  // However if the zone has the same net as the current zone,
383  // do not add any clearance.
384  // the zone will be connected to the current zone, but filled areas
385  // will use different parameters (clearance, thermal shapes )
386  bool same_net = GetNetCode() == zone->GetNetCode();
387  bool use_net_clearance = true;
388  int min_clearance = zone_clearance;
389 
390  // Do not forget to make room to draw the thick outlines
391  // of the hole created by the area of the zone to remove
392  int holeclearance = zone->GetClearance() + outline_half_thickness;
393 
394  // The final clearance is obviously the max value of each zone clearance
395  min_clearance = std::max( min_clearance, holeclearance );
396 
397  if( zone->GetIsKeepout() || same_net )
398  {
399  // Just take in account the fact the outline has a thickness, so
400  // the actual area to substract is inflated to take in account this fact
401  min_clearance = outline_half_thickness;
402  use_net_clearance = false;
403  }
404 
406  aFeatures, min_clearance, use_net_clearance );
407  }
408 
409  // Remove thermal symbols
410  for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
411  {
412  for( D_PAD* pad = module->PadsList(); pad != NULL; pad = pad->Next() )
413  {
414  // Rejects non-standard pads with tht-only thermal reliefs
416  && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
417  continue;
418 
421  continue;
422 
423  if( !pad->IsOnLayer( GetLayer() ) )
424  continue;
425 
426  if( pad->GetNetCode() != GetNetCode() )
427  continue;
428 
429  item_boundingbox = pad->GetBoundingBox();
430  int thermalGap = GetThermalReliefGap( pad );
431  item_boundingbox.Inflate( thermalGap, thermalGap );
432 
433  if( item_boundingbox.Intersects( zone_boundingbox ) )
434  {
436  *pad, thermalGap,
439  segsPerCircle,
440  correctionFactor, s_thermalRot );
441  }
442  }
443  }
444 
445 }
446 
447 
479 {
480  int segsPerCircle;
481  double correctionFactor;
482  int outline_half_thickness = m_ZoneMinThickness / 2;
483 
484 
485  std::unique_ptr<SHAPE_FILE_IO> dumper( new SHAPE_FILE_IO(
486  s_DumpZonesWhenFilling ? "zones_dump.txt" : "", SHAPE_FILE_IO::IOM_APPEND ) );
487 
488  // Set the number of segments in arc approximations
490  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF;
491  else
492  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
493 
494  /* calculates the coeff to compensate radius reduction of holes clearance
495  * due to the segment approx.
496  * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
497  * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount )
498  */
499  correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle );
500 
501  CPOLYGONS_LIST tmp;
502 
504  dumper->BeginGroup("clipper-zone");
505 
506  SHAPE_POLY_SET solidAreas = *m_smoothedPoly;
507 
508  solidAreas.Inflate( -outline_half_thickness, segsPerCircle );
509  solidAreas.Simplify( POLY_CALC_MODE );
510 
511  SHAPE_POLY_SET holes;
512 
514  dumper->Write( &solidAreas, "solid-areas" );
515 
516  tmp.RemoveAllContours();
517  buildFeatureHoleList( aPcb, holes );
518 
520  dumper->Write( &holes, "feature-holes" );
521 
522  holes.Simplify( POLY_CALC_MODE );
523 
525  dumper->Write( &holes, "feature-holes-postsimplify" );
526 
527  // Generate the filled areas (currently, without thermal shapes, which will
528  // be created later).
529  // Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to generate strictly simple polygons
530  // needed by Gerber files and Fracture()
532 
534  dumper->Write( &solidAreas, "solid-areas-minus-holes" );
535 
536  SHAPE_POLY_SET areas_fractured = solidAreas;
537  areas_fractured.Fracture( POLY_CALC_MODE );
538 
540  dumper->Write( &areas_fractured, "areas_fractured" );
541 
542  m_FilledPolysList = areas_fractured;
543 
544  SHAPE_POLY_SET thermalHoles;
545 
546  // Test thermal stubs connections and add polygons to remove unconnected stubs.
547  // (this is a refinement for thermal relief shapes)
548  if( GetNetCode() > 0 )
549  BuildUnconnectedThermalStubsPolygonList( thermalHoles, aPcb, this,
550  correctionFactor, s_thermalRot );
551 
552  // remove copper areas corresponding to not connected stubs
553  if( !thermalHoles.IsEmpty() )
554  {
555  thermalHoles.Simplify( POLY_CALC_MODE );
556  // Remove unconnected stubs. Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to
557  // generate strictly simple polygons
558  // needed by Gerber files and Fracture()
559  solidAreas.BooleanSubtract( thermalHoles, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
560 
562  dumper->Write( &thermalHoles, "thermal-holes" );
563 
564  // put these areas in m_FilledPolysList
565  SHAPE_POLY_SET th_fractured = solidAreas;
566  th_fractured.Fracture( POLY_CALC_MODE );
567 
569  dumper->Write ( &th_fractured, "th_fractured" );
570 
571  m_FilledPolysList = th_fractured;
572 
573  }
574 
576 
577  if( GetNetCode() > 0 )
579 
581  dumper->EndGroup();
582 }
583 
585 {
586 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:78
#define ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF
Definition: pcbnew.h:42
Class SHAPE_FILE_IO.
Definition: shape_file_io.h:38
TEXTE_PCB class definition.
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
bool GetDoNotAllowCopperPour() const
Definition: class_zone.h:655
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:353
int GetBiggestClearanceValue()
Function GetBiggestClearanceValue.
#define ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
Definition: pcbnew.h:41
Class BOARD to handle a board.
MODULE * Next() const
Definition: class_module.h:100
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:104
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:204
Classes to handle copper zones.
void buildFeatureHoleList(BOARD *aPcb, SHAPE_POLY_SET &aFeatures)
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:472
void BuildConvexHull(std::vector< wxPoint > &aResult, const std::vector< wxPoint > &aPoly)
Calculate the convex hull of a list of points in counter-clockwise order.
Definition: convex_hull.cpp:87
void TransformOutlinesShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aMinClearanceValue, bool aUseNetClearance)
Function TransformOutlinesShapeWithClearanceToPolygon Convert the outlines shape to a polygon with no...
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:106
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
Definition: class_zone.cpp:615
Functions relatives to tracks, vias and segments used to fill zones.
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:787
Pads are not covered.
Definition: zones.h:57
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:654
BOARD_ITEM * Next() const
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:724
static const bool s_DumpZonesWhenFilling
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:752
ZoneConnection GetPadConnection(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:820
void Test_For_Copper_Island_And_Remove(BOARD *aPcb, ZONE_CONTAINER *aZone_container)
void Inflate(int aFactor, int aCircleSegmentsCount)
Performs outline inflation/deflation, using round corners.
void TestForCopperIslandAndRemoveInsulatedIslands(BOARD *aPcb)
Function TestForCopperIslandAndRemoveInsulatedIslands Remove insulated copper islands found in m_Fill...
Class SHAPE_POLY_SET.
int GetThermalReliefGap(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:463
D_PAD * Next() const
Definition: class_pad.h:145
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
void SetSize(const wxSize &aSize)
Definition: class_pad.h:253
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
int GetAreaCount() const
Function GetAreaCount.
Definition: class_board.h:1011
int NewOutline()
Creates a new empty polygon in the set and returns its index
SHAPE_POLY_SET m_FilledPolysList
Definition: class_zone.h:786
Thermal relief only for THT pads.
Definition: zones.h:60
void Fracture(POLYGON_MODE aFastMode)
Converts a set of polygons with holes to a singe outline with "slits"/"fractures" connecting the oute...
void AddClearanceAreasPolygonsToPolysList_NG(BOARD *aPcb)
Function AddClearanceAreasPolygonsToPolysList Supports a min thickness area constraint.
int GetNetCode() const
Function GetNetCode.
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void BuildUnconnectedThermalStubsPolygonList(SHAPE_POLY_SET &aCornerBuffer, BOARD *aPcb, ZONE_CONTAINER *aZone, double aArcCorrection, double aRoundPadThermalRotation)
Function BuildUnconnectedThermalStubsPolygonList Creates a set of polygons corresponding to stubs cre...
int m_ZoneMinThickness
Minimum thickness value in filled areas.
Definition: class_zone.h:748
TRACK * Next() const
Definition: class_track.h:98
ZONE_CONTAINER * GetArea(int index) const
Function GetArea returns the Area (Zone Container) at a given index.
Definition: class_board.h:982
Class to handle a graphic segment.
#define max(a, b)
Definition: auxiliary.h:86
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
DLIST< MODULE > m_Modules
Definition: class_board.h:245
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
void RemoveAllContours(void)
Definition: PolyLine.h:143
Class EDA_RECT handles the component boundary box.
Usual pad.
Definition: pad_shapes.h:60
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
Definition: class_pad.cpp:546
void SetShape(PAD_SHAPE_T aShape)
Definition: class_pad.h:202
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:401
virtual BOARD * GetBoard() const
Function GetBoard returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
DLIST< TRACK > m_Track
Definition: class_board.h:246
void AddClearanceAreasPolygonsToPolysList(BOARD *aPcb)
Function AddClearanceAreasPolygonsToPolysList Add non copper areas polygons (pads and tracks with cle...
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset difference For aFastMode meaning, see function booleanOp ...
Module description (excepted pads)
bool IsEmpty() const
Returns true if the set is empty (no polygons at all)
CPOLYGONS_LIST handle a list of contours (polygons corners).
Definition: PolyLine.h:114
unsigned GetPriority() const
Function GetPriority.
Definition: class_zone.h:119
EDGE_MODULE class definition.
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:103
Use thermal relief for pads.
Definition: zones.h:58
int GetZoneClearance() const
Definition: class_zone.h:203
DLIST_ITERATOR_WRAPPER< BOARD_ITEM > Drawings()
Definition: class_board.h:251
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
void CreateThermalReliefPadPolygon(SHAPE_POLY_SET &aCornerBuffer, D_PAD &aPad, int aThermalGap, int aCopperThickness, int aMinThicknessValue, int aCircleToSegmentsCount, double aCorrectionFactor, double aThermalRot)
Function CreateThermalReliefPadPolygon Add holes around a pad to create a thermal relief copper thick...
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) ...