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 the zones share no common layers
367  if( !CommonLayerExists( zone->GetLayerSet() ) )
368  continue;
369 
370  if( !zone->GetIsKeepout() && zone->GetPriority() <= GetPriority() )
371  continue;
372 
373  if( zone->GetIsKeepout() && ! zone->GetDoNotAllowCopperPour() )
374  continue;
375 
376  // A highter priority zone or keepout area is found: remove this area
377  item_boundingbox = zone->GetBoundingBox();
378 
379  if( !item_boundingbox.Intersects( zone_boundingbox ) )
380  continue;
381 
382  // Add the zone outline area.
383  // However if the zone has the same net as the current zone,
384  // do not add any clearance.
385  // the zone will be connected to the current zone, but filled areas
386  // will use different parameters (clearance, thermal shapes )
387  bool same_net = GetNetCode() == zone->GetNetCode();
388  bool use_net_clearance = true;
389  int min_clearance = zone_clearance;
390 
391  // Do not forget to make room to draw the thick outlines
392  // of the hole created by the area of the zone to remove
393  int holeclearance = zone->GetClearance() + outline_half_thickness;
394 
395  // The final clearance is obviously the max value of each zone clearance
396  min_clearance = std::max( min_clearance, holeclearance );
397 
398  if( zone->GetIsKeepout() || same_net )
399  {
400  // Just take in account the fact the outline has a thickness, so
401  // the actual area to substract is inflated to take in account this fact
402  min_clearance = outline_half_thickness;
403  use_net_clearance = false;
404  }
405 
407  aFeatures, min_clearance, use_net_clearance );
408  }
409 
410  // Remove thermal symbols
411  for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
412  {
413  for( D_PAD* pad = module->PadsList(); pad != NULL; pad = pad->Next() )
414  {
415  // Rejects non-standard pads with tht-only thermal reliefs
417  && pad->GetAttribute() != PAD_ATTRIB_STANDARD )
418  continue;
419 
422  continue;
423 
424  if( !pad->IsOnLayer( GetLayer() ) )
425  continue;
426 
427  if( pad->GetNetCode() != GetNetCode() )
428  continue;
429 
430  item_boundingbox = pad->GetBoundingBox();
431  int thermalGap = GetThermalReliefGap( pad );
432  item_boundingbox.Inflate( thermalGap, thermalGap );
433 
434  if( item_boundingbox.Intersects( zone_boundingbox ) )
435  {
437  *pad, thermalGap,
440  segsPerCircle,
441  correctionFactor, s_thermalRot );
442  }
443  }
444  }
445 
446 }
447 
448 
480 {
481  int segsPerCircle;
482  double correctionFactor;
483  int outline_half_thickness = m_ZoneMinThickness / 2;
484 
485 
486  std::unique_ptr<SHAPE_FILE_IO> dumper( new SHAPE_FILE_IO(
487  s_DumpZonesWhenFilling ? "zones_dump.txt" : "", SHAPE_FILE_IO::IOM_APPEND ) );
488 
489  // Set the number of segments in arc approximations
491  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF;
492  else
493  segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF;
494 
495  /* calculates the coeff to compensate radius reduction of holes clearance
496  * due to the segment approx.
497  * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2)
498  * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount )
499  */
500  correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle );
501 
502  CPOLYGONS_LIST tmp;
503 
505  dumper->BeginGroup("clipper-zone");
506 
507  SHAPE_POLY_SET solidAreas = *m_smoothedPoly;
508 
509  solidAreas.Inflate( -outline_half_thickness, segsPerCircle );
510  solidAreas.Simplify( POLY_CALC_MODE );
511 
512  SHAPE_POLY_SET holes;
513 
515  dumper->Write( &solidAreas, "solid-areas" );
516 
517  tmp.RemoveAllContours();
518  buildFeatureHoleList( aPcb, holes );
519 
521  dumper->Write( &holes, "feature-holes" );
522 
523  holes.Simplify( POLY_CALC_MODE );
524 
526  dumper->Write( &holes, "feature-holes-postsimplify" );
527 
528  // Generate the filled areas (currently, without thermal shapes, which will
529  // be created later).
530  // Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to generate strictly simple polygons
531  // needed by Gerber files and Fracture()
533 
535  dumper->Write( &solidAreas, "solid-areas-minus-holes" );
536 
537  SHAPE_POLY_SET areas_fractured = solidAreas;
538  areas_fractured.Fracture( POLY_CALC_MODE );
539 
541  dumper->Write( &areas_fractured, "areas_fractured" );
542 
543  m_FilledPolysList = areas_fractured;
544 
545  SHAPE_POLY_SET thermalHoles;
546 
547  // Test thermal stubs connections and add polygons to remove unconnected stubs.
548  // (this is a refinement for thermal relief shapes)
549  if( GetNetCode() > 0 )
550  BuildUnconnectedThermalStubsPolygonList( thermalHoles, aPcb, this,
551  correctionFactor, s_thermalRot );
552 
553  // remove copper areas corresponding to not connected stubs
554  if( !thermalHoles.IsEmpty() )
555  {
556  thermalHoles.Simplify( POLY_CALC_MODE );
557  // Remove unconnected stubs. Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to
558  // generate strictly simple polygons
559  // needed by Gerber files and Fracture()
560  solidAreas.BooleanSubtract( thermalHoles, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
561 
563  dumper->Write( &thermalHoles, "thermal-holes" );
564 
565  // put these areas in m_FilledPolysList
566  SHAPE_POLY_SET th_fractured = solidAreas;
567  th_fractured.Fracture( POLY_CALC_MODE );
568 
570  dumper->Write ( &th_fractured, "th_fractured" );
571 
572  m_FilledPolysList = th_fractured;
573 
574  }
575 
577 
578  if( GetNetCode() > 0 )
580 
582  dumper->EndGroup();
583 }
584 
586 {
587 }
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.
bool CommonLayerExists(const LSET aLayerSet) const
Function CommonLayerExist Test if this zone shares a common layer with the given layer set...
Definition: class_zone.cpp:201
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:106
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:673
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox (virtual)
Definition: class_zone.cpp:525
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:120
virtual PCB_LAYER_ID GetLayer() const override
Function GetLayer returns the primary layer this item is on.
Definition: class_zone.cpp:182
class TEXTE_PCB, text on a layer
Definition: typeinfo.h:92
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:219
Classes to handle copper zones.
void buildFeatureHoleList(BOARD *aPcb, SHAPE_POLY_SET &aFeatures)
int GetThermalReliefCopperBridge(D_PAD *aPad=NULL) const
Definition: class_zone.cpp:644
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:94
int GetClearance(BOARD_CONNECTED_ITEM *aItem=NULL) const override
Function GetClearance returns the clearance in internal units.
Definition: class_zone.cpp:787
Functions relatives to tracks, vias and segments used to fill zones.
SHAPE_POLY_SET m_RawPolysList
Definition: class_zone.h:807
Pads are not covered.
Definition: zones.h:57
bool GetIsKeepout() const
Accessors to parameters used in Keepout zones:
Definition: class_zone.h:672
BOARD_ITEM * Next() const
virtual LSET GetLayerSet() const override
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
Definition: class_zone.cpp:237
SHAPE_POLY_SET * m_smoothedPoly
Definition: class_zone.h:742
static const bool s_DumpZonesWhenFilling
int m_ArcToSegmentsCount
The number of segments to convert a circle to a polygon.
Definition: class_zone.h:772
ZoneConnection GetPadConnection(D_PAD *aPad=NULL) const
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:635
D_PAD * Next() const
Definition: class_pad.h:160
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
void SetSize(const wxSize &aSize)
Definition: class_pad.h:268
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:806
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.
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:768
TRACK * Next() const
Definition: class_track.h:100
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:217
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:91
Use thermal relief for pads.
Definition: zones.h:58
int GetZoneClearance() const
Definition: class_zone.h:218
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) ...