KiCad PCB EDA Suite
Loading...
Searching...
No Matches
playground.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 The KiCad Developers.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20
21// WARNING - this Tom's crappy PNS hack tool code. Please don't complain about its quality
22// (unless you want to improve it).
23
24#include <pgm_base.h>
26
28#include "label_manager.h"
29
30#include <geometry/shape_arc.h>
31
32#include <pad.h>
33
39static const wxChar tracePnsPlayground[] = wxT( "KICAD_PNS_PLAYGROUND" );
40
41
42std::shared_ptr<PNS_LOG_VIEWER_OVERLAY> overlay;
43
44
45static inline bool collide( const SHAPE_LINE_CHAIN& aLhs, const SHAPE_LINE_CHAIN& aRhs,
46 int aClearance, int* aDistance = nullptr, VECTOR2I* aPt1 = nullptr )
47{
48 wxCHECK( aLhs.PointCount() && aRhs.PointCount(), false );
49
50 VECTOR2I pt1;
51 bool retv = false;
52 int dist = std::numeric_limits<int>::max();
53 int tmp = dist;
54
55 SHAPE_LINE_CHAIN lhs( aLhs );
56 SHAPE_LINE_CHAIN rhs( aRhs );
57
58 lhs.SetClosed( false );
59 lhs.Append( lhs.CPoint( 0 ) );
60 rhs.SetClosed( false );
61 rhs.Append( rhs.CPoint( 0 ) );
62
63 for( int i = 0; i < rhs.SegmentCount(); i ++ )
64 {
65 if( lhs.Collide( rhs.CSegment( i ), tmp, &tmp, &pt1 ) )
66 {
67 retv = true;
68
69 if( tmp < dist )
70 dist = tmp;
71
72 if( aDistance )
73 *aDistance = dist;
74
75 if( aPt1 )
76 *aPt1 = pt1;
77 }
78 }
79
80 return retv;
81}
82
83
84static bool collide( const SHAPE_POLY_SET& aLhs, const SHAPE_LINE_CHAIN& aRhs, int aClearance,
85 int* aDistance = nullptr, VECTOR2I* aPt1 = nullptr )
86{
87 VECTOR2I pt1;
88 bool retv = false;
89 int tmp = std::numeric_limits<int>::max();
90 int dist = tmp;
91
92 for( int i = 0; i < aLhs.OutlineCount(); i++ )
93 {
94 if( collide( aLhs.Outline( i ), aRhs, aClearance, &tmp, &pt1 ) )
95 {
96 retv = true;
97
98 if( tmp < dist )
99 {
100 dist = tmp;
101
102 if( aDistance )
103 *aDistance = dist;
104
105 if( aPt1 )
106 *aPt1 = pt1;
107 }
108 }
109
110 for( int j = 0; j < aLhs.HoleCount( i ); i++ )
111 {
112 if( collide( aLhs.CHole( i, j ), aRhs, aClearance, &tmp, &pt1 ) )
113 {
114 retv = true;
115
116 if( tmp < dist )
117 {
118 dist = tmp;
119
120 if( aDistance )
121 *aDistance = dist;
122
123 if( aPt1 )
124 *aPt1 = pt1;
125 }
126 }
127 }
128 }
129
130 return retv;
131}
132
133
134bool collideArc2Arc( const SHAPE_ARC& a1, const SHAPE_ARC& a2, int clearance, SEG& minDistSeg )
135{
136 SEG mediatrix( a1.GetCenter(), a2.GetCenter() );
137
138 std::vector<VECTOR2I> ips;
139
140 // Basic case - arcs intersect
141 if( a1.Intersect( a2, &ips ) > 0 )
142 {
143 minDistSeg.A = minDistSeg.B = ips[0];
144 return true;
145 }
146
147 // Arcs don't intersect, build a list of points to check
148 std::vector<VECTOR2I> ptsA;
149 std::vector<VECTOR2I> ptsB;
150
151 bool cocentered = ( mediatrix.A == mediatrix.B );
152
153 // 1: Interior points of both arcs, which are on the line segment between the two centres
154 if( !cocentered )
155 {
156 a1.IntersectLine( mediatrix, &ptsA );
157 a2.IntersectLine( mediatrix, &ptsB );
158 }
159
160 // 2: Check arc end points
161 ptsA.push_back( a1.GetP0() );
162 ptsA.push_back( a1.GetP1() );
163 ptsB.push_back( a2.GetP0() );
164 ptsB.push_back( a2.GetP1() );
165
166 // 3: Endpoint of one and "projected" point on the other, which is on the
167 // line segment through that endpoint and the centre of the other arc
168 a1.IntersectLine( SEG( a2.GetP0(), a1.GetCenter() ), &ptsA );
169 a1.IntersectLine( SEG( a2.GetP1(), a1.GetCenter() ), &ptsA );
170
171 a2.IntersectLine( SEG( a1.GetP0(), a2.GetCenter() ), &ptsB );
172 a2.IntersectLine( SEG( a1.GetP1(), a2.GetCenter() ), &ptsB );
173
174 double minDist = std::numeric_limits<double>::max();
175 bool minDistFound = false;
176
177 // @todo performance might be improved by only checking certain points (e.g only check end
178 // points against other end points or their corresponding "projected" points)
179 for( const VECTOR2I& ptA : ptsA )
180 {
181 for( const VECTOR2I& ptB : ptsB )
182 {
183 double dist = ( ptA - ptB ).EuclideanNorm() - a1.GetWidth() / 2.0 - a2.GetWidth() / 2.0;
184
185 if( dist < clearance )
186 {
187 if( !minDistFound || dist < minDist )
188 {
189 minDist = dist;
190 minDistSeg = SEG( ptA, ptB );
191 }
192
193 minDistFound = true;
194 }
195 }
196 }
197
198 return minDistFound;
199}
200
201
202int playground_main_func( int argc, char* argv[] )
203{
204 auto frame = new PNS_LOG_VIEWER_FRAME( nullptr );
205 Pgm().App().SetTopWindow( frame ); // wxApp gets a face.
206 frame->Show();
207
208 struct ARC_DATA
209 {
210 double cx, cy, sx, sy, ca, w;
211 };
212
213 const ARC_DATA test_data [] =
214 {
215 {73.843527, 74.355869, 71.713528, 72.965869, -76.36664803, 0.2},
216 {71.236473, 74.704131, 73.366472, 76.094131, -76.36664803, 0.2},
217 {82.542335, 74.825975, 80.413528, 73.435869, -76.4, 0.2},
218 {76.491192, 73.839894, 78.619999, 75.23, -76.4, 0.2},
219 {89.318807, 74.810106, 87.19, 73.42, -76.4, 0.2},
220 {87.045667, 74.632941, 88.826472, 75.794131, -267.9, 0.2},
221 {94.665667, 73.772941, 96.446472, 74.934131, -267.9, 0.2},
222 {94.750009, 73.74012, 93.6551, 73.025482, -255.5, 0.2},
223 {72.915251, 80.493054, 73.570159, 81.257692, -260.5, 0.2}, // end points clearance false positive
224 {73.063537, 82.295989, 71.968628, 81.581351, -255.5, 0.2},
225 {79.279991, 80.67988, 80.3749, 81.394518, -255.5, 0.2},
226 {79.279991, 80.67988, 80.3749, 81.694518, -255.5, 0.2 },
227 {88.495265, 81.766089, 90.090174, 82.867869, -255.5, 0.2},
228 {86.995265, 81.387966, 89.090174, 82.876887, -255.5, 0.2},
229 {96.149734, 81.792126, 94.99, 83.37, -347.2, 0.2},
230 {94.857156, 81.240589, 95.91, 83.9, -288.5, 0.2},
231 {72.915251, 86.493054, 73.970159, 87.257692, -260.5, 0.2}, // end points clearance #1
232 {73.063537, 88.295989, 71.968628, 87.581351, -255.5, 0.2},
233 {78.915251, 86.393054, 79.970159, 87.157692, 99.5, 0.2}, // end points clearance #2 - false positive
234 {79.063537, 88.295989, 77.968628, 87.581351, -255.5, 0.2},
235 {85.915251, 86.993054, 86.970159, 87.757692, 99.5, 0.2}, // intersection - false negative
236 {86.063537, 88.295989, 84.968628, 87.581351, -255.5, 0.2},
237 {94.6551, 88.295989, 95.6551, 88.295989, 90.0, 0.2 }, // simulating diff pair
238 {94.6551, 88.295989, 95.8551, 88.295989, 90.0, 0.2 },
239 {73.77532, 93.413654, 75.70532, 93.883054, 60.0, 0.1 }, // one arc fully enclosed in other
240 {73.86532, 93.393054, 75.86532, 93.393054, 90.0, 0.3 },
241 {79.87532, 93.413654, 81.64532, 94.113054, 60.0, 0.1 }, // concentric
242 {79.87532, 93.413654, 81.86532, 93.393054, 90.0, 0.3 }
243 };
244
245
246 overlay = frame->GetOverlay();
247
248
249 overlay->SetIsFill( false );
250 overlay->SetLineWidth( 10000 );
251
252 std::vector<SHAPE_ARC> arcs;
253 int n_arcs = sizeof( test_data ) / sizeof( ARC_DATA );
254
255 BOX2I vp;
256
257 for( int i = 0; i < n_arcs; i++ )
258 {
259 const ARC_DATA& d = test_data[i];
260
261 SHAPE_ARC arc( VECTOR2D( pcbIUScale.mmToIU( d.cx ), pcbIUScale.mmToIU( d.cy ) ),
262 VECTOR2D( pcbIUScale.mmToIU( d.sx ), pcbIUScale.mmToIU( d.sy ) ),
263 EDA_ANGLE( d.ca, DEGREES_T ), pcbIUScale.mmToIU( d.w ) );
264
265 arcs.push_back( arc );
266
267 if( i == 0 )
268 vp = arc.BBox();
269 else
270 vp.Merge( arc.BBox() );
271 }
272
273
274 PAD pad1( nullptr );
275 pad1.SetX( pcbIUScale.mmToIU( 84.0 ) );
276 pad1.SetY( pcbIUScale.mmToIU( 66.0 ) );
277 pad1.SetSizeX( pcbIUScale.mmToIU( 7.0 ) );
278 pad1.SetSizeY( pcbIUScale.mmToIU( 7.0 ) );
279 pad1.SetDrillSizeX( pcbIUScale.mmToIU( 3.5 ) );
280 pad1.SetDrillSizeY( pcbIUScale.mmToIU( 3.5 ) );
281 vp.Merge( pad1.GetBoundingBox() );
282
283 PAD pad2( nullptr );
284 pad2.SetX( pcbIUScale.mmToIU( 87.125 ) );
285 pad2.SetY( pcbIUScale.mmToIU( 66.0 ) );
286 pad2.SetSizeX( pcbIUScale.mmToIU( 0.8 ) );
287 pad2.SetSizeY( pcbIUScale.mmToIU( 0.8 ) );
288 pad2.SetDrillSizeX( pcbIUScale.mmToIU( 0.5 ) );
289 pad2.SetDrillSizeY( pcbIUScale.mmToIU( 0.5 ) );
290 vp.Merge( pad2.GetBoundingBox() );
291
292 SHAPE_POLY_SET pad1Outline;
293 SHAPE_POLY_SET pad1Hole;
294
295 pad1.TransformShapeToPolygon( pad1Outline, UNDEFINED_LAYER, 0, 4, ERROR_OUTSIDE );
296 pad1.TransformHoleToPolygon( pad1Hole, 0, 4, ERROR_INSIDE );
297 pad1Outline.AddHole( pad1Hole.Outline( 0 ), 0 );
298
299 SHAPE_POLY_SET pad2Outline;
300
301 // pad2.TransformShapeToPolygon( pad2Outline, UNDEFINED_LAYER, 0, 4, ERROR_OUTSIDE );
302 pad2.TransformHoleToPolygon( pad2Outline, 0, 4, ERROR_INSIDE );
303
304 SHAPE_POLY_SET xorPad1ToPad2 = pad1Outline;
305
306 xorPad1ToPad2.BooleanXor( pad2Outline );
307 xorPad1ToPad2.Move( VECTOR2I( pcbIUScale.mmToIU( 10 ), 0 ) );
308
309 SHAPE_POLY_SET andPad1ToPad2 = pad2Outline;
310
311 andPad1ToPad2.BooleanIntersection( pad1Outline );
312 andPad1ToPad2.Move( VECTOR2I( pcbIUScale.mmToIU( 20 ), 0 ) );
313
314 std::shared_ptr<SHAPE_SEGMENT> slot = pad2.GetEffectiveHoleShape();
315
316 printf("Read %zu arcs\n", arcs.size() );
317
318 LABEL_MANAGER labelMgr( frame->GetPanel()->GetGAL() );
319 frame->GetPanel()->GetView()->SetViewport( BOX2D( vp.GetOrigin(), vp.GetSize() ) );
320
321 for( int i = 0; i < arcs.size(); i+= 2 )
322 {
323 SEG closestDist;
324 std::vector<VECTOR2I> ips;
325 bool collides = collideArc2Arc( arcs[i], arcs[i+1], 0, closestDist );
326 int ni = arcs[i].Intersect( arcs[i+1], &ips );
327
328 overlay->SetLineWidth( 10000.0 );
329 overlay->SetStrokeColor( GREEN );
330
331 for( int j = 0; j < ni; j++ )
332 overlay->AnnotatedPoint( ips[j], arcs[i].GetWidth() );
333
334 if( collides )
335 {
336 overlay->SetStrokeColor( YELLOW );
337 overlay->Line( closestDist.A, closestDist.B );
338 overlay->SetLineWidth( 10000 );
339 overlay->SetGlyphSize( { 100000, 100000 } );
340 overlay->BitmapText( wxString::Format( "dist=%d", closestDist.Length() ),
341 closestDist.A + VECTOR2I( 0, -arcs[i].GetWidth() ),
343 }
344
345 overlay->SetLineWidth( 10000 );
346 overlay->SetStrokeColor( CYAN );
347 overlay->AnnotatedPoint( arcs[i].GetP0(), arcs[i].GetWidth() / 2 );
348 overlay->AnnotatedPoint( arcs[i + 1].GetP0(), arcs[i + 1].GetWidth() / 2 );
349 overlay->AnnotatedPoint( arcs[i].GetArcMid(), arcs[i].GetWidth() / 2 );
350 overlay->AnnotatedPoint( arcs[i + 1].GetArcMid(), arcs[i + 1].GetWidth() / 2 );
351 overlay->AnnotatedPoint( arcs[i].GetP1(), arcs[i].GetWidth() / 2 );
352 overlay->AnnotatedPoint( arcs[i + 1].GetP1(), arcs[i + 1].GetWidth() / 2 );
353
354
355 overlay->SetStrokeColor( RED );
356 overlay->Arc( arcs[i] );
357 overlay->SetStrokeColor( MAGENTA );
358 overlay->Arc( arcs[i + 1] );
359 }
360
361 overlay->SetLineWidth( 2000 );
362 overlay->SetStrokeColor( CYAN );
363 overlay->AnnotatedPolyset( pad1Outline, "Raw Pads" );
364 overlay->SetStrokeColor( RED );
365 overlay->AnnotatedPolyset( pad2Outline );
366 overlay->SetStrokeColor( CYAN );
367 overlay->AnnotatedPolyset( xorPad1ToPad2, "XOR Pads" );
368 overlay->AnnotatedPolyset( andPad1ToPad2, "AND Pads" );
369
370 wxLogTrace( tracePnsPlayground, wxS( "Pad 1 has %d outlines." ), pad1Outline.OutlineCount() );
371
372 wxLogTrace( tracePnsPlayground, wxS( "Pad 2 has %d outlines." ), pad2Outline.OutlineCount() );
373
374 VECTOR2I pt1, pt2;
375 int dist = std::numeric_limits<int>::max();
376
377 collide( pad1Outline, pad2Outline.Outline( 0 ), dist, &dist, &pt1 );
378
379 wxLogTrace( tracePnsPlayground, wxS( "Nearest distance between pad 1 and pad 2 is %0.6f mm "
380 "at X=%0.6f mm, Y=%0.6f mm." ),
381 pcbIUScale.IUTomm( dist ), pcbIUScale.IUTomm( pt1.x ),
382 pcbIUScale.IUTomm( pt1.y ) );
383
384 overlay->SetStrokeColor( YELLOW );
385 overlay->SetGlyphSize( { 100000, 100000 } );
386 overlay->BitmapText( wxString::Format( "dist=%0.3f mm", pcbIUScale.IUTomm( dist ) ),
387 pt1 + VECTOR2I( 0, -56000 ), ANGLE_HORIZONTAL );
388
389 overlay = nullptr;
390
391 return 0;
392}
393
394
395
396int drawShapes( int argc, char* argv[] )
397{
398 SHAPE_ARC arc( VECTOR2I( 206000000, 140110000 ), VECTOR2I( 201574617, 139229737 ),
399 VECTOR2I( 197822958, 136722959 ), 250000 );
400
401 SHAPE_LINE_CHAIN lc( { /* VECTOR2I( 159600000, 142500000 ), VECTOR2I( 159600000, 142600000 ),
402 VECTOR2I( 166400000, 135800000 ), VECTOR2I( 166400000, 111600000 ),
403 VECTOR2I( 190576804, 111600000 ), VECTOR2I( 192242284, 113265480 ),
404 VECTOR2I( 192255720, 113265480 ),*/
405 VECTOR2I( 203682188, 124691948 ), VECTOR2I( 203682188, 140332188 ),
406 /* VECTOR2I( 206000000, 142650000 ) */ },
407 false );
408
409 auto frame = new PNS_LOG_VIEWER_FRAME( nullptr );
410 Pgm().App().SetTopWindow( frame ); // wxApp gets a face.
411 frame->Show();
412
413 overlay = frame->GetOverlay();
414
415
416 overlay->SetIsFill( false );
417 overlay->SetLineWidth( arc.GetWidth() );
418 overlay->SetStrokeColor( RED );
419 overlay->Arc( arc );
420 overlay->SetLineWidth( arc.GetWidth() / 20 );
421 overlay->SetStrokeColor( GREEN );
422 overlay->Polyline( lc );
423
424 overlay->SetLineWidth( 80000.0 );
425 overlay->SetStrokeColor( CYAN );
426
427 for( int i = 0; i < lc.PointCount(); ++i )
428 {
429 int mult = ( i % 2 ) ? 1 : -1;
430 overlay->AnnotatedPoint( lc.GetPoint( i ), arc.GetWidth() * 2 );
431 overlay->SetGlyphSize( { 800000, 800000 } );
432 overlay->BitmapText( wxString::Format( "x=%d, y=%d",
433 lc.GetPoint( i ).x,
434 lc.GetPoint( i ).y ),
435 lc.GetPoint( i ) + VECTOR2I( 0, mult*arc.GetWidth() * 4 ),
437 }
438
439 arc.Collide( &lc, 100000 );
440
441 BOX2I vp = arc.BBox();
442 vp.Merge( lc.BBox() );
443 vp.Inflate( (800000 + arc.GetWidth() * 4 )*2);
444 frame->GetPanel()->GetView()->SetViewport( BOX2D( vp.GetOrigin(), vp.GetSize() ) );
445
446 overlay = nullptr;
447
448 return 0;
449}
450
451
453 "playground",
454 "Geometry/drawing playground",
456} );
457
458
460 "drawShapes",
461 "drawing shapes",
463} );
@ ERROR_OUTSIDE
@ ERROR_INSIDE
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:121
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
BOX2< VECTOR2D > BOX2D
Definition box2.h:919
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:554
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:654
constexpr const Vec & GetOrigin() const
Definition box2.h:206
constexpr const SizeVec & GetSize() const
Definition box2.h:202
Definition pad.h:61
void SetSizeY(int aY)
Definition pad.cpp:317
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition pad.cpp:1599
void SetSizeX(int aX)
Definition pad.cpp:297
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
Definition pad.cpp:2945
void SetY(int y)
Definition pad.h:258
void SetDrillSizeY(int aY)
Definition pad.cpp:779
void SetX(int x)
Definition pad.h:264
void SetDrillSizeX(int aX)
Definition pad.cpp:765
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
Definition pad.cpp:1312
bool TransformHoleToPolygon(SHAPE_POLY_SET &aBuffer, int aClearance, int aError, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
Build the corner list of the polygonal drill shape in the board coordinate system.
Definition pad.cpp:2928
virtual wxApp & App()
Return a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.
Definition pgm_base.cpp:204
Definition seg.h:38
VECTOR2I A
Definition seg.h:45
VECTOR2I B
Definition seg.h:46
int Length() const
Return the length (this).
Definition seg.h:339
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
int GetWidth() const override
Definition shape_arc.h:211
int Intersect(const CIRCLE &aArc, std::vector< VECTOR2I > *aIpsBuffer) const
Find intersection points between this arc and a CIRCLE.
const VECTOR2I & GetP1() const
Definition shape_arc.h:115
int IntersectLine(const SEG &aSeg, std::vector< VECTOR2I > *aIpsBuffer) const
Find intersection points between this arc and aSeg, treating aSeg as an infinite line.
bool Collide(const SEG &aSeg, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if the boundary of shape (this) lies closer to the segment aSeg than aClearance,...
const VECTOR2I & GetP0() const
Definition shape_arc.h:114
const VECTOR2I & GetCenter() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void SetClosed(bool aClosed)
Mark the line chain as closed (i.e.
int PointCount() const
Return the number of points (vertices) in this line chain.
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if point aP lies closer to us than aClearance.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int SegmentCount() const
Return the number of segments in this line chain.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
Represent a set of closed polygons.
void BooleanXor(const SHAPE_POLY_SET &b)
Perform boolean polyset exclusive or.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
int AddHole(const SHAPE_LINE_CHAIN &aHole, int aOutline=-1)
Adds a new hole to the given outline (default: last) and returns its index.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
void BooleanIntersection(const SHAPE_POLY_SET &b)
Perform boolean polyset intersection.
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int OutlineCount() const
Return the number of outlines in the set.
void Move(const VECTOR2I &aVector) override
static bool Register(const KI_TEST::UTILITY_PROGRAM &aProgInfo)
Register a utility program factory function against an ID string.
@ MAGENTA
Definition color4d.h:56
@ GREEN
Definition color4d.h:53
@ CYAN
Definition color4d.h:54
@ YELLOW
Definition color4d.h:63
@ RED
Definition color4d.h:55
static bool registered
@ DEGREES_T
Definition eda_angle.h:31
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
Definition eda_angle.h:407
static const wxChar tracePnsPlayground[]
Flag to enable PNS playground debugging output.
@ UNDEFINED_LAYER
Definition layer_ids.h:57
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
int playground_main_func(int argc, char *argv[])
static bool registered1
int drawShapes(int argc, char *argv[])
static bool collide(const SHAPE_LINE_CHAIN &aLhs, const SHAPE_LINE_CHAIN &aRhs, int aClearance, int *aDistance=nullptr, VECTOR2I *aPt1=nullptr)
bool collideArc2Arc(const SHAPE_ARC &a1, const SHAPE_ARC &a2, int clearance, SEG &minDistSeg)
std::shared_ptr< PNS_LOG_VIEWER_OVERLAY > overlay
int clearance
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683
VECTOR2< double > VECTOR2D
Definition vector2d.h:682