KiCad PCB EDA Suite
PNS Namespace Reference

Push and Shove diff pair dimensions (gap) settings dialog. More...

Classes

class  ALGO_BASE
 ALGO_BASE. More...
 
class  ARC
 
class  AREA_CONSTRAINT
 
class  COMPONENT_DRAGGER
 COMPONENT_DRAGGER. More...
 
struct  CONSTRAINT
 
class  COST_ESTIMATOR
 COST_ESTIMATOR. More...
 
class  DEBUG_DECORATOR
 
class  DIFF_PAIR
 DIFF_PAIR. More...
 
class  DIFF_PAIR_PLACER
 LINE_PLACER. More...
 
class  DP_GATEWAY
 DP_GATEWAY. More...
 
class  DP_GATEWAYS
 DP_GATEWAYS. More...
 
class  DP_MEANDER_PLACER
 DP_MEANDER_PLACER. More...
 
class  DP_PRIMITIVE_PAIR
 DP_PRIMITIVE_PAIR. More...
 
class  DRAG_ALGO
 DRAG_ALGO. More...
 
class  DRAGGER
 DRAGGER. More...
 
class  FIXED_TAIL
 
struct  HIT_VISITOR
 
class  INDEX
 INDEX. More...
 
class  ITEM
 ITEM. More...
 
class  ITEM_SET
 
class  JOINT
 JOINT. More...
 
class  KEEP_TOPOLOGY_CONSTRAINT
 
class  LINE
 
class  LINE_PLACER
 LINE_PLACER. More...
 
class  LINK_HOLDER
 
class  LINKED_ITEM
 
class  LOGGER
 
class  MEANDER_PLACER
 MEANDER_PLACER. More...
 
class  MEANDER_PLACER_BASE
 MEANDER_PLACER_BASE. More...
 
class  MEANDER_SETTINGS
 MEANDER_SETTINGS. More...
 
class  MEANDER_SHAPE
 MEANDER_SETTINGS. More...
 
class  MEANDER_SKEW_PLACER
 MEANDER_SKEW_PLACER. More...
 
class  MEANDERED_LINE
 MEANDERED_LINE. More...
 
class  NODE
 NODE. More...
 
struct  OBSTACLE
 Struct OBSTACLE. More...
 
class  OBSTACLE_VISITOR
 Struct OBSTACLE_VISITOR. More...
 
class  OPT_CONSTRAINT
 
class  OPTIMIZER
 OPTIMIZER. More...
 
class  PLACEMENT_ALGO
 PLACEMENT_ALGO. More...
 
class  POSTURE_SOLVER
 
class  PRESERVE_VERTEX_CONSTRAINT
 
class  RESTRICT_VERTEX_RANGE_CONSTRAINT
 
class  ROUTER
 
class  ROUTER_IFACE
 ROUTER. More...
 
class  ROUTING_SETTINGS
 ROUTING_SETTINGS. More...
 
class  RULE_RESOLVER
 
class  SEGMENT
 
class  SHOVE
 SHOVE. More...
 
class  SIZES_SETTINGS
 
class  SOLID
 
class  TIME_LIMIT
 
class  TOOL_BASE
 
class  TOPOLOGY
 
class  VIA
 
struct  VIA_HANDLE
 
class  WALKAROUND
 

Enumerations

enum  LineMarker {
  MK_HEAD = ( 1 << 0 ), MK_VIOLATION = ( 1 << 3 ), MK_LOCKED = ( 1 << 4 ), MK_DP_COUPLED = ( 1 << 5 ),
  MK_HOLE = ( 1 << 6 )
}
 
enum  MEANDER_TYPE {
  MT_SINGLE, MT_START, MT_FINISH, MT_TURN,
  MT_CHECK_START, MT_CHECK_FINISH, MT_CORNER, MT_EMPTY
}
 Shapes of available meanders. More...
 
enum  MEANDER_STYLE { MEANDER_STYLE_ROUND = 1, MEANDER_STYLE_CHAMFER }
 

meander corner shape

More...
 
enum  CONSTRAINT_TYPE {
  CONSTRAINT_TYPE::CT_CLEARANCE = 1, CONSTRAINT_TYPE::CT_DIFF_PAIR_GAP = 2, CONSTRAINT_TYPE::CT_LENGTH = 3, CONSTRAINT_TYPE::CT_WIDTH = 4,
  CONSTRAINT_TYPE::CT_VIA_DIAMETER = 5, CONSTRAINT_TYPE::CT_VIA_HOLE = 6, CONSTRAINT_TYPE::CT_HOLE_CLEARANCE = 7, CONSTRAINT_TYPE::CT_EDGE_CLEARANCE = 8,
  CONSTRAINT_TYPE::CT_HOLE_TO_HOLE = 9
}
 RULE_RESOLVER. More...
 
enum  ROUTER_MODE {
  PNS_MODE_ROUTE_SINGLE = 1, PNS_MODE_ROUTE_DIFF_PAIR, PNS_MODE_TUNE_SINGLE, PNS_MODE_TUNE_DIFF_PAIR,
  PNS_MODE_TUNE_DIFF_PAIR_SKEW
}
 
enum  DRAG_MODE {
  DM_CORNER = 0x1, DM_SEGMENT = 0x2, DM_VIA = 0x4, DM_FREE_ANGLE = 0x8,
  DM_ARC = 0x10, DM_ANY = 0x17, DM_COMPONENT = 0x20
}
 
enum  PNS_MODE { RM_MarkObstacles = 0, RM_Shove, RM_Walkaround, RM_Smart }
 

Routing modes

More...
 
enum  PNS_OPTIMIZATION_EFFORT { OE_LOW = 0, OE_MEDIUM = 1, OE_FULL = 2 }
 

Optimization effort

More...
 
enum  CORNER_MODE { CORNER_MODE::MITERED_90, CORNER_MODE::MITERED_45, CORNER_MODE::ROUNDED_90, CORNER_MODE::ROUNDED_45 }
 

What kind of corners to create in the line placers

More...
 

Functions

static DIRECTION_45::AngleType angle (const VECTOR2I &a, const VECTOR2I &b)
 
static bool checkGap (const SHAPE_LINE_CHAIN &p, const SHAPE_LINE_CHAIN &n, int gap)
 
static VECTOR2I makeGapVector (VECTOR2I dir, int length)
 
bool commonParallelProjection (SEG p, SEG n, SEG &pClip, SEG &nClip)
 
OPT_VECTOR2I getDanglingAnchor (NODE *aNode, ITEM *aItem)
 
template<typename T , typename S >
std::unique_ptr< T > ItemCast (std::unique_ptr< S > aPtr)
 
template<typename T >
std::unique_ptr< typename std::remove_const< T >::type > Clone (const T &aItem)
 
bool operator== (JOINT::HASH_TAG const &aP1, JOINT::HASH_TAG const &aP2)
 
SHAPE_LINE_CHAIN dragCornerInternal (const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aP)
 
static void extendBox (BOX2I &aBox, bool &aDefined, const VECTOR2I &aP)
 
VECTOR2I closestProjectedPoint (const SHAPE_LINE_CHAIN &line, const VECTOR2I &p)
 
static bool pointInside2 (const SHAPE_LINE_CHAIN &aL, const VECTOR2I &aP)
 
int findCoupledVertices (const VECTOR2I &aVertex, const SEG &aOrigSeg, const SHAPE_LINE_CHAIN &aCoupled, DIFF_PAIR *aPair, int *aIndices)
 
bool verifyDpBypass (NODE *aNode, DIFF_PAIR *aPair, bool aRefIsP, const SHAPE_LINE_CHAIN &aNewRef, const SHAPE_LINE_CHAIN &aNewCoupled)
 
bool coupledBypass (NODE *aNode, DIFF_PAIR *aPair, bool aRefIsP, const SHAPE_LINE_CHAIN &aRef, const SHAPE_LINE_CHAIN &aRefBypass, const SHAPE_LINE_CHAIN &aCoupled, SHAPE_LINE_CHAIN &aNewCoupled)
 
bool checkDpColliding (NODE *aNode, DIFF_PAIR *aPair, bool aIsP, const SHAPE_LINE_CHAIN &aPath)
 
static int64_t shovedArea (const SHAPE_LINE_CHAIN &aOld, const SHAPE_LINE_CHAIN &aNew)
 
bool tightenSegment (bool dir, NODE *aNode, const LINE &cur, const SHAPE_LINE_CHAIN &in, SHAPE_LINE_CHAIN &out)
 
void Tighten (NODE *aNode, const SHAPE_LINE_CHAIN &aOldLine, const LINE &aNewLine, LINE &aOptimized)
 
static VIAfindViaByHandle (NODE *aNode, const VIA_HANDLE &handle)
 
static const SHAPE_LINE_CHAIN buildHullForPrimitiveShape (const SHAPE *aShape, int aClearance, int aWalkaroundThickness)
 
const SHAPE_LINE_CHAIN OctagonalHull (const VECTOR2I &aP0, const VECTOR2I &aSize, int aClearance, int aChamfer)
 
const SHAPE_LINE_CHAIN ArcHull (const SHAPE_ARC &aSeg, int aClearance, int aWalkaroundThickness)
 Various utility functions. More...
 
const SHAPE_LINE_CHAIN SegmentHull (const SHAPE_SEGMENT &aSeg, int aClearance, int aWalkaroundThickness)
 
static void MoveDiagonal (SEG &aDiagonal, const SHAPE_LINE_CHAIN &aVertices, int aClearance)
 
const SHAPE_LINE_CHAIN ConvexHull (const SHAPE_SIMPLE &aConvex, int aClearance)
 Function ConvexHull() More...
 
SHAPE_RECT ApproximateSegmentAsRect (const SHAPE_SEGMENT &aSeg)
 
OPT_BOX2I ChangedArea (const ITEM *aItemA, const ITEM *aItemB)
 
OPT_BOX2I ChangedArea (const LINE &aLineA, const LINE &aLineB)
 
bool clipToLoopStart (SHAPE_LINE_CHAIN &l)
 

Variables

static DEBUG_DECORATORg_dbg
 
static ROUTERtheRouter
 
const int pnsSchemaVersion = 0
 
constexpr int HULL_MARGIN = 10
 

Detailed Description

Push and Shove diff pair dimensions (gap) settings dialog.

Push and Shove router settings dialog.

Enumeration Type Documentation

◆ CONSTRAINT_TYPE

enum PNS::CONSTRAINT_TYPE
strong

RULE_RESOLVER.

An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between two items.

Enumerator
CT_CLEARANCE 
CT_DIFF_PAIR_GAP 
CT_LENGTH 
CT_WIDTH 
CT_VIA_DIAMETER 
CT_VIA_HOLE 
CT_HOLE_CLEARANCE 
CT_EDGE_CLEARANCE 
CT_HOLE_TO_HOLE 

Definition at line 59 of file pns_node.h.

◆ CORNER_MODE

enum PNS::CORNER_MODE
strong

What kind of corners to create in the line placers

Enumerator
MITERED_90 

H/V only (90-degree corners) (not yet implemented)

MITERED_45 

H/V/45 with mitered corners (default)

ROUNDED_90 

H/V with filleted corners (not yet implemented)

ROUNDED_45 

H/V/45 with filleted corners.

Definition at line 54 of file pns_routing_settings.h.

55 {
56  MITERED_90,
57  MITERED_45,
58  ROUNDED_90,
59  ROUNDED_45
60 };
H/V/45 with filleted corners.
H/V with filleted corners (not yet implemented)
H/V only (90-degree corners) (not yet implemented)
H/V/45 with mitered corners (default)

◆ DRAG_MODE

Enumerator
DM_CORNER 
DM_SEGMENT 
DM_VIA 
DM_FREE_ANGLE 
DM_ARC 
DM_ANY 
DM_COMPONENT 

Definition at line 76 of file pns_router.h.

77 {
78  DM_CORNER = 0x1,
79  DM_SEGMENT = 0x2,
80  DM_VIA = 0x4,
81  DM_FREE_ANGLE = 0x8,
82  DM_ARC = 0x10,
83  DM_ANY = 0x17,
84  DM_COMPONENT = 0x20
85 };

◆ LineMarker

Enumerator
MK_HEAD 
MK_VIOLATION 
MK_LOCKED 
MK_DP_COUPLED 
MK_HOLE 

Definition at line 39 of file pns_item.h.

39  {
40  MK_HEAD = ( 1 << 0 ),
41  MK_VIOLATION = ( 1 << 3 ),
42  MK_LOCKED = ( 1 << 4 ),
43  MK_DP_COUPLED = ( 1 << 5 ),
44  MK_HOLE = ( 1 << 6 )
45 };

◆ MEANDER_STYLE

meander corner shape

Enumerator
MEANDER_STYLE_ROUND 
MEANDER_STYLE_CHAMFER 

Definition at line 47 of file pns_meander.h.

47  {
48  MEANDER_STYLE_ROUND = 1, // rounded (90 degree arc)
49  MEANDER_STYLE_CHAMFER // chamfered (45 degree segment)
50 };

◆ MEANDER_TYPE

Shapes of available meanders.

Enumerator
MT_SINGLE 
MT_START 
MT_FINISH 
MT_TURN 
MT_CHECK_START 
MT_CHECK_FINISH 
MT_CORNER 
MT_EMPTY 

Definition at line 35 of file pns_meander.h.

35  {
36  MT_SINGLE, // _|^|_, single-sided
37  MT_START, // _|^|
38  MT_FINISH, // |^|_
39  MT_TURN, // |^| or |_|
40  MT_CHECK_START, // try fitting a start type, but don't produce a line
41  MT_CHECK_FINISH, // try fitting a finish type, but don't produce a line
42  MT_CORNER, // line corner
43  MT_EMPTY // no meander (straight line)
44 };

◆ PNS_MODE

Routing modes

Enumerator
RM_MarkObstacles 
RM_Shove 

Ignore collisions, mark obstacles

RM_Walkaround 

Only shove

RM_Smart 

Only walkaround

Guess what's better, try to make least mess on the PCB

Definition at line 37 of file pns_routing_settings.h.

38 {
39  RM_MarkObstacles = 0,
40  RM_Shove,
42  RM_Smart
43 };
Ignore collisions, mark obstacles
Only walkaround

◆ PNS_OPTIMIZATION_EFFORT

Optimization effort

Enumerator
OE_LOW 
OE_MEDIUM 
OE_FULL 

Definition at line 46 of file pns_routing_settings.h.

◆ ROUTER_MODE

Enumerator
PNS_MODE_ROUTE_SINGLE 
PNS_MODE_ROUTE_DIFF_PAIR 
PNS_MODE_TUNE_SINGLE 
PNS_MODE_TUNE_DIFF_PAIR 
PNS_MODE_TUNE_DIFF_PAIR_SKEW 

Definition at line 68 of file pns_router.h.

Function Documentation

◆ angle()

static DIRECTION_45::AngleType PNS::angle ( const VECTOR2I a,
const VECTOR2I b 
)
static

Definition at line 178 of file pns_diff_pair.cpp.

179 {
180  DIRECTION_45 dir_a( a );
181  DIRECTION_45 dir_b( b );
182 
183  return dir_a.Angle( dir_b );
184 }
DIRECTION_45.
Definition: direction45.h:37

References DIRECTION_45::Angle().

Referenced by DXF_IMPORT_PLUGIN::addArc(), EC_45DEGREE::Apply(), EC_CIRCLE::Apply(), HPGL_PLOTTER::Arc(), GEOM_TEST::ArePerpendicular(), BuildCornersList_S_Shape(), PNS::DP_GATEWAYS::BuildGeneric(), PNS::OPTIMIZER::circleBreakouts(), PCB_SHAPE::computeArcBBox(), ConvertOutlineToPolygon(), AM_PRIMITIVE::ConvertShapeToPolygon(), D_CODE::ConvertShapeToPolygon(), MICROWAVE_TOOL::createFootprint(), SCH_GLOBALLABEL::CreateGraphicShape(), PNS::OPTIMIZER::customBreakouts(), KIGFX::PCB_PAINTER::draw(), DRAWING_TOOL::DrawDimension(), ROUTER_PREVIEW_ITEM::drawLineChain(), AR_MATRIX::drawSegmentQcq(), ROUTER_PREVIEW_ITEM::drawShape(), GBR_TO_PCB_EXPORTER::export_non_copper_item(), export_vrml_line(), PCB_TEXT::Flip(), DSN::SPECCTRA_DB::FromBOARD(), RENDER_3D_LEGACY::generateRing(), GetArcAngle(), FP_TEXT::GetBoundingBox(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetStartAngle(), KIGFX::PREVIEW::ARC_GEOM_MANAGER::GetSubtended(), ARRAY_CIRCULAR_OPTIONS::GetTransform(), GRCSegm(), PNS::LINE_PLACER::handlePullback(), HelperShapeLineChainFromAltiumVertices(), idf_export_footprint(), DIALOG_PAD_PROPERTIES::initValues(), DXF_IMPORT_PLUGIN::insertArc(), PNS::LINE::Is45Degree(), CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions(), LEGACY_PLUGIN::loadFP_SHAPE(), LEGACY_PLUGIN::loadPCB_LINE(), LEGACY_PLUGIN::loadPCB_TEXT(), EAGLE_PLUGIN::loadPlain(), EAGLE_PLUGIN::loadPolygon(), EAGLE_PLUGIN::loadSignals(), DSN::SPECCTRA_DB::makeIMAGE(), EAGLE_PLUGIN::packageCircle(), EAGLE_PLUGIN::packagePolygon(), SHAPE_LINE_CHAIN::Parse(), ALTIUM_PCB::ParseArcs6Data(), GPCB_FPL_CACHE::parseFOOTPRINT(), SCH_SEXPR_PARSER::parseSchSheetPin(), FABMASTER::processArc(), processComp(), processSolid(), AR_AUTOPLACER::rotateFootprint(), RotatePoint(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveText(), PCB_SHAPE::SetArcGeometry(), FP_TEXT::SetDrawCoord(), PAD::SetDrawCoord(), FP_SHAPE::SetLocalCoord(), FP_TEXT::SetLocalCoord(), PNS::LINE_PLACER::Start(), AR_MATRIX::traceArc(), AR_MATRIX::traceCircle(), AR_MATRIX::TraceFilledRectangle(), TransformCircleToPolygon(), TransformOvalToPolygon(), TransformRoundRectToPolygon(), PAD::TransformShapeWithClearanceToPolygon(), and FP_TEXT::ViewBBox().

◆ ApproximateSegmentAsRect()

SHAPE_RECT PNS::ApproximateSegmentAsRect ( const SHAPE_SEGMENT aSeg)

Definition at line 225 of file pns_utils.cpp.

226 {
227  SHAPE_RECT r;
228 
229  VECTOR2I delta( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 );
230  VECTOR2I p0( aSeg.GetSeg().A - delta );
231  VECTOR2I p1( aSeg.GetSeg().B + delta );
232 
233  return SHAPE_RECT( std::min( p0.x, p1.x ), std::min( p0.y, p1.y ),
234  std::abs( p1.x - p0.x ), std::abs( p1.y - p0.y ) );
235 }
const SEG & GetSeg() const
VECTOR2I A
Definition: seg.h:47
int GetWidth() const
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, SHAPE_SEGMENT::GetSeg(), and SHAPE_SEGMENT::GetWidth().

Referenced by PNS::OPTIMIZER::computeBreakouts().

◆ ArcHull()

const SHAPE_LINE_CHAIN PNS::ArcHull ( const SHAPE_ARC aSeg,
int  aClearance,
int  aWalkaroundThickness 
)

Various utility functions.

Definition at line 55 of file pns_utils.cpp.

57 {
58  int d = aSeg.GetWidth() / 2 + aClearance + aWalkaroundThickness / 2 + HULL_MARGIN;
59  int x = (int)( 2.0 / ( 1.0 + M_SQRT2 ) * d ) / 2;
60 
61  auto line = aSeg.ConvertToPolyline();
62 
64  s.SetClosed( true );
65  std::vector<VECTOR2I> reverse_line;
66 
67  auto seg = line.Segment( 0 );
68  VECTOR2I dir = seg.B - seg.A;
69  VECTOR2I p0 = dir.Perpendicular().Resize( d );
70  VECTOR2I ds = dir.Perpendicular().Resize( x );
71  VECTOR2I pd = dir.Resize( x );
72  VECTOR2I dp = dir.Resize( d );
73 
74  // Append the first curve
75  s.Append( seg.A + p0 - pd );
76  s.Append( seg.A - dp + ds );
77  s.Append( seg.A - dp - ds );
78  s.Append( seg.A - p0 - pd );
79 
80  for( int i = 1; i < line.SegmentCount(); i++ )
81  {
82  auto old_seg = seg;
83  auto endpt = ( old_seg.A - old_seg.B ).Resize( seg.Length() );
84  old_seg.A = old_seg.B + endpt;
85 
86  seg = line.Segment( i );
87  auto dir2 = old_seg.A - seg.B;
88 
89  p0 = dir2.Perpendicular().Resize( d );
90  s.Append( seg.A - p0 );
91  reverse_line.push_back( seg.A + p0 );
92  }
93 
94  pd = dir.Resize( x );
95  dp = dir.Resize( d );
96  s.Append( seg.B - p0 + pd );
97  s.Append( seg.B + dp - ds );
98  s.Append( seg.B + dp + ds );
99  s.Append( seg.B + p0 + pd );
100 
101  for( int i = reverse_line.size() - 1; i >= 0; i-- )
102  s.Append( reverse_line[i] );
103 
104  // make sure the hull outline is always clockwise
105  if( s.CSegment( 0 ).Side( line.Segment( 0 ).A ) < 0 )
106  return s.Reverse();
107  else
108  return s;
109 }
constexpr int HULL_MARGIN
Definition: pns_utils.h:34
VECTOR2< T > Perpendicular() const
Function Perpendicular computes the perpendicular vector.
Definition: vector2d.h:321
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
const SHAPE_LINE_CHAIN ConvertToPolyline(double aAccuracy=0.005 *PCB_IU_PER_MM) const
Constructs a SHAPE_LINE_CHAIN of segments from a given arc.
Definition: shape_arc.cpp:388
VECTOR2< T > Resize(T aNewLength) const
Function Resize returns a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:411
int GetWidth() const
Definition: shape_arc.h:116
const SEG CSegment(int aIndex) const
Function CSegment()
SHAPE_LINE_CHAIN.
int Side(const VECTOR2I &aP) const
Function Side()
Definition: seg.h:145

References SHAPE_LINE_CHAIN::Append(), SHAPE_ARC::ConvertToPolyline(), SHAPE_LINE_CHAIN::CSegment(), SHAPE_ARC::GetWidth(), HULL_MARGIN, VECTOR2< T >::Perpendicular(), VECTOR2< T >::Resize(), SHAPE_LINE_CHAIN::Reverse(), SHAPE_LINE_CHAIN::SetClosed(), and SEG::Side().

Referenced by PNS::ARC::Hull().

◆ buildHullForPrimitiveShape()

static const SHAPE_LINE_CHAIN PNS::buildHullForPrimitiveShape ( const SHAPE aShape,
int  aClearance,
int  aWalkaroundThickness 
)
static

Definition at line 37 of file pns_solid.cpp.

39 {
40  int cl = aClearance + ( aWalkaroundThickness + 1 )/ 2;
41 
42  switch( aShape->Type() )
43  {
44  case SH_RECT:
45  {
46  const SHAPE_RECT* rect = static_cast<const SHAPE_RECT*>( aShape );
47  return OctagonalHull( rect->GetPosition(),
48  rect->GetSize(),
49  cl + 1,
50  0.2 * cl );
51  }
52 
53  case SH_CIRCLE:
54  {
55  const SHAPE_CIRCLE* circle = static_cast<const SHAPE_CIRCLE*>( aShape );
56  int r = circle->GetRadius();
57  return OctagonalHull( circle->GetCenter() - VECTOR2I( r, r ),
58  VECTOR2I( 2 * r, 2 * r ),
59  cl + 1,
60  0.52 * ( r + cl ) );
61  }
62 
63  case SH_SEGMENT:
64  {
65  const SHAPE_SEGMENT* seg = static_cast<const SHAPE_SEGMENT*>( aShape );
66  return SegmentHull( *seg, aClearance, aWalkaroundThickness );
67  }
68 
69  case SH_SIMPLE:
70  {
71  const SHAPE_SIMPLE* convex = static_cast<const SHAPE_SIMPLE*>( aShape );
72 
73  return ConvexHull( *convex, cl );
74  }
75  default:
76  {
77  wxLogError("Unsupported hull shape: %d", aShape->Type() );
78  break;
79  }
80  }
81 
82  return SHAPE_LINE_CHAIN();
83 }
const SHAPE_LINE_CHAIN ConvexHull(const SHAPE_SIMPLE &aConvex, int aClearance)
Function ConvexHull()
Definition: pns_utils.cpp:169
SHAPE_SIMPLE.
Definition: shape_simple.h:43
int GetRadius() const
Definition: shape_circle.h:102
const VECTOR2I GetCenter() const
Definition: shape_circle.h:107
VECTOR2< int > VECTOR2I
Definition: vector2d.h:630
const SHAPE_LINE_CHAIN SegmentHull(const SHAPE_SEGMENT &aSeg, int aClearance, int aWalkaroundThickness)
Definition: pns_utils.cpp:112
const VECTOR2I GetSize() const
Function GetSize()
Definition: shape_rect.h:131
const VECTOR2I & GetPosition() const
Function GetPosition()
Definition: shape_rect.h:121
const SHAPE_LINE_CHAIN OctagonalHull(const VECTOR2I &aP0, const VECTOR2I &aSize, int aClearance, int aChamfer)
Definition: pns_utils.cpp:35
line chain (polyline)
Definition: shape.h:46
SHAPE_LINE_CHAIN.
Definition: shape.h:43
circle
Definition: shape.h:47
SHAPE_TYPE Type() const
Function Type()
Definition: shape.h:99
axis-aligned rectangle
Definition: shape.h:44

References ConvexHull(), SHAPE_CIRCLE::GetCenter(), SHAPE_RECT::GetPosition(), SHAPE_CIRCLE::GetRadius(), SHAPE_RECT::GetSize(), OctagonalHull(), SegmentHull(), SH_CIRCLE, SH_RECT, SH_SEGMENT, SH_SIMPLE, and SHAPE_BASE::Type().

Referenced by PNS::SOLID::HoleHull(), and PNS::SOLID::Hull().

◆ ChangedArea() [1/2]

OPT_BOX2I PNS::ChangedArea ( const ITEM aItemA,
const ITEM aItemB 
)

Definition at line 299 of file pns_utils.cpp.

300 {
301  if( aItemA->OfKind( ITEM::VIA_T ) && aItemB->OfKind( ITEM::VIA_T ) )
302  {
303  const VIA* va = static_cast<const VIA*>( aItemA );
304  const VIA* vb = static_cast<const VIA*>( aItemB );
305 
306  return va->ChangedArea( vb );
307  }
308  else if( aItemA->OfKind( ITEM::LINE_T ) && aItemB->OfKind( ITEM::LINE_T ) )
309  {
310  const LINE* la = static_cast<const LINE*> ( aItemA );
311  const LINE* lb = static_cast<const LINE*> ( aItemB );
312 
313  return la->ChangedArea( lb );
314  }
315 
316  return OPT_BOX2I();
317 }
Definition: track.h:344
OPT< BOX2I > OPT_BOX2I
Definition: box2.h:525

References PNS::VIA::ChangedArea(), PNS::LINE::ChangedArea(), PNS::ITEM::LINE_T, PNS::ITEM::OfKind(), and PNS::ITEM::VIA_T.

Referenced by PNS::SHOVE::replaceItems(), and PNS::SHOVE::replaceLine().

◆ ChangedArea() [2/2]

OPT_BOX2I PNS::ChangedArea ( const LINE aLineA,
const LINE aLineB 
)

Definition at line 319 of file pns_utils.cpp.

320 {
321  return aLineA.ChangedArea( &aLineB );
322 }

References PNS::LINE::ChangedArea().

◆ checkDpColliding()

bool PNS::checkDpColliding ( NODE aNode,
DIFF_PAIR aPair,
bool  aIsP,
const SHAPE_LINE_CHAIN aPath 
)

Definition at line 1185 of file pns_optimizer.cpp.

1186 {
1187  LINE tmp ( aIsP ? aPair->PLine() : aPair->NLine(), aPath );
1188 
1189  return static_cast<bool>( aNode->CheckColliding( &tmp ) );
1190 }

References PNS::NODE::CheckColliding(), PNS::DIFF_PAIR::NLine(), and PNS::DIFF_PAIR::PLine().

◆ checkGap()

static bool PNS::checkGap ( const SHAPE_LINE_CHAIN p,
const SHAPE_LINE_CHAIN n,
int  gap 
)
static

Definition at line 187 of file pns_diff_pair.cpp.

188 {
189  int i, j;
190 
191  for( i = 0; i < p.SegmentCount(); i++ )
192  {
193  for( j = 0; j < n.SegmentCount() ; j++ )
194  {
195  int dist = p.CSegment( i ).Distance( n.CSegment( j ) );
196 
197  if( dist < gap - 100 )
198  return false;
199  }
200  }
201 
202  return true;
203 }
int Distance(const SEG &aSeg) const
Function Distance()
Definition: seg.h:214
int SegmentCount() const
Function SegmentCount()
const SEG CSegment(int aIndex) const
Function CSegment()

References SHAPE_LINE_CHAIN::CSegment(), SEG::Distance(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by PNS::DIFF_PAIR::BuildInitial().

◆ clipToLoopStart()

bool PNS::clipToLoopStart ( SHAPE_LINE_CHAIN l)

Definition at line 160 of file pns_walkaround.cpp.

161 {
162  auto ip = l.SelfIntersecting();
163 
164  if(!ip)
165  return false;
166  else {
167  int pidx = l.Split( ip->p );
168  auto lead = l.Slice(0, pidx);
169  auto tail = l.Slice(pidx + 1, -1);
170 
171  int pidx2 = tail.Split( ip->p );
172 
173  auto dbg = ROUTER::GetInstance()->GetInterface()->GetDebugDecorator();
174  dbg->AddPoint( ip->p, 5 );
175 
176  l = lead;
177  l.Append( tail.Slice( 0, pidx2 ) );
178  //l = l.Slice(0, pidx);
179  return true;
180  }
181 
182 
183 }
int Split(const VECTOR2I &aP)
Function Split()
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
const OPT< INTERSECTION > SelfIntersecting() const
Function SelfIntersecting()
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()

References PNS::DEBUG_DECORATOR::AddPoint(), SHAPE_LINE_CHAIN::Append(), PNS::ROUTER_IFACE::GetDebugDecorator(), PNS::ROUTER::GetInstance(), PNS::ROUTER::GetInterface(), SHAPE_LINE_CHAIN::SelfIntersecting(), SHAPE_LINE_CHAIN::Slice(), and SHAPE_LINE_CHAIN::Split().

Referenced by PNS::WALKAROUND::Route().

◆ Clone()

template<typename T >
std::unique_ptr< typename std::remove_const<T>::type > PNS::Clone ( const T &  aItem)

Definition at line 278 of file pns_item.h.

279 {
280  static_assert( std::is_base_of<ITEM, T>::value, "Need to be handed an ITEM!" );
281  return std::unique_ptr<typename std::remove_const<T>::type>( aItem.Clone() );
282 }

Referenced by PNS::DRAGGER::dragViaMarkObstacles(), PNS::DRAGGER::dragViaWalkaround(), PNS::DIFF_PAIR_PLACER::FixRoute(), PNS::LINE_PLACER::FixRoute(), PNS::SHOVE::pushOrShoveVia(), DIALOG_PAD_PROPERTIES::redraw(), PNS::SHOVE::ShoveLines(), PNS::SHOVE::ShoveMultiLines(), and PNS::LINE_PLACER::SplitAdjacentSegments().

◆ closestProjectedPoint()

VECTOR2I PNS::closestProjectedPoint ( const SHAPE_LINE_CHAIN line,
const VECTOR2I p 
)

Definition at line 403 of file pns_line_placer.cpp.

404 {
405  // Keep distances squared for performance
406  SEG::ecoord min_dist_sq = VECTOR2I::ECOORD_MAX;
407  VECTOR2I closest;
408 
409  for( int i = 0; i < line.SegmentCount(); i++ )
410  {
411  const SEG& s = line.CSegment(i);
412  VECTOR2I a = s.NearestPoint( p );
413  int d_sq = (a - p).SquaredEuclideanNorm();
414 
415  if( d_sq < min_dist_sq )
416  {
417  min_dist_sq = d_sq;
418  closest = a;
419  }
420  }
421 
422  return closest;
423 }
VECTOR2I::extended_type ecoord
Definition: seg.h:42
static constexpr extended_type ECOORD_MAX
Definition: vector2d.h:81
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Function NearestPoint()
Definition: seg.h:409
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:39
const SEG CSegment(int aIndex) const
Function CSegment()

References SHAPE_LINE_CHAIN::CSegment(), VECTOR2< T >::ECOORD_MAX, SEG::NearestPoint(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by PNS::LINE_PLACER::rhWalkOnly().

◆ commonParallelProjection()

bool PNS::commonParallelProjection ( SEG  p,
SEG  n,
SEG pClip,
SEG nClip 
)

Definition at line 772 of file pns_diff_pair.cpp.

773 {
774  SEG n_proj_p( p.LineProject( n.A ), p.LineProject( n.B ) );
775 
776  int64_t t_a = 0;
777  int64_t t_b = p.TCoef( p.B );
778 
779  int64_t tproj_a = p.TCoef( n_proj_p.A );
780  int64_t tproj_b = p.TCoef( n_proj_p.B );
781 
782  if( t_b < t_a )
783  std::swap( t_b, t_a );
784 
785  if( tproj_b < tproj_a )
786  std::swap( tproj_b, tproj_a );
787 
788  if( t_b <= tproj_a )
789  return false;
790 
791  if( t_a >= tproj_b )
792  return false;
793 
794  int64_t t[4] = { 0, p.TCoef( p.B ), p.TCoef( n_proj_p.A ), p.TCoef( n_proj_p.B ) };
795  std::vector<int64_t> tv( t, t + 4 );
796  std::sort( tv.begin(), tv.end() ); // fixme: awful and disgusting way of finding 2 midpoints
797 
798  int64_t pLenSq = p.SquaredLength();
799 
800  VECTOR2I dp = p.B - p.A;
801  pClip.A.x = p.A.x + rescale( (int64_t)dp.x, tv[1], pLenSq );
802  pClip.A.y = p.A.y + rescale( (int64_t)dp.y, tv[1], pLenSq );
803 
804  pClip.B.x = p.A.x + rescale( (int64_t)dp.x, tv[2], pLenSq );
805  pClip.B.y = p.A.y + rescale( (int64_t)dp.y, tv[2], pLenSq );
806 
807  nClip.A = n.LineProject( pClip.A );
808  nClip.B = n.LineProject( pClip.B );
809 
810  return true;
811 }
ecoord SquaredLength() const
Definition: seg.h:332
VECTOR2I LineProject(const VECTOR2I &aP) const
Function LineProject()
Definition: seg.h:376
ecoord TCoef(const VECTOR2I &aP) const
Definition: seg.h:403
Definition: seg.h:39
VECTOR2I A
Definition: seg.h:47
T rescale(T aNumerator, T aValue, T aDenominator)
Function rescale()
Definition: util.h:95
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, SEG::LineProject(), rescale(), SEG::SquaredLength(), SEG::TCoef(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::DIFF_PAIR::CoupledLength(), and PNS::DIFF_PAIR::CoupledSegmentPairs().

◆ ConvexHull()

const SHAPE_LINE_CHAIN PNS::ConvexHull ( const SHAPE_SIMPLE aConvex,
int  aClearance 
)

Function ConvexHull()

Creates an octagonal hull around a convex polygon.

Parameters
aConvexThe convex polygon.
aClearanceThe minimum distance between polygon and hull.
Returns
A closed line chain describing the octagon.

Definition at line 169 of file pns_utils.cpp.

170 {
171  // this defines the horizontal and vertical lines in the hull octagon
172  BOX2I box = aConvex.BBox( aClearance + HULL_MARGIN );
173  box.Normalize();
174 
175  SEG topline = SEG( VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ),
176  VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() + box.GetHeight() ) );
177  SEG rightline = SEG( VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() + box.GetHeight() ),
178  VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() ) );
179  SEG bottomline = SEG( VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() ),
180  box.GetOrigin() );
181  SEG leftline = SEG( box.GetOrigin(), VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ) );
182 
183  const SHAPE_LINE_CHAIN& vertices = aConvex.Vertices();
184 
185  // top right diagonal
186  VECTOR2I corner = box.GetOrigin() + box.GetSize();
187  SEG toprightline = SEG( corner,
188  corner + VECTOR2I( box.GetHeight(), -box.GetHeight() ) );
189  MoveDiagonal( toprightline, vertices, aClearance );
190 
191  // bottom right diagonal
192  corner = box.GetOrigin() + VECTOR2I( box.GetWidth(), 0 );
193  SEG bottomrightline = SEG( corner + VECTOR2I( box.GetHeight(), box.GetHeight() ),
194  corner );
195  MoveDiagonal( bottomrightline, vertices, aClearance );
196 
197  // bottom left diagonal
198  corner = box.GetOrigin();
199  SEG bottomleftline = SEG( corner,
200  corner + VECTOR2I( -box.GetHeight(), box.GetHeight() ) );
201  MoveDiagonal( bottomleftline, vertices, aClearance );
202 
203  // top left diagonal
204  corner = box.GetOrigin() + VECTOR2I( 0, box.GetHeight() );
205  SEG topleftline = SEG( corner + VECTOR2I( -box.GetHeight(), -box.GetHeight() ),
206  corner );
207  MoveDiagonal( topleftline, vertices, aClearance );
208 
209  SHAPE_LINE_CHAIN octagon;
210  octagon.SetClosed( true );
211 
212  octagon.Append( *leftline.IntersectLines( bottomleftline ) );
213  octagon.Append( *bottomline.IntersectLines( bottomleftline ) );
214  octagon.Append( *bottomline.IntersectLines( bottomrightline ) );
215  octagon.Append( *rightline.IntersectLines( bottomrightline ) );
216  octagon.Append( *rightline.IntersectLines( toprightline ) );
217  octagon.Append( *topline.IntersectLines( toprightline ) );
218  octagon.Append( *topline.IntersectLines( topleftline ) );
219  octagon.Append( *leftline.IntersectLines( topleftline ) );
220 
221  return octagon;
222 }
constexpr int HULL_MARGIN
Definition: pns_utils.h:34
coord_type GetX() const
Definition: box2.h:190
OPT_VECTOR2I IntersectLines(const SEG &aSeg) const
Function IntersectLines()
Definition: seg.h:198
const BOX2I BBox(int aClearance=0) const override
Function BBox()
Definition: shape_simple.h:82
VECTOR2< int > VECTOR2I
Definition: vector2d.h:630
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
static void MoveDiagonal(SEG &aDiagonal, const SHAPE_LINE_CHAIN &aVertices, int aClearance)
Definition: pns_utils.cpp:157
coord_type GetWidth() const
Definition: box2.h:197
BOX2< Vec > & Normalize()
Function Normalize ensures that the height ant width are positive.
Definition: box2.h:129
const SHAPE_LINE_CHAIN & Vertices() const
Function Vertices()
Definition: shape_simple.h:133
Definition: seg.h:39
coord_type GetY() const
Definition: box2.h:191
SHAPE_LINE_CHAIN.
coord_type GetHeight() const
Definition: box2.h:198
const Vec & GetSize() const
Definition: box2.h:189
const Vec & GetOrigin() const
Definition: box2.h:193

References SHAPE_LINE_CHAIN::Append(), SHAPE_SIMPLE::BBox(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::GetSize(), BOX2< Vec >::GetWidth(), BOX2< Vec >::GetX(), BOX2< Vec >::GetY(), HULL_MARGIN, SEG::IntersectLines(), MoveDiagonal(), BOX2< Vec >::Normalize(), SHAPE_LINE_CHAIN::SetClosed(), and SHAPE_SIMPLE::Vertices().

Referenced by buildHullForPrimitiveShape().

◆ coupledBypass()

bool PNS::coupledBypass ( NODE aNode,
DIFF_PAIR aPair,
bool  aRefIsP,
const SHAPE_LINE_CHAIN aRef,
const SHAPE_LINE_CHAIN aRefBypass,
const SHAPE_LINE_CHAIN aCoupled,
SHAPE_LINE_CHAIN aNewCoupled 
)

Definition at line 1128 of file pns_optimizer.cpp.

1131 {
1132  int vStartIdx[1024]; // fixme: possible overflow
1133  int nStarts = findCoupledVertices( aRefBypass.CPoint( 0 ), aRefBypass.CSegment( 0 ),
1134  aCoupled, aPair, vStartIdx );
1135  DIRECTION_45 dir( aRefBypass.CSegment( 0 ) );
1136 
1137  int64_t bestLength = -1;
1138  bool found = false;
1139  SHAPE_LINE_CHAIN bestBypass;
1140  int si, ei;
1141 
1142  for( int i=0; i< nStarts; i++ )
1143  {
1144  for( int j = 1; j < aCoupled.PointCount() - 1; j++ )
1145  {
1146  int delta = std::abs ( vStartIdx[i] - j );
1147 
1148  if( delta > 1 )
1149  {
1150  const VECTOR2I& vs = aCoupled.CPoint( vStartIdx[i] );
1151  SHAPE_LINE_CHAIN bypass = dir.BuildInitialTrace( vs, aCoupled.CPoint(j),
1152  dir.IsDiagonal() );
1153 
1154  int64_t coupledLength = aPair->CoupledLength( aRef, bypass );
1155 
1156  SHAPE_LINE_CHAIN newCoupled = aCoupled;
1157 
1158  si = vStartIdx[i];
1159  ei = j;
1160 
1161  if(si < ei)
1162  newCoupled.Replace( si, ei, bypass );
1163  else
1164  newCoupled.Replace( ei, si, bypass.Reverse() );
1165 
1166  if( coupledLength > bestLength && verifyDpBypass( aNode, aPair, aRefIsP, aRef,
1167  newCoupled) )
1168  {
1169  bestBypass = newCoupled;
1170  bestLength = coupledLength;
1171  found = true;
1172  }
1173  }
1174  }
1175  }
1176 
1177 
1178  if( found )
1179  aNewCoupled = bestBypass;
1180 
1181  return found;
1182 }
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
DIRECTION_45.
Definition: direction45.h:37
int findCoupledVertices(const VECTOR2I &aVertex, const SEG &aOrigSeg, const SHAPE_LINE_CHAIN &aCoupled, DIFF_PAIR *aPair, int *aIndices)
bool verifyDpBypass(NODE *aNode, DIFF_PAIR *aPair, bool aRefIsP, const SHAPE_LINE_CHAIN &aNewRef, const SHAPE_LINE_CHAIN &aNewCoupled)
const SEG CSegment(int aIndex) const
Function CSegment()
SHAPE_LINE_CHAIN.
void Replace(int aStartIndex, int aEndIndex, const VECTOR2I &aP)
Function Replace()

References SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CSegment(), findCoupledVertices(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::Replace(), SHAPE_LINE_CHAIN::Reverse(), and verifyDpBypass().

Referenced by PNS::OPTIMIZER::mergeDpStep().

◆ dragCornerInternal()

SHAPE_LINE_CHAIN PNS::dragCornerInternal ( const SHAPE_LINE_CHAIN aOrigin,
const VECTOR2I aP 
)

Definition at line 446 of file pns_line.cpp.

447 {
448  OPT<SHAPE_LINE_CHAIN> picked;
449  int i;
450  int d = 2;
451 
452  if( aOrigin.SegmentCount() == 1)
453  {
454  DIRECTION_45 dir( aOrigin.CPoint( 0 ) - aOrigin.CPoint( 1 ) );
455 
456  return DIRECTION_45().BuildInitialTrace( aOrigin.CPoint( 0 ), aP, dir.IsDiagonal() );
457  }
458 
459  if( aOrigin.CSegment( -1 ).Length() > 100000 * 30 ) // fixme: constant/parameter?
460  d = 1;
461 
462  for( i = aOrigin.SegmentCount() - d; i >= 0; i-- )
463  {
464  DIRECTION_45 d_start( aOrigin.CSegment( i ) );
465  VECTOR2I p_start = aOrigin.CPoint( i );
466  SHAPE_LINE_CHAIN paths[2];
467  DIRECTION_45 dirs[2];
468  DIRECTION_45 d_prev = ( i > 0 ? DIRECTION_45( aOrigin.CSegment( i-1 ) ) : DIRECTION_45() );
469  int dirCount = 0;
470 
471  for( int j = 0; j < 2; j++ )
472  {
473  paths[j] = d_start.BuildInitialTrace( p_start, aP, j );
474 
475  if( paths[j].SegmentCount() < 1 )
476  continue;
477 
478  assert( dirCount < int( sizeof( dirs ) / sizeof( dirs[0] ) ) );
479 
480  dirs[dirCount] = DIRECTION_45( paths[j].CSegment( 0 ) );
481  ++dirCount;
482  }
483 
484  for( int j = 0; j < dirCount; j++ )
485  {
486  if( dirs[j] == d_start )
487  {
488  picked = paths[j];
489  break;
490  }
491  }
492 
493  if( picked )
494  break;
495 
496  for( int j = 0; j < dirCount; j++ )
497  {
498  if( dirs[j].IsObtuse( d_prev ) )
499  {
500  picked = paths[j];
501  break;
502  }
503  }
504 
505  if( picked )
506  break;
507  }
508 
509  if( picked )
510  {
511  SHAPE_LINE_CHAIN path = aOrigin.Slice( 0, i );
512  path.Append( *picked );
513 
514  return path;
515  }
516 
517  DIRECTION_45 dir( aOrigin.CPoint( -1 ) - aOrigin.CPoint( -2 ) );
518 
519  return DIRECTION_45().BuildInitialTrace( aOrigin.CPoint( 0 ), aP, dir.IsDiagonal() );
520 }
int Length() const
Function Length()
Definition: seg.h:327
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
DIRECTION_45.
Definition: direction45.h:37
const SHAPE_LINE_CHAIN BuildInitialTrace(const VECTOR2I &aP0, const VECTOR2I &aP1, bool aStartDiagonal=false, bool aFillet=false) const
Builds a 2-segment line chain between points aP0 and aP1 and following 45-degree routing regime.
int SegmentCount() const
Function SegmentCount()
const SEG CSegment(int aIndex) const
Function CSegment()
SHAPE_LINE_CHAIN.
boost::optional< T > OPT
Definition: optional.h:7

References SHAPE_LINE_CHAIN::Append(), DIRECTION_45::BuildInitialTrace(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CSegment(), SEG::Length(), SHAPE_LINE_CHAIN::SegmentCount(), and SHAPE_LINE_CHAIN::Slice().

Referenced by PNS::LINE::dragCorner45().

◆ extendBox()

static void PNS::extendBox ( BOX2I aBox,
bool &  aDefined,
const VECTOR2I aP 
)
static

Definition at line 951 of file pns_line.cpp.

952 {
953  if( aDefined )
954  {
955  aBox.Merge( aP );
956  }
957  else
958  {
959  aBox = BOX2I( aP, VECTOR2I( 0, 0 ) );
960  aDefined = true;
961  }
962 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:522
VECTOR2< int > VECTOR2I
Definition: vector2d.h:630
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Function Merge modifies the position and size of the rectangle in order to contain aRect.
Definition: box2.h:386

References BOX2< Vec >::Merge().

Referenced by PNS::LINE::ChangedArea().

◆ findCoupledVertices()

int PNS::findCoupledVertices ( const VECTOR2I aVertex,
const SEG aOrigSeg,
const SHAPE_LINE_CHAIN aCoupled,
DIFF_PAIR aPair,
int *  aIndices 
)

Definition at line 1083 of file pns_optimizer.cpp.

1085 {
1086  int count = 0;
1087 
1088  for( int i = 0; i < aCoupled.SegmentCount(); i++ )
1089  {
1090  SEG s = aCoupled.CSegment( i );
1091  VECTOR2I projOverCoupled = s.LineProject ( aVertex );
1092 
1093  if( s.ApproxParallel( aOrigSeg ) )
1094  {
1095  int64_t dist = int64_t{(( projOverCoupled - aVertex ).EuclideanNorm())} - aPair->Width();
1096 
1097  if( aPair->GapConstraint().Matches( dist ) )
1098  {
1099  *aIndices++ = i;
1100  count++;
1101  }
1102  }
1103  }
1104 
1105  return count;
1106 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:134
VECTOR2I LineProject(const VECTOR2I &aP) const
Function LineProject()
Definition: seg.h:376
bool ApproxParallel(const SEG &aSeg) const
Definition: seg.h:272
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:39
const SEG CSegment(int aIndex) const
Function CSegment()

References SEG::ApproxParallel(), SHAPE_LINE_CHAIN::CSegment(), EuclideanNorm(), PNS::DIFF_PAIR::GapConstraint(), SEG::LineProject(), RANGED_NUM< T >::Matches(), SHAPE_LINE_CHAIN::SegmentCount(), and PNS::DIFF_PAIR::Width().

Referenced by coupledBypass().

◆ findViaByHandle()

static VIA* PNS::findViaByHandle ( NODE aNode,
const VIA_HANDLE handle 
)
static

Definition at line 1476 of file pns_shove.cpp.

1477 {
1478  JOINT* jt = aNode->FindJoint( handle.pos, handle.layers.Start(), handle.net );
1479 
1480  if( !jt )
1481  return nullptr;
1482 
1483  for( ITEM* item : jt->LinkList() )
1484  {
1485  if( item->OfKind( ITEM::VIA_T ) )
1486  {
1487  if( item->Net() == handle.net && item->Layers().Overlaps(handle.layers) )
1488  return static_cast<VIA*>( item );
1489  }
1490  }
1491 
1492  return nullptr;
1493 }

References PNS::NODE::FindJoint(), PNS::VIA_HANDLE::layers, PNS::JOINT::LinkList(), PNS::VIA_HANDLE::net, PNS::VIA_HANDLE::pos, LAYER_RANGE::Start(), and PNS::ITEM::VIA_T.

Referenced by PNS::SHOVE::ShoveDraggingVia().

◆ getDanglingAnchor()

OPT_VECTOR2I PNS::getDanglingAnchor ( NODE aNode,
ITEM aItem 
)

Definition at line 406 of file pns_diff_pair_placer.cpp.

407 {
408  switch( aItem->Kind() )
409  {
410  case ITEM::VIA_T:
411  case ITEM::SOLID_T:
412  return aItem->Anchor( 0 );
413 
414  case ITEM::ARC_T:
415  case ITEM::SEGMENT_T:
416  {
417  SEGMENT* s = static_cast<SEGMENT*>( aItem );
418 
419  JOINT* jA = aNode->FindJoint( aItem->Anchor( 0 ), aItem );
420  JOINT* jB = aNode->FindJoint( aItem->Anchor( 1 ), aItem );
421 
422  if( jA && jA->LinkCount() == 1 )
423  return s->Seg().A;
424  else if( jB && jB->LinkCount() == 1 )
425  return s->Seg().B;
426  else
427  return OPT_VECTOR2I();
428  }
429 
430  default:
431  return OPT_VECTOR2I();
432  }
433 }
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:37

References SEG::A, PNS::ITEM::Anchor(), PNS::ITEM::ARC_T, SEG::B, PNS::NODE::FindJoint(), PNS::ITEM::Kind(), PNS::JOINT::LinkCount(), PNS::SEGMENT::Seg(), PNS::ITEM::SEGMENT_T, PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair().

◆ ItemCast()

template<typename T , typename S >
std::unique_ptr<T> PNS::ItemCast ( std::unique_ptr< S >  aPtr)

Definition at line 270 of file pns_item.h.

271 {
272  static_assert( std::is_base_of<ITEM, S>::value, "Need to be handed a ITEM!" );
273  static_assert( std::is_base_of<ITEM, T>::value, "Need to cast to an ITEM!" );
274  return std::unique_ptr<T>( static_cast<T*>( aPtr.release() ) );
275 }

◆ makeGapVector()

static VECTOR2I PNS::makeGapVector ( VECTOR2I  dir,
int  length 
)
static

Definition at line 409 of file pns_diff_pair.cpp.

410 {
411  int l = length / 2;
412  VECTOR2I rv;
413 
414  if( dir.EuclideanNorm() == 0 )
415  return dir;
416 
417  do
418  {
419  rv = dir.Resize( l );
420  l++;
421  } while( ( rv * 2 ).EuclideanNorm() < length );
422 
423  return rv;
424 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:134
VECTOR2< T > Resize(T aNewLength) const
Function Resize returns a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:411
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:300

References EuclideanNorm(), VECTOR2< T >::EuclideanNorm(), and VECTOR2< T >::Resize().

Referenced by PNS::DP_GATEWAYS::buildDpContinuation(), PNS::DP_GATEWAYS::BuildForCursor(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), and PNS::DP_GATEWAYS::BuildGeneric().

◆ MoveDiagonal()

static void PNS::MoveDiagonal ( SEG aDiagonal,
const SHAPE_LINE_CHAIN aVertices,
int  aClearance 
)
static

Definition at line 157 of file pns_utils.cpp.

158 {
159  int dist;
160 
161  aVertices.NearestPoint( aDiagonal, dist );
162  dist -= HULL_MARGIN;
163  VECTOR2I moveBy = ( aDiagonal.A - aDiagonal.B ).Perpendicular().Resize( dist - aClearance );
164  aDiagonal.A += moveBy;
165  aDiagonal.B += moveBy;
166 }
constexpr int HULL_MARGIN
Definition: pns_utils.h:34
const VECTOR2I NearestPoint(const VECTOR2I &aP, bool aAllowInternalShapePoints=true) const
Finds a point on the line chain that is closest to point aP.
VECTOR2< T > Resize(T aNewLength) const
Function Resize returns a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:411
VECTOR2I A
Definition: seg.h:47
VECTOR2I B
Definition: seg.h:48

References SEG::A, SEG::B, HULL_MARGIN, SHAPE_LINE_CHAIN::NearestPoint(), and VECTOR2< T >::Resize().

Referenced by ConvexHull().

◆ OctagonalHull()

const SHAPE_LINE_CHAIN PNS::OctagonalHull ( const VECTOR2I aP0,
const VECTOR2I aSize,
int  aClearance,
int  aChamfer 
)

Definition at line 35 of file pns_utils.cpp.

37 {
39 
40  s.SetClosed( true );
41 
42  s.Append( aP0.x - aClearance, aP0.y - aClearance + aChamfer );
43  s.Append( aP0.x - aClearance + aChamfer, aP0.y - aClearance );
44  s.Append( aP0.x + aSize.x + aClearance - aChamfer, aP0.y - aClearance );
45  s.Append( aP0.x + aSize.x + aClearance, aP0.y - aClearance + aChamfer );
46  s.Append( aP0.x + aSize.x + aClearance, aP0.y + aSize.y + aClearance - aChamfer );
47  s.Append( aP0.x + aSize.x + aClearance - aChamfer, aP0.y + aSize.y + aClearance );
48  s.Append( aP0.x - aClearance + aChamfer, aP0.y + aSize.y + aClearance );
49  s.Append( aP0.x - aClearance, aP0.y + aSize.y + aClearance - aChamfer );
50 
51  return s;
52 }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
SHAPE_LINE_CHAIN.

References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::SetClosed(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by buildHullForPrimitiveShape(), PNS::VIA::Hull(), and SegmentHull().

◆ operator==()

bool PNS::operator== ( JOINT::HASH_TAG const &  aP1,
JOINT::HASH_TAG const &  aP2 
)
inline

Definition at line 266 of file pns_joint.h.

267 {
268  return aP1.pos == aP2.pos && aP1.net == aP2.net;
269 }

References PNS::JOINT::HASH_TAG::net, and PNS::JOINT::HASH_TAG::pos.

◆ pointInside2()

static bool PNS::pointInside2 ( const SHAPE_LINE_CHAIN aL,
const VECTOR2I aP 
)
static

Definition at line 273 of file pns_optimizer.cpp.

274 {
275  if( !aL.IsClosed() || aL.SegmentCount() < 3 )
276  return false;
277 
278  // returns 0 if false, +1 if true, -1 if pt ON polygon boundary
279  int result = 0;
280  size_t cnt = aL.PointCount();
281 
282  VECTOR2I ip = aL.CPoint( 0 );
283 
284  for( size_t i = 1; i <= cnt; ++i )
285  {
286  VECTOR2I ipNext = (i == cnt ? aL.CPoint( 0 ) : aL.CPoint( i ));
287 
288  if( ipNext.y == aP.y )
289  {
290  if( (ipNext.x ==aP.x) || ( ip.y == aP.y && ( (ipNext.x >aP.x) == (ip.x <aP.x) ) ) )
291  return -1;
292  }
293 
294  if( (ip.y <aP.y) != (ipNext.y <aP.y) )
295  {
296  if( ip.x >=aP.x )
297  {
298  if( ipNext.x >aP.x )
299  result = 1 - result;
300  else
301  {
302  double d = static_cast<double>( ip.x - aP.x ) *
303  static_cast<double>( ipNext.y - aP.y ) -
304  static_cast<double>( ipNext.x - aP.x ) *
305  static_cast<double>( ip.y - aP.y );
306 
307  if( !d )
308  return -1;
309 
310  if( (d > 0) == (ipNext.y > ip.y) )
311  result = 1 - result;
312  }
313  }
314  else
315  {
316  if( ipNext.x >aP.x )
317  {
318  double d = ((double)ip.x -aP.x) * ((double)ipNext.y -aP.y) -
319  ((double)ipNext.x -aP.x) * ((double)ip.y -aP.y);
320 
321  if( !d )
322  return -1;
323 
324  if( (d > 0) == (ipNext.y > ip.y) )
325  result = 1 - result;
326  }
327  }
328  }
329 
330  ip = ipNext;
331  }
332 
333  return result > 0;
334 }
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()
bool IsClosed() const override
Function IsClosed()
int SegmentCount() const
Function SegmentCount()

References SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::IsClosed(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::SegmentCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PNS::KEEP_TOPOLOGY_CONSTRAINT::Check().

◆ SegmentHull()

const SHAPE_LINE_CHAIN PNS::SegmentHull ( const SHAPE_SEGMENT aSeg,
int  aClearance,
int  aWalkaroundThickness 
)

Definition at line 112 of file pns_utils.cpp.

114 {
115  int cl = aClearance + aWalkaroundThickness / 2 + HULL_MARGIN;
116  int d = aSeg.GetWidth() / 2 + cl;
117  int x = (int)( 2.0 / ( 1.0 + M_SQRT2 ) * d );
118 
119  const VECTOR2I a = aSeg.GetSeg().A;
120  const VECTOR2I b = aSeg.GetSeg().B;
121 
122  if( a == b )
123  {
124  return OctagonalHull( a - VECTOR2I( aSeg.GetWidth() / 2, aSeg.GetWidth() / 2 ),
125  VECTOR2I( aSeg.GetWidth(), aSeg.GetWidth() ),
126  cl + 1,
127  0.52 * d );
128  }
129 
130  VECTOR2I dir = b - a;
131  VECTOR2I p0 = dir.Perpendicular().Resize( d );
132  VECTOR2I ds = dir.Perpendicular().Resize( x / 2 );
133  VECTOR2I pd = dir.Resize( x / 2 );
134  VECTOR2I dp = dir.Resize( d );
135 
137 
138  s.SetClosed( true );
139 
140  s.Append( b + p0 + pd );
141  s.Append( b + dp + ds );
142  s.Append( b + dp - ds );
143  s.Append( b - p0 + pd );
144  s.Append( a - p0 - pd );
145  s.Append( a - dp - ds );
146  s.Append( a - dp + ds );
147  s.Append( a + p0 - pd );
148 
149  // make sure the hull outline is always clockwise
150  if( s.CSegment( 0 ).Side( a ) < 0 )
151  return s.Reverse();
152  else
153  return s;
154 }
constexpr int HULL_MARGIN
Definition: pns_utils.h:34
VECTOR2< T > Perpendicular() const
Function Perpendicular computes the perpendicular vector.
Definition: vector2d.h:321
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
VECTOR2< int > VECTOR2I
Definition: vector2d.h:630
const SEG & GetSeg() const
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
void SetClosed(bool aClosed)
Function SetClosed()
const SHAPE_LINE_CHAIN OctagonalHull(const VECTOR2I &aP0, const VECTOR2I &aSize, int aClearance, int aChamfer)
Definition: pns_utils.cpp:35
VECTOR2< T > Resize(T aNewLength) const
Function Resize returns a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:411
const SEG CSegment(int aIndex) const
Function CSegment()
SHAPE_LINE_CHAIN.
VECTOR2I A
Definition: seg.h:47
int GetWidth() const
int Side(const VECTOR2I &aP) const
Function Side()
Definition: seg.h:145
VECTOR2I B
Definition: seg.h:48

References SEG::A, SHAPE_LINE_CHAIN::Append(), SEG::B, SHAPE_LINE_CHAIN::CSegment(), SHAPE_SEGMENT::GetSeg(), SHAPE_SEGMENT::GetWidth(), HULL_MARGIN, OctagonalHull(), VECTOR2< T >::Perpendicular(), VECTOR2< T >::Resize(), SHAPE_LINE_CHAIN::Reverse(), SHAPE_LINE_CHAIN::SetClosed(), and SEG::Side().

Referenced by buildHullForPrimitiveShape(), and PNS::SEGMENT::Hull().

◆ shovedArea()

static int64_t PNS::shovedArea ( const SHAPE_LINE_CHAIN aOld,
const SHAPE_LINE_CHAIN aNew 
)
static

Definition at line 1302 of file pns_optimizer.cpp.

1303 {
1304  int64_t area = 0;
1305  const int oc = aOld.PointCount();
1306  const int nc = aNew.PointCount();
1307  const int total = oc + nc;
1308 
1309  for(int i = 0; i < total; i++)
1310  {
1311  int i_next = (i + 1 == total ? 0 : i + 1);
1312 
1313  const VECTOR2I &v0 = i < oc ? aOld.CPoint(i)
1314  : aNew.CPoint( nc - 1 - (i - oc) );
1315  const VECTOR2I &v1 = i_next < oc ? aOld.CPoint ( i_next )
1316  : aNew.CPoint( nc - 1 - (i_next - oc) );
1317  area += -(int64_t) v0.y * v1.x + (int64_t) v0.x * v1.y;
1318  }
1319 
1320  return std::abs(area / 2);
1321 }
int PointCount() const
Function PointCount()
const VECTOR2I & CPoint(int aIndex) const
Function Point()

References SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::PointCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Tighten().

◆ Tighten()

void PNS::Tighten ( NODE aNode,
const SHAPE_LINE_CHAIN aOldLine,
const LINE aNewLine,
LINE aOptimized 
)

Definition at line 1425 of file pns_optimizer.cpp.

1426 {
1427  LINE tmp;
1428 
1429  if( aNewLine.SegmentCount() < 3 )
1430  return;
1431 
1432  SHAPE_LINE_CHAIN current ( aNewLine.CLine() );
1433 
1434  for( int step = 0; step < 3; step++)
1435  {
1436  current.Simplify();
1437 
1438  for( int i = 0; i <= current.SegmentCount() - 3; i++)
1439  {
1440  SHAPE_LINE_CHAIN l_in, l_out;
1441 
1442  l_in = current.Slice(i, i+3);
1443 
1444  for( int dir = 0; dir < 1; dir++)
1445  {
1446  if( tightenSegment( dir ? true : false, aNode, aNewLine, l_in, l_out ) )
1447  {
1448  SHAPE_LINE_CHAIN opt = current;
1449  opt.Replace(i, i + 3, l_out);
1450  auto optArea = std::abs(shovedArea( aOldLine, opt ));
1451  auto prevArea = std::abs(shovedArea( aOldLine, current ));
1452 
1453  if( optArea < prevArea )
1454  current = opt;
1455 
1456  break;
1457  }
1458  }
1459  }
1460  }
1461 
1462  aOptimized = LINE(aNewLine, current);
1463 
1464  //auto dbg = ROUTER::GetInstance()->GetInterface()->GetDebugDecorator();
1465  //dbg->AddLine ( current, 4, 100000 );
1466 }
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Function Simplify()
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
static int64_t shovedArea(const SHAPE_LINE_CHAIN &aOld, const SHAPE_LINE_CHAIN &aNew)
bool tightenSegment(bool dir, NODE *aNode, const LINE &cur, const SHAPE_LINE_CHAIN &in, SHAPE_LINE_CHAIN &out)
SHAPE_LINE_CHAIN.
void Replace(int aStartIndex, int aEndIndex, const VECTOR2I &aP)
Function Replace()

References PNS::LINE::CLine(), SHAPE_LINE_CHAIN::Replace(), PNS::LINE::SegmentCount(), shovedArea(), SHAPE_LINE_CHAIN::Simplify(), SHAPE_LINE_CHAIN::Slice(), and tightenSegment().

◆ tightenSegment()

bool PNS::tightenSegment ( bool  dir,
NODE aNode,
const LINE cur,
const SHAPE_LINE_CHAIN in,
SHAPE_LINE_CHAIN out 
)

Definition at line 1323 of file pns_optimizer.cpp.

1325 {
1326  SEG a = in.CSegment(0);
1327  SEG center = in.CSegment(1);
1328  SEG b = in.CSegment(2);
1329 
1330  DIRECTION_45 dirA ( a );
1331  DIRECTION_45 dirCenter ( center );
1332  DIRECTION_45 dirB ( b );
1333 
1334  if (!dirA.IsObtuse( dirCenter) || !dirCenter.IsObtuse(dirB))
1335  return false;
1336 
1337  //VECTOR2I perp = (center.B - center.A).Perpendicular();
1338  VECTOR2I guideA, guideB ;
1339 
1340  SEG guide;
1341  int initial;
1342 
1343  //auto dbg = ROUTER::GetInstance()->GetInterface()->GetDebugDecorator();
1344  if ( dirA.Angle ( dirB ) != DIRECTION_45::ANG_RIGHT )
1345  return false;
1346 
1347  {
1348  /*
1349  auto rC = *a.IntersectLines( b );
1350  dbg->AddSegment ( SEG( center.A, rC ), 1 );
1351  dbg->AddSegment ( SEG( center.B, rC ), 2 );
1352  auto perp = dirCenter.Left().Left();
1353 
1354  SEG sperp ( center.A, center.A + perp.ToVector() );
1355 
1356  auto vpc = sperp.LineProject( rC );
1357  auto vpa = sperp.LineProject( a.A );
1358  auto vpb = sperp.LineProject( b.B );
1359 
1360  auto da = (vpc - vpa).EuclideanNorm();
1361  auto db = (vpc - vpb).EuclideanNorm();
1362 
1363  auto vp = (da < db) ? vpa : vpb;
1364  dbg->AddSegment ( SEG( vpc, vp ), 5 );
1365 
1366 
1367  guide = SEG ( vpc, vp );
1368  */
1369  }
1370 
1371  int da = a.Length();
1372  int db = b.Length();
1373 
1374  if( da < db )
1375  guide = a;
1376  else
1377  guide = b;
1378 
1379 
1380  initial = guide.Length();
1381 
1382  int step = initial;
1383  int current = step;
1384  SHAPE_LINE_CHAIN snew;
1385 
1386  while( step > 1 )
1387  {
1388  LINE l( cur );
1389 
1390  snew.Clear();
1391  snew.Append( a.A );
1392  snew.Append( a.B + (a.A - a.B).Resize( current ) );
1393  snew.Append( b.A + (b.B - b.A).Resize( current ) );
1394  snew.Append( b.B );
1395 
1396  step /= 2;
1397 
1398  l.SetShape(snew);
1399 
1400  if( aNode->CheckColliding(&l) )
1401  current -= step;
1402  else if ( current + step >= initial )
1403  current = initial;
1404  else
1405  current += step;
1406 
1407 
1408  //dbg->AddSegment ( SEG( center.A , a.LineProject( center.A + gr ) ), 3 );
1409  //dbg->AddSegment ( SEG( center.A , center.A + guideA ), 3 );
1410  //dbg->AddSegment ( SEG( center.B , center.B + guideB ), 4 );
1411 
1412 
1413  if ( current == initial )
1414  break;
1415 
1416 
1417  }
1418  out = snew;
1419 
1420  //dbg->AddLine ( snew, 3, 100000 );
1421 
1422  return true;
1423 }
int Length() const
Function Length()
Definition: seg.h:327
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
DIRECTION_45.
Definition: direction45.h:37
Definition: seg.h:39
VECTOR2< T > Resize(T aNewLength) const
Function Resize returns a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:411
const SEG CSegment(int aIndex) const
Function CSegment()
SHAPE_LINE_CHAIN.
VECTOR2I A
Definition: seg.h:47
void Clear()
Function Clear() Removes all points from the line chain.
VECTOR2I B
Definition: seg.h:48

References SEG::A, DIRECTION_45::ANG_RIGHT, DIRECTION_45::Angle(), SHAPE_LINE_CHAIN::Append(), SEG::B, PNS::NODE::CheckColliding(), SHAPE_LINE_CHAIN::Clear(), SHAPE_LINE_CHAIN::CSegment(), DIRECTION_45::IsObtuse(), SEG::Length(), VECTOR2< T >::Resize(), and PNS::LINE::SetShape().

Referenced by Tighten().

◆ verifyDpBypass()

bool PNS::verifyDpBypass ( NODE aNode,
DIFF_PAIR aPair,
bool  aRefIsP,
const SHAPE_LINE_CHAIN aNewRef,
const SHAPE_LINE_CHAIN aNewCoupled 
)

Definition at line 1109 of file pns_optimizer.cpp.

1111 {
1112  LINE refLine ( aRefIsP ? aPair->PLine() : aPair->NLine(), aNewRef );
1113  LINE coupledLine ( aRefIsP ? aPair->NLine() : aPair->PLine(), aNewCoupled );
1114 
1115  if( refLine.Collide( &coupledLine, aNode ) )
1116  return false;
1117 
1118  if( aNode->CheckColliding ( &refLine ) )
1119  return false;
1120 
1121  if( aNode->CheckColliding ( &coupledLine ) )
1122  return false;
1123 
1124  return true;
1125 }

References PNS::NODE::CheckColliding(), PNS::DIFF_PAIR::NLine(), and PNS::DIFF_PAIR::PLine().

Referenced by coupledBypass(), and PNS::OPTIMIZER::mergeDpStep().

Variable Documentation

◆ g_dbg

DEBUG_DECORATOR* PNS::g_dbg
static

Definition at line 44 of file pns_optimizer.cpp.

Referenced by PNS::OPTIMIZER::Optimize().

◆ HULL_MARGIN

constexpr int PNS::HULL_MARGIN = 10

Definition at line 34 of file pns_utils.h.

Referenced by ArcHull(), ConvexHull(), MoveDiagonal(), and SegmentHull().

◆ pnsSchemaVersion

const int PNS::pnsSchemaVersion = 0

Definition at line 29 of file pns_routing_settings.cpp.

◆ theRouter