KiCad PCB EDA Suite
PNS::LINE Class Reference

#include <pns_line.h>

Inheritance diagram for PNS::LINE:
PNS::ITEM

Public Types

typedef std::vector< SEGMENT * > SEGMENT_REFS
 
enum  PnsKind {
  SOLID_T = 1, LINE_T = 2, JOINT_T = 4, SEGMENT_T = 8,
  VIA_T = 16, DIFF_PAIR_T = 32, ANY_T = 0xff
}
 

Supported item types

More...
 

Public Member Functions

 LINE ()
 Constructor Makes an empty line. More...
 
 LINE (const LINE &aOther)
 
 LINE (const LINE &aBase, const SHAPE_LINE_CHAIN &aLine)
 Constructor Copies properties (net, layers, etc.) from a base line and replaces the shape by another. More...
 
 LINE (const VIA &aVia)
 Constructor Constructs a LINE for a lone VIA (ie a stitching via). More...
 
 ~LINE ()
 
virtual LINEClone () const override
 Function Clone() More...
 
LINEoperator= (const LINE &aOther)
 
void SetShape (const SHAPE_LINE_CHAIN &aLine)
 

Assigns a shape to the line (a polyline/line chain)

More...
 
const SHAPEShape () const override
 

Returns the shape of the line

More...
 
SHAPE_LINE_CHAINLine ()
 

Modifiable accessor to the underlying shape

More...
 
const SHAPE_LINE_CHAINCLine () const
 

Const accessor to the underlying shape

More...
 
int SegmentCount () const
 

Returns the number of segments in the line

More...
 
int PointCount () const
 

Returns the number of points in the line

More...
 
const VECTOR2ICPoint (int aIdx) const
 

Returns the aIdx-th point of the line

More...
 
const SEG CSegment (int aIdx) const
 

Returns the aIdx-th segment of the line

More...
 
void SetWidth (int aWidth)
 

Sets line width

More...
 
int Width () const
 

Returns line width

More...
 
bool CompareGeometry (const LINE &aOther)
 

Returns true if the line is geometrically identical as line aOther

More...
 
void Reverse ()
 

Reverses the point/vertex order

More...
 
void LinkSegment (SEGMENT *aSeg)
 

Adds a reference to a segment registered in a NODE that is a part of this line.

More...
 
SEGMENT_REFSLinkedSegments ()
 

Returns the list of segments from the owning node that constitute this line (or NULL if the line is not linked)

More...
 
bool IsLinked () const
 
bool IsLinkedChecked () const
 
bool ContainsSegment (SEGMENT *aSeg) const
 

Checks if the segment aSeg is a part of the line.

More...
 
SEGMENTGetLink (int aIndex) const
 
void ClearSegmentLinks ()
 

Erases the linking information. Used to detach the line from the owning node.

More...
 
int LinkCount () const
 

Returns the number of segments that were assembled together to form this line.

More...
 
const LINE ClipToNearestObstacle (NODE *aNode) const
 

Clips the line to the nearest obstacle, traversing from the line's start vertex (0).

More...
 
void ClipVertexRange (int aStart, int aEnd)
 

Clips the line to a given range of vertices.

More...
 
int CountCorners (int aAngles) const
 

Returns the number of corners of angles specified by mask aAngles.

More...
 
bool Walkaround (SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aWalk, SHAPE_LINE_CHAIN &aPost, bool aCw) const
 

Calculates a line thightly wrapping a convex hull of an obstacle object (aObstacle).

More...
 
bool Walkaround (const SHAPE_LINE_CHAIN &aObstacle, SHAPE_LINE_CHAIN &aPath, bool aCw) const
 
bool Is45Degree () const
 
void ShowLinks () const
 

Prints out all linked segments

More...
 
bool EndsWithVia () const
 
void AppendVia (const VIA &aVia)
 
void RemoveVia ()
 
const VIAVia () const
 
virtual void Mark (int aMarker) override
 
virtual void Unmark (int aMarker=-1) override
 
virtual int Marker () const override
 
void DragSegment (const VECTOR2I &aP, int aIndex, int aSnappingThreshold=0, bool aFreeAngle=false)
 
void DragCorner (const VECTOR2I &aP, int aIndex, int aSnappingThreshold=0, bool aFreeAngle=false)
 
void SetRank (int aRank) override
 
int Rank () const override
 
bool HasLoops () const
 
bool HasLockedSegments () const
 
OPT_BOX2I ChangedArea (const LINE *aOther) const
 
virtual const SHAPE_LINE_CHAIN Hull (int aClearance=0, int aWalkaroundThickness=0) const
 
PnsKind Kind () const
 Function Kind() More...
 
bool OfKind (int aKindMask) const
 Function OfKind() More...
 
std::string KindStr () const
 Function KindStr() More...
 
void SetParent (BOARD_CONNECTED_ITEM *aParent)
 
BOARD_CONNECTED_ITEMParent () const
 
void SetNet (int aNet)
 
int Net () const
 
const LAYER_RANGELayers () const
 
void SetLayers (const LAYER_RANGE &aLayers)
 
void SetLayer (int aLayer)
 
virtual int Layer () const
 
bool LayersOverlap (const ITEM *aOther) const
 Function LayersOverlap() More...
 
NODEOwner () const
 Function Owner() More...
 
void SetOwner (NODE *aOwner)
 Functon SetOwner() More...
 
bool BelongsTo (NODE *aNode) const
 Function BelongsTo() More...
 
virtual bool Collide (const ITEM *aOther, int aClearance, bool aNeedMTV, VECTOR2I *aMTV, const NODE *aParentNode, bool aDifferentNetsOnly=true) const
 Function Collide() More...
 
virtual VECTOR2I Anchor (int n) const
 
virtual int AnchorCount () const
 
bool IsLocked () const
 
void SetRoutable (bool aRoutable)
 
bool IsRoutable () const
 

Static Public Member Functions

static bool ClassOf (const ITEM *aItem)
 

Static Public Attributes

static const int UnusedNet = INT_MAX
 

Protected Attributes

PnsKind m_kind
 
BOARD_CONNECTED_ITEMm_parent
 
NODEm_owner
 
LAYER_RANGE m_layers
 
bool m_movable
 
int m_net
 
int m_marker
 
int m_rank
 
bool m_routable
 

Private Member Functions

void dragSegment45 (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
void dragCorner45 (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
void dragSegmentFree (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
void dragCornerFree (const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
 
VECTOR2I snapToNeighbourSegments (const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
 
VECTOR2I snapDraggedCorner (const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
 
void copyLinks (const LINE *aParent)
 

Copies m_segmentRefs from the line aParent.

More...
 

Private Attributes

SEGMENT_REFS m_segmentRefs
 

List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is not a part of any node.

More...
 
SHAPE_LINE_CHAIN m_line
 

The actual shape of the line

More...
 
int m_width
 

our width

More...
 
bool m_hasVia
 

If true, the line ends with a via

More...
 
VIA m_via
 

Via at the end point, if m_hasVia == true

More...
 

Detailed Description

Definition at line 60 of file pns_line.h.

Member Typedef Documentation

◆ SEGMENT_REFS

typedef std::vector<SEGMENT*> PNS::LINE::SEGMENT_REFS

Definition at line 63 of file pns_line.h.

Member Enumeration Documentation

◆ PnsKind

enum PNS::ITEM::PnsKind
inherited

Supported item types

Enumerator
SOLID_T 
LINE_T 
JOINT_T 
SEGMENT_T 
VIA_T 
DIFF_PAIR_T 
ANY_T 

Definition at line 59 of file pns_item.h.

60  {
61  SOLID_T = 1,
62  LINE_T = 2,
63  JOINT_T = 4,
64  SEGMENT_T = 8,
65  VIA_T = 16,
66  DIFF_PAIR_T = 32,
67  ANY_T = 0xff
68  };

Constructor & Destructor Documentation

◆ LINE() [1/4]

PNS::LINE::LINE ( )
inline

Constructor Makes an empty line.

Definition at line 69 of file pns_line.h.

69  : ITEM( LINE_T )
70  {
71  m_hasVia = false;
72  m_width = 1; // Dummy value
73  }
ITEM(PnsKind aKind)
Definition: pns_item.h:70
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:313
int m_width
our width
Definition: pns_line.h:310

References m_hasVia, and m_width.

Referenced by Clone().

◆ LINE() [2/4]

PNS::LINE::LINE ( const LINE aOther)

Definition at line 36 of file pns_line.cpp.

36  :
37  ITEM( aOther ),
38  m_line( aOther.m_line ),
39  m_width( aOther.m_width )
40 {
41  m_net = aOther.m_net;
42  m_movable = aOther.m_movable;
43  m_layers = aOther.m_layers;
44  m_via = aOther.m_via;
45  m_hasVia = aOther.m_hasVia;
46  m_marker = aOther.m_marker;
47  m_rank = aOther.m_rank;
48 
49  copyLinks( &aOther );
50 }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:316
LAYER_RANGE m_layers
Definition: pns_item.h:252
int m_rank
Definition: pns_item.h:257
bool m_movable
Definition: pns_item.h:254
ITEM(PnsKind aKind)
Definition: pns_item.h:70
int m_marker
Definition: pns_item.h:256
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
void copyLinks(const LINE *aParent)
Copies m_segmentRefs from the line aParent.
Definition: pns_line.cpp:117
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:313
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:310

References copyLinks(), m_hasVia, PNS::ITEM::m_layers, PNS::ITEM::m_marker, PNS::ITEM::m_movable, PNS::ITEM::m_net, PNS::ITEM::m_rank, and m_via.

◆ LINE() [3/4]

PNS::LINE::LINE ( const LINE aBase,
const SHAPE_LINE_CHAIN aLine 
)
inline

Constructor Copies properties (net, layers, etc.) from a base line and replaces the shape by another.

Definition at line 82 of file pns_line.h.

82  :
83  ITEM( aBase ),
84  m_line( aLine ),
85  m_width( aBase.m_width )
86  {
87  m_net = aBase.m_net;
88  m_layers = aBase.m_layers;
89  m_hasVia = false;
90  }
LAYER_RANGE m_layers
Definition: pns_item.h:252
ITEM(PnsKind aKind)
Definition: pns_item.h:70
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:313
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:310

References m_hasVia, PNS::ITEM::m_layers, and PNS::ITEM::m_net.

◆ LINE() [4/4]

PNS::LINE::LINE ( const VIA aVia)
inline

Constructor Constructs a LINE for a lone VIA (ie a stitching via).

Parameters
aVia

Definition at line 97 of file pns_line.h.

97  :
98  ITEM( LINE_T )
99  {
100  m_hasVia = true;
101  m_via = aVia;
102  m_width = aVia.Diameter();
103  m_net = aVia.Net();
104  m_layers = aVia.Layers();
105  m_rank = aVia.Rank();
106  }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:316
LAYER_RANGE m_layers
Definition: pns_item.h:252
int m_rank
Definition: pns_item.h:257
ITEM(PnsKind aKind)
Definition: pns_item.h:70
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:313
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:310

References PNS::VIA::Diameter(), PNS::ITEM::Layers(), m_hasVia, PNS::ITEM::m_layers, PNS::ITEM::m_net, PNS::ITEM::m_rank, m_via, m_width, PNS::ITEM::Net(), and PNS::ITEM::Rank().

◆ ~LINE()

PNS::LINE::~LINE ( )

Definition at line 53 of file pns_line.cpp.

54 {
55 }

Member Function Documentation

◆ Anchor()

virtual VECTOR2I PNS::ITEM::Anchor ( int  n) const
inlinevirtualinherited

Reimplemented in PNS::VIA, PNS::SEGMENT, and PNS::SOLID.

Definition at line 225 of file pns_item.h.

226  {
227  return VECTOR2I();
228  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587

Referenced by PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), PNS::DP_PRIMITIVE_PAIR::DP_PRIMITIVE_PAIR(), and PNS::DIFF_PAIR_PLACER::getDanglingAnchor().

◆ AnchorCount()

virtual int PNS::ITEM::AnchorCount ( ) const
inlinevirtualinherited

Reimplemented in PNS::VIA, PNS::SEGMENT, and PNS::SOLID.

Definition at line 230 of file pns_item.h.

231  {
232  return 0;
233  }

◆ AppendVia()

void PNS::LINE::AppendVia ( const VIA aVia)

Definition at line 777 of file pns_line.cpp.

778 {
779  if( m_line.PointCount() > 1 && aVia.Pos() == m_line.CPoint( 0 ) )
780  {
781  Reverse();
782  }
783 
784  m_hasVia = true;
785  m_via = aVia;
786  m_via.SetNet( m_net );
787 }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:316
int PointCount() const
Function PointCount()
void SetNet(int aNet)
Definition: pns_item.h:147
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
void Reverse()
Reverses the point/vertex order
Definition: pns_line.cpp:769
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:313
int m_net
Definition: pns_item.h:255

References SHAPE_LINE_CHAIN::CPoint(), m_hasVia, m_line, PNS::ITEM::m_net, m_via, SHAPE_LINE_CHAIN::PointCount(), PNS::VIA::Pos(), Reverse(), and PNS::ITEM::SetNet().

Referenced by PNS::LINE_PLACER::buildInitialLine(), PNS::SHOVE::onReverseCollidingVia(), PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkOnly(), and PNS::DIFF_PAIR::updateLine().

◆ BelongsTo()

bool PNS::ITEM::BelongsTo ( NODE aNode) const
inlineinherited

Function BelongsTo()

Returns
true if the item is owned by the node aNode.

Definition at line 186 of file pns_item.h.

187  {
188  return m_owner == aNode;
189  }
NODE * m_owner
Definition: pns_item.h:251

References PNS::ITEM::m_owner.

Referenced by PNS::NODE::doRemove().

◆ ChangedArea()

OPT_BOX2I PNS::LINE::ChangedArea ( const LINE aOther) const

Definition at line 874 of file pns_line.cpp.

875 {
876  BOX2I area;
877  bool areaDefined = false;
878 
879  int i_start = -1;
880  int i_end_self = -1, i_end_other = -1;
881 
882  SHAPE_LINE_CHAIN self( m_line );
883  self.Simplify();
884  SHAPE_LINE_CHAIN other( aOther->m_line );
885  other.Simplify();
886 
887  int np_self = self.PointCount();
888  int np_other = other.PointCount();
889 
890  int n = std::min( np_self, np_other );
891 
892  for( int i = 0; i < n; i++ )
893  {
894  const VECTOR2I p1 = self.CPoint( i );
895  const VECTOR2I p2 = other.CPoint( i );
896 
897  if( p1 != p2 )
898  {
899  if( i != n - 1 )
900  {
901  SEG s = self.CSegment( i );
902 
903  if( !s.Contains( p2 ) )
904  {
905  i_start = i;
906  break;
907  }
908  }
909  else
910  {
911  i_start = i;
912  break;
913  }
914  }
915  }
916 
917  for( int i = 0; i < n; i++ )
918  {
919  const VECTOR2I p1 = self.CPoint( np_self - 1 - i );
920  const VECTOR2I p2 = other.CPoint( np_other - 1 - i );
921 
922  if( p1 != p2 )
923  {
924  i_end_self = np_self - 1 - i;
925  i_end_other = np_other - 1 - i;
926  break;
927  }
928  }
929 
930  if( i_start < 0 )
931  i_start = n;
932 
933  if( i_end_self < 0 )
934  i_end_self = np_self - 1;
935 
936  if( i_end_other < 0 )
937  i_end_other = np_other - 1;
938 
939  for( int i = i_start; i <= i_end_self; i++ )
940  extendBox( area, areaDefined, self.CPoint( i ) );
941 
942  for( int i = i_start; i <= i_end_other; i++ )
943  extendBox( area, areaDefined, other.CPoint( i ) );
944 
945  if( areaDefined )
946  {
947  area.Inflate( std::max( Width(), aOther->Width() ) );
948  return area;
949  }
950 
951  return OPT_BOX2I();
952 }
const VECTOR2I & CPoint(int aIdx) const
Returns the aIdx-th point of the line
Definition: pns_line.h:157
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
bool Contains(const VECTOR2I &aP) const
Definition: seg.cpp:188
Definition: seg.h:36
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:300
#define max(a, b)
Definition: auxiliary.h:86
Class SHAPE_LINE_CHAIN.
static void extendBox(BOX2I &aBox, bool &aDefined, const VECTOR2I &aP)
Definition: pns_line.cpp:860
size_t i
Definition: json11.cpp:597
int Width() const
Returns line width
Definition: pns_line.h:175
OPT< BOX2I > OPT_BOX2I
Definition: box2.h:523
#define min(a, b)
Definition: auxiliary.h:85

References SEG::Contains(), CPoint(), SHAPE_LINE_CHAIN::CPoint(), PNS::extendBox(), i, BOX2< Vec >::Inflate(), m_line, max, min, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::Simplify(), and Width().

Referenced by PNS::ChangedArea().

◆ ClassOf()

static bool PNS::LINE::ClassOf ( const ITEM aItem)
inlinestatic

Definition at line 110 of file pns_line.h.

111  {
112  return aItem && LINE_T == aItem->Kind();
113  }

References PNS::ITEM::Kind(), and PNS::ITEM::LINE_T.

◆ ClearSegmentLinks()

void PNS::LINE::ClearSegmentLinks ( )

Erases the linking information. Used to detach the line from the owning node.

Definition at line 854 of file pns_line.cpp.

855 {
856  m_segmentRefs.clear();
857 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

Referenced by PNS::DRAGGER::dragMarkObstacles(), PNS::DRAGGER::dragShove(), PNS::DRAGGER::dumbDragVia(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onReverseCollidingVia(), PNS::SHOVE::ProcessSingleLine(), PNS::NODE::Remove(), PNS::SHOVE::ShoveLines(), and PNS::SHOVE::ShoveMultiLines().

◆ CLine()

◆ ClipToNearestObstacle()

const LINE PNS::LINE::ClipToNearestObstacle ( NODE aNode) const

Clips the line to the nearest obstacle, traversing from the line's start vertex (0).

Returns the clipped line.

Definition at line 328 of file pns_line.cpp.

329 {
330  const int IterationLimit = 5;
331  int i;
332  LINE l( *this );
333 
334  for( i = 0; i < IterationLimit; i++ )
335  {
336  NODE::OPT_OBSTACLE obs = aNode->NearestObstacle( &l );
337 
338  if( obs )
339  {
340  l.RemoveVia();
341  int p = l.Line().Split( obs->m_ipFirst );
342  l.Line().Remove( p + 1, -1 );
343  } else
344  break;
345  }
346 
347  if( i == IterationLimit )
348  l.Line().Clear();
349 
350  return l;
351 }
LINE()
Constructor Makes an empty line.
Definition: pns_line.h:69
size_t i
Definition: json11.cpp:597
OPT< OBSTACLE > OPT_OBSTACLE
Definition: pns_node.h:143

References SHAPE_LINE_CHAIN::Clear(), i, Line(), PNS::NODE::NearestObstacle(), SHAPE_LINE_CHAIN::Remove(), RemoveVia(), and SHAPE_LINE_CHAIN::Split().

Referenced by PNS::LINE_PLACER::rhShoveOnly(), PNS::LINE_PLACER::rhWalkOnly(), and PNS::WALKAROUND::singleStep().

◆ ClipVertexRange()

void PNS::LINE::ClipVertexRange ( int  aStart,
int  aEnd 
)

Clips the line to a given range of vertices.

Definition at line 819 of file pns_line.cpp.

820 {
821  m_line = m_line.Slice( aStart, aEnd );
822 
823  if( IsLinked() ) {
824  assert( m_segmentRefs.size() < INT_MAX );
825  assert( (int) m_segmentRefs.size() >= (aEnd - aStart) );
826 
827  // Note: The range includes aEnd, but we have n-1 segments.
828  std::rotate(
829  m_segmentRefs.begin(),
830  m_segmentRefs.begin() + aStart,
831  m_segmentRefs.begin() + aEnd
832  );
833 
834  m_segmentRefs.resize( aEnd - aStart );
835  }
836 }
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304
bool IsLinked() const
Definition: pns_line.h:202

References IsLinked(), m_line, m_segmentRefs, and SHAPE_LINE_CHAIN::Slice().

Referenced by PNS::NODE::FindLinesBetweenJoints().

◆ Clone()

LINE * PNS::LINE::Clone ( ) const
overridevirtual

Function Clone()

Returns a deep copy of the item

Implements PNS::ITEM.

Definition at line 77 of file pns_line.cpp.

78 {
79  LINE* l = new LINE( *this );
80 
81  return l;
82 }
LINE()
Constructor Makes an empty line.
Definition: pns_line.h:69

References LINE().

Referenced by PNS::ITEM_SET::Add(), and PNS::ITEM_SET::Prepend().

◆ Collide()

bool PNS::ITEM::Collide ( const ITEM aOther,
int  aClearance,
bool  aNeedMTV,
VECTOR2I aMTV,
const NODE aParentNode,
bool  aDifferentNetsOnly = true 
) const
virtualinherited

Function Collide()

Checks for a collision (clearance violation) with between us and item aOther. Collision checking takes all PCB stuff into accound (layers, nets, DRC rules). Optionally returns a minimum translation vector for force propagation algorithm.

Parameters
aOtheritem to check collision against
aClearancedesired clearance
aNeedMTVwhen true, the minimum translation vector is calculated
aMTVthe minimum translation vector
Returns
true, if a collision was found.

Definition at line 48 of file pns_item.cpp.

50 {
51  if( collideSimple( aOther, aClearance, aNeedMTV, aMTV, aParentNode, aDifferentNetsOnly ) )
52  return true;
53 
54  // special case for "head" line with a via attached at the end.
55  if( aOther->m_kind == LINE_T )
56  {
57  const LINE* line = static_cast<const LINE*>( aOther );
58  int clearance = aClearance - line->Width() / 2;
59 
60  if( line->EndsWithVia() )
61  {
62  return collideSimple( &line->Via(), clearance, aNeedMTV, aMTV, aParentNode,
63  aDifferentNetsOnly );
64  }
65  }
66 
67  return false;
68 }
bool collideSimple(const ITEM *aOther, int aClearance, bool aNeedMTV, VECTOR2I *aMTV, const NODE *aParentNode, bool aDifferentNetsOnly) const
Definition: pns_item.cpp:30

References PNS::ITEM::collideSimple(), EndsWithVia(), PNS::ITEM::LINE_T, PNS::ITEM::m_kind, Via(), and Width().

Referenced by PNS::NODE::CheckColliding(), PNS::OPTIMIZER::CACHE_VISITOR::operator()(), and PNS::NODE::DEFAULT_OBSTACLE_VISITOR::operator()().

◆ CompareGeometry()

bool PNS::LINE::CompareGeometry ( const LINE aOther)

Returns true if the line is geometrically identical as line aOther

Definition at line 763 of file pns_line.cpp.

764 {
765  return m_line.CompareGeometry( aOther.m_line );
766 }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
bool CompareGeometry(const SHAPE_LINE_CHAIN &aOther) const

References SHAPE_LINE_CHAIN::CompareGeometry(), and m_line.

◆ ContainsSegment()

bool PNS::LINE::ContainsSegment ( SEGMENT aSeg) const
inline

Checks if the segment aSeg is a part of the line.

Definition at line 213 of file pns_line.h.

214  {
215  return std::find( m_segmentRefs.begin(), m_segmentRefs.end(),
216  aSeg ) != m_segmentRefs.end();
217  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

◆ copyLinks()

void PNS::LINE::copyLinks ( const LINE aParent)
private

Copies m_segmentRefs from the line aParent.

Definition at line 117 of file pns_line.cpp.

118 {
119  m_segmentRefs = aParent->m_segmentRefs;
120 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

Referenced by LINE(), and operator=().

◆ CountCorners()

int PNS::LINE::CountCorners ( int  aAngles) const

Returns the number of corners of angles specified by mask aAngles.

Definition at line 137 of file pns_line.cpp.

138 {
139  int count = 0;
140 
141  for( int i = 0; i < m_line.SegmentCount() - 1; i++ )
142  {
143  const SEG seg1 = m_line.CSegment( i );
144  const SEG seg2 = m_line.CSegment( i + 1 );
145 
146  const DIRECTION_45 dir1( seg1 );
147  const DIRECTION_45 dir2( seg2 );
148 
149  DIRECTION_45::AngleType a = dir1.Angle( dir2 );
150 
151  if( a & aAngles )
152  count++;
153  }
154 
155  return count;
156 }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
Class DIRECTION_45.
Definition: direction45.h:36
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:36
AngleType
Enum AngleType Represents kind of angle formed by vectors heading in two DIRECTION_45s.
Definition: direction45.h:62
const SEG CSegment(int aIndex) const
Function CSegment()
size_t i
Definition: json11.cpp:597

References DIRECTION_45::Angle(), SHAPE_LINE_CHAIN::CSegment(), i, m_line, and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by PNS::LINE_PLACER::mergeHead(), and PNS::OPTIMIZER::smartPadsSingle().

◆ CPoint()

◆ CSegment()

const SEG PNS::LINE::CSegment ( int  aIdx) const
inline

Returns the aIdx-th segment of the line

Definition at line 163 of file pns_line.h.

164  {
165  return m_line.CSegment( aIdx );
166  }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
const SEG CSegment(int aIndex) const
Function CSegment()

References SHAPE_LINE_CHAIN::CSegment(), and m_line.

Referenced by PNS::SHOVE::checkBumpDirection(), PNS::DIFF_PAIR::EndingPrimitives(), PNS::LINE_PLACER::FixRoute(), PNS::OPTIMIZER::mergeStep(), PNS::LINE_PLACER::optimizeTailHeadTransition(), and PNS::SHOVE::ProcessSingleLine().

◆ DragCorner()

void PNS::LINE::DragCorner ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold = 0,
bool  aFreeAngle = false 
)

Definition at line 476 of file pns_line.cpp.

477 {
478  if( aFreeAngle )
479  {
480  dragCornerFree ( aP, aIndex, aSnappingThreshold );
481  }
482  else
483  {
484  dragCorner45 ( aP, aIndex, aSnappingThreshold );
485  }
486 }
void dragCorner45(const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
Definition: pns_line.cpp:446
void dragCornerFree(const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
Definition: pns_line.cpp:470

References dragCorner45(), and dragCornerFree().

Referenced by PNS::DRAGGER::dragMarkObstacles(), PNS::DRAGGER::dragShove(), and PNS::DRAGGER::dumbDragVia().

◆ dragCorner45()

void PNS::LINE::dragCorner45 ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

Definition at line 446 of file pns_line.cpp.

447 {
448  SHAPE_LINE_CHAIN path;
449 
450  VECTOR2I snapped = snapDraggedCorner( m_line, aP, aIndex, aSnappingThreshold );
451 
452  if( aIndex == 0 )
453  path = dragCornerInternal( m_line.Reverse(), snapped ).Reverse();
454  else if( aIndex == m_line.SegmentCount() )
455  path = dragCornerInternal( m_line, snapped );
456  else
457  {
458  // fixme: awkward behaviour for "outwards" drags
459  path = dragCornerInternal( m_line.Slice( 0, aIndex ), snapped );
460  SHAPE_LINE_CHAIN path_rev = dragCornerInternal( m_line.Slice( aIndex, -1 ).Reverse(),
461  snapped ).Reverse();
462  path.Append( path_rev );
463  }
464 
465  path.Simplify();
466  m_line = path;
467 }
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN dragCornerInternal(const SHAPE_LINE_CHAIN &aOrigin, const VECTOR2I &aP)
Definition: pns_line.cpp:369
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
void Reverse()
Reverses the point/vertex order
Definition: pns_line.cpp:769
int SegmentCount() const
Function SegmentCount()
Class SHAPE_LINE_CHAIN.
VECTOR2I snapDraggedCorner(const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
Definition: pns_line.cpp:501

References SHAPE_LINE_CHAIN::Append(), PNS::dragCornerInternal(), m_line, Reverse(), SHAPE_LINE_CHAIN::Reverse(), SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::Simplify(), SHAPE_LINE_CHAIN::Slice(), and snapDraggedCorner().

Referenced by DragCorner().

◆ dragCornerFree()

void PNS::LINE::dragCornerFree ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

Definition at line 470 of file pns_line.cpp.

471 {
472  m_line.Point( aIndex ) = aP;
473  m_line.Simplify();
474 }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
VECTOR2I & Point(int aIndex)
Function Point()

References m_line, SHAPE_LINE_CHAIN::Point(), and SHAPE_LINE_CHAIN::Simplify().

Referenced by DragCorner().

◆ DragSegment()

void PNS::LINE::DragSegment ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold = 0,
bool  aFreeAngle = false 
)

Definition at line 488 of file pns_line.cpp.

489 {
490  if( aFreeAngle )
491  {
492  assert( false );
493  }
494  else
495  {
496  dragSegment45 ( aP, aIndex, aSnappingThreshold );
497  }
498 }
void dragSegment45(const VECTOR2I &aP, int aIndex, int aSnappingThreshold)
Definition: pns_line.cpp:589

References dragSegment45().

Referenced by PNS::DRAGGER::dragMarkObstacles(), and PNS::DRAGGER::dragShove().

◆ dragSegment45()

void PNS::LINE::dragSegment45 ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

Definition at line 589 of file pns_line.cpp.

590 {
591  SHAPE_LINE_CHAIN path( m_line );
592  VECTOR2I target( aP );
593 
594  SEG guideA[2], guideB[2];
595  int index = aIndex;
596 
597  target = snapToNeighbourSegments( path, aP, aIndex, aSnappingThreshold );
598 
599  if( index == 0 )
600  {
601  path.Insert( 0, path.CPoint( 0 ) );
602  index++;
603  }
604 
605  if( index == path.SegmentCount() - 1 )
606  {
607  path.Insert( path.PointCount() - 1, path.CPoint( -1 ) );
608  }
609 
610  SEG dragged = path.CSegment( index );
611  DIRECTION_45 drag_dir( dragged );
612 
613  SEG s_prev = path.CSegment( index - 1 );
614  SEG s_next = path.CSegment( index + 1 );
615 
616  DIRECTION_45 dir_prev( s_prev );
617  DIRECTION_45 dir_next( s_next );
618 
619  if( dir_prev == drag_dir )
620  {
621  dir_prev = dir_prev.Left();
622  path.Insert( index, path.CPoint( index ) );
623  index++;
624  }
625 
626  if( dir_next == drag_dir )
627  {
628  dir_next = dir_next.Right();
629  path.Insert( index + 1, path.CPoint( index + 1 ) );
630  }
631 
632  s_prev = path.CSegment( index - 1 );
633  s_next = path.CSegment( index + 1 );
634  dragged = path.CSegment( index );
635 
636  const bool lockEndpointA = true;
637  const bool lockEndpointB = true;
638 
639  if( aIndex == 0 )
640  {
641  if( !lockEndpointA )
642  {
643  guideA[0] = guideA[1] = SEG( dragged.A,
644  dragged.A + drag_dir.Right().Right().ToVector() );
645  }
646  else
647  {
648  guideA[0] = SEG( dragged.A, dragged.A + drag_dir.Right().ToVector() );
649  guideA[1] = SEG( dragged.A, dragged.A + drag_dir.Left().ToVector() );
650  }
651  }
652  else
653  {
654  if( dir_prev.Angle( drag_dir ) & (DIRECTION_45::ANG_OBTUSE | DIRECTION_45::ANG_HALF_FULL) )
655  {
656  guideA[0] = SEG( s_prev.A, s_prev.A + drag_dir.Left().ToVector() );
657  guideA[1] = SEG( s_prev.A, s_prev.A + drag_dir.Right().ToVector() );
658  }
659  else
660  guideA[0] = guideA[1] = SEG( dragged.A, dragged.A + dir_prev.ToVector() );
661  }
662 
663  if( aIndex == m_line.SegmentCount() - 1 )
664  {
665  if( !lockEndpointB )
666  {
667  guideB[0] = guideB[1] = SEG( dragged.B,
668  dragged.B + drag_dir.Right().Right().ToVector() );
669  }
670  else
671  {
672  guideB[0] = SEG( dragged.B, dragged.B + drag_dir.Right().ToVector() );
673  guideB[1] = SEG( dragged.B, dragged.B + drag_dir.Left().ToVector() );
674  }
675  }
676  else
677  {
678  if( dir_next.Angle( drag_dir ) & (DIRECTION_45::ANG_OBTUSE | DIRECTION_45::ANG_HALF_FULL) )
679  {
680  guideB[0] = SEG( s_next.B, s_next.B + drag_dir.Left().ToVector() );
681  guideB[1] = SEG( s_next.B, s_next.B + drag_dir.Right().ToVector() );
682  }
683  else
684  guideB[0] = guideB[1] = SEG( dragged.B, dragged.B + dir_next.ToVector() );
685 
686  }
687 
688  SEG s_current( target, target + drag_dir.ToVector() );
689 
690  int best_len = INT_MAX;
691  SHAPE_LINE_CHAIN best;
692 
693  for( int i = 0; i < 2; i++ )
694  {
695  for( int j = 0; j < 2; j++ )
696  {
697  OPT_VECTOR2I ip1 = s_current.IntersectLines( guideA[i] );
698  OPT_VECTOR2I ip2 = s_current.IntersectLines( guideB[j] );
699 
700  SHAPE_LINE_CHAIN np;
701 
702  if( !ip1 || !ip2 )
703  continue;
704 
705  SEG s1( s_prev.A, *ip1 );
706  SEG s2( *ip1, *ip2 );
707  SEG s3( *ip2, s_next.B );
708 
709  OPT_VECTOR2I ip;
710 
711  if( (ip = s1.Intersect( s_next )) )
712  {
713  np.Append( s1.A );
714  np.Append( *ip );
715  np.Append( s_next.B );
716  }
717  else if( (ip = s3.Intersect( s_prev )) )
718  {
719  np.Append( s_prev.A );
720  np.Append( *ip );
721  np.Append( s3.B );
722  }
723  else if( (ip = s1.Intersect( s3 )) )
724  {
725  np.Append( s_prev.A );
726  np.Append( *ip );
727  np.Append( s_next.B );
728  }
729  else
730  {
731  np.Append( s_prev.A );
732  np.Append( *ip1 );
733  np.Append( *ip2 );
734  np.Append( s_next.B );
735  }
736 
737  if( np.Length() < best_len )
738  {
739  best_len = np.Length();
740  best = np;
741  }
742  }
743  }
744 
745  if( !lockEndpointA && aIndex == 0 )
746  best.Remove( 0, 0 );
747  if( !lockEndpointB && aIndex == m_line.SegmentCount() - 1 )
748  best.Remove( -1, -1 );
749 
750  if( m_line.PointCount() == 1 )
751  m_line = best;
752  else if( aIndex == 0 )
753  m_line.Replace( 0, 1, best );
754  else if( aIndex == m_line.SegmentCount() - 1 )
755  m_line.Replace( -2, -1, best );
756  else
757  m_line.Replace( aIndex, aIndex + 1, best );
758 
759  m_line.Simplify();
760 }
long long int Length() const
Function Length()
int PointCount() const
Function PointCount()
VECTOR2I snapToNeighbourSegments(const SHAPE_LINE_CHAIN &aPath, const VECTOR2I &aP, int aIndex, int aThreshold) const
Definition: pns_line.cpp:543
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:34
Class DIRECTION_45.
Definition: direction45.h:36
void Remove(int aStartIndex, int aEndIndex)
Function Remove()
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:36
Class SHAPE_LINE_CHAIN.
size_t i
Definition: json11.cpp:597
VECTOR2I A
Definition: seg.h:44
void Replace(int aStartIndex, int aEndIndex, const VECTOR2I &aP)
Function Replace()
VECTOR2I B
Definition: seg.h:45

References SEG::A, DIRECTION_45::ANG_HALF_FULL, DIRECTION_45::ANG_OBTUSE, DIRECTION_45::Angle(), SHAPE_LINE_CHAIN::Append(), SEG::B, SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CSegment(), i, SHAPE_LINE_CHAIN::Insert(), SEG::Intersect(), DIRECTION_45::Left(), SHAPE_LINE_CHAIN::Length(), m_line, SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::Remove(), SHAPE_LINE_CHAIN::Replace(), DIRECTION_45::Right(), SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::Simplify(), snapToNeighbourSegments(), and DIRECTION_45::ToVector().

Referenced by DragSegment().

◆ dragSegmentFree()

void PNS::LINE::dragSegmentFree ( const VECTOR2I aP,
int  aIndex,
int  aSnappingThreshold 
)
private

◆ EndsWithVia()

◆ GetLink()

SEGMENT* PNS::LINE::GetLink ( int  aIndex) const
inline

Definition at line 219 of file pns_line.h.

220  {
221  return m_segmentRefs[aIndex];
222  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

Referenced by PNS::LINE_PLACER::removeLoops(), PNS::TOPOLOGY::SimplifyLine(), PNS::MEANDER_SKEW_PLACER::Start(), and PNS::DP_MEANDER_PLACER::Start().

◆ HasLockedSegments()

bool PNS::LINE::HasLockedSegments ( ) const

Definition at line 955 of file pns_line.cpp.

956 {
957  for( const SEGMENT* seg : m_segmentRefs )
958  {
959  if( seg->Marker() & MK_LOCKED )
960  return true;
961  }
962  return false;
963 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs, and PNS::MK_LOCKED.

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

◆ HasLoops()

bool PNS::LINE::HasLoops ( ) const

Definition at line 839 of file pns_line.cpp.

840 {
841  for( int i = 0; i < PointCount(); i++ )
842  {
843  for( int j = i + 2; j < PointCount(); j++ )
844  {
845  if( CPoint( i ) == CPoint( j ) )
846  return true;
847  }
848  }
849 
850  return false;
851 }
int PointCount() const
Returns the number of points in the line
Definition: pns_line.h:151
const VECTOR2I & CPoint(int aIdx) const
Returns the aIdx-th point of the line
Definition: pns_line.h:157
size_t i
Definition: json11.cpp:597

References CPoint(), i, and PointCount().

Referenced by PNS::SHOVE::onCollidingSolid(), and PNS::LINE_PLACER::rhShoveOnly().

◆ Hull()

virtual const SHAPE_LINE_CHAIN PNS::ITEM::Hull ( int  aClearance = 0,
int  aWalkaroundThickness = 0 
) const
inlinevirtualinherited

Reimplemented in PNS::VIA, PNS::SEGMENT, and PNS::SOLID.

Definition at line 112 of file pns_item.h.

113  {
114  return SHAPE_LINE_CHAIN();
115  }
Class SHAPE_LINE_CHAIN.

◆ Is45Degree()

bool PNS::LINE::Is45Degree ( ) const

Definition at line 302 of file pns_line.cpp.

303 {
304  for( int i = 0; i < m_line.SegmentCount(); i++ )
305  {
306  const SEG& s = m_line.CSegment( i );
307 
308  if( s.Length() < 10 )
309  continue;
310 
311  double angle = 180.0 / M_PI *
312  atan2( (double) s.B.y - (double) s.A.y,
313  (double) s.B.x - (double) s.A.x );
314 
315  if( angle < 0 )
316  angle += 360.0;
317 
318  double angle_a = fabs( fmod( angle, 45.0 ) );
319 
320  if( angle_a > 1.0 && angle_a < 44.0 )
321  return false;
322  }
323 
324  return true;
325 }
int Length() const
Function Length()
Definition: seg.h:296
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:36
const SEG CSegment(int aIndex) const
Function CSegment()
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
size_t i
Definition: json11.cpp:597
VECTOR2I A
Definition: seg.h:44
VECTOR2I B
Definition: seg.h:45

References SEG::A, PNS::angle(), SEG::B, SHAPE_LINE_CHAIN::CSegment(), i, SEG::Length(), m_line, SHAPE_LINE_CHAIN::SegmentCount(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ IsLinked()

bool PNS::LINE::IsLinked ( ) const
inline

Definition at line 202 of file pns_line.h.

203  {
204  return m_segmentRefs.size() != 0;
205  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

Referenced by PNS::NODE::Add(), ClipVertexRange(), PNS::TOPOLOGY::followTrivialPath(), IsLinkedChecked(), PNS::DIFF_PAIR::NLine(), PNS::DIFF_PAIR::PLine(), Rank(), PNS::OPTIMIZER::removeCachedSegments(), ShowLinks(), and PNS::TOPOLOGY::SimplifyLine().

◆ IsLinkedChecked()

bool PNS::LINE::IsLinkedChecked ( ) const
inline

Definition at line 207 of file pns_line.h.

208  {
209  return IsLinked() && LinkCount() == SegmentCount();
210  }
int SegmentCount() const
Returns the number of segments in the line
Definition: pns_line.h:145
bool IsLinked() const
Definition: pns_line.h:202
int LinkCount() const
Returns the number of segments that were assembled together to form this line.
Definition: pns_line.h:228

References IsLinked(), LinkCount(), and SegmentCount().

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

◆ IsLocked()

bool PNS::ITEM::IsLocked ( ) const
inlineinherited

Definition at line 235 of file pns_item.h.

236  {
237  return Marker() & MK_LOCKED;
238  }
virtual int Marker() const
Definition: pns_item.h:220

References PNS::ITEM::Marker(), and PNS::MK_LOCKED.

Referenced by ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::performDragging(), and PNS::SHOVE::pushOrShoveVia().

◆ IsRoutable()

bool PNS::ITEM::IsRoutable ( ) const
inlineinherited

Definition at line 241 of file pns_item.h.

241 { return m_routable; }
bool m_routable
Definition: pns_item.h:258

References PNS::ITEM::m_routable.

◆ Kind()

◆ KindStr()

std::string PNS::ITEM::KindStr ( ) const
inherited

Function KindStr()

Returns the kind of the item, as string

Definition at line 71 of file pns_item.cpp.

72 {
73  switch( m_kind )
74  {
75  case LINE_T: return "line";
76  case SEGMENT_T: return "segment";
77  case VIA_T: return "via";
78  case JOINT_T: return "joint";
79  case SOLID_T: return "solid";
80  default: return "unknown";
81  }
82 }
PnsKind m_kind
Definition: pns_item.h:248

References PNS::ITEM::JOINT_T, PNS::ITEM::LINE_T, PNS::ITEM::m_kind, PNS::ITEM::SEGMENT_T, PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by PNS::TOOL_BASE::pickSingleItem(), and PNS::TOOL_BASE::updateEndItem().

◆ Layer()

virtual int PNS::ITEM::Layer ( ) const
inlinevirtualinherited

Reimplemented in PNS::SEGMENT.

Definition at line 154 of file pns_item.h.

154 { return Layers().Start(); }
int Start() const
Definition: pns_layerset.h:83
const LAYER_RANGE & Layers() const
Definition: pns_item.h:150

References PNS::ITEM::Layers(), and LAYER_RANGE::Start().

Referenced by PNS::OPTIMIZER::fanoutCleanup(), and PNS::OPTIMIZER::runSmartPads().

◆ Layers()

◆ LayersOverlap()

bool PNS::ITEM::LayersOverlap ( const ITEM aOther) const
inlineinherited

Function LayersOverlap()

Returns true if the set of layers spanned by aOther overlaps our layers.

Definition at line 162 of file pns_item.h.

163  {
164  return Layers().Overlaps( aOther->Layers() );
165  }
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:68
const LAYER_RANGE & Layers() const
Definition: pns_item.h:150

References PNS::ITEM::Layers(), and LAYER_RANGE::Overlaps().

Referenced by PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::ProcessSingleLine(), and PNS::NODE::removeViaIndex().

◆ Line()

◆ LinkCount()

int PNS::LINE::LinkCount ( ) const
inline

Returns the number of segments that were assembled together to form this line.

Definition at line 228 of file pns_line.h.

229  {
230  return m_segmentRefs.size();
231  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

Referenced by IsLinkedChecked(), and PNS::LINE_PLACER::removeLoops().

◆ LinkedSegments()

SEGMENT_REFS& PNS::LINE::LinkedSegments ( )
inline

Returns the list of segments from the owning node that constitute this line (or NULL if the line is not linked)

Definition at line 197 of file pns_line.h.

198  {
199  return m_segmentRefs;
200  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

Referenced by PNS::NODE::Dump(), PNS::TOPOLOGY::followTrivialPath(), PNS::SHOVE::popLineStack(), PNS::SHOVE::ProcessSingleLine(), PNS::NODE::Remove(), PNS::OPTIMIZER::removeCachedSegments(), and PNS::SHOVE::unwindLineStack().

◆ LinkSegment()

void PNS::LINE::LinkSegment ( SEGMENT aSeg)
inline

Adds a reference to a segment registered in a NODE that is a part of this line.

Definition at line 190 of file pns_line.h.

191  {
192  m_segmentRefs.push_back( aSeg );
193  }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References m_segmentRefs.

Referenced by PNS::NODE::Add(), and PNS::NODE::AssembleLine().

◆ Mark()

void PNS::LINE::Mark ( int  aMarker)
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 85 of file pns_line.cpp.

86 {
87  m_marker = aMarker;
88 
89  for( SEGMENT* s : m_segmentRefs )
90  s->Mark( aMarker );
91 
92 }
int m_marker
Definition: pns_item.h:256
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References PNS::ITEM::m_marker, and m_segmentRefs.

Referenced by PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::ProcessSingleLine(), PNS::SHOVE::ShoveLines(), and PNS::SHOVE::ShoveMultiLines().

◆ Marker()

int PNS::LINE::Marker ( ) const
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 104 of file pns_line.cpp.

105 {
106  int marker = m_marker;
107 
108  for( SEGMENT* s : m_segmentRefs )
109  {
110  marker |= s->Marker();
111  }
112 
113  return marker;
114 }
int m_marker
Definition: pns_item.h:256
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References PNS::ITEM::m_marker, and m_segmentRefs.

Referenced by PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::processHullSet(), PNS::SHOVE::ProcessSingleLine(), and PNS::SEGMENT::SEGMENT().

◆ Net()

◆ OfKind()

◆ operator=()

LINE & PNS::LINE::operator= ( const LINE aOther)

Definition at line 58 of file pns_line.cpp.

59 {
60  m_line = aOther.m_line;
61  m_width = aOther.m_width;
62  m_net = aOther.m_net;
63  m_movable = aOther.m_movable;
64  m_layers = aOther.m_layers;
65  m_via = aOther.m_via;
66  m_hasVia = aOther.m_hasVia;
67  m_marker = aOther.m_marker;
68  m_rank = aOther.m_rank;
69  m_owner = aOther.m_owner;
70 
71  copyLinks( &aOther );
72 
73  return *this;
74 }
VIA m_via
Via at the end point, if m_hasVia == true
Definition: pns_line.h:316
NODE * m_owner
Definition: pns_item.h:251
LAYER_RANGE m_layers
Definition: pns_item.h:252
int m_rank
Definition: pns_item.h:257
bool m_movable
Definition: pns_item.h:254
int m_marker
Definition: pns_item.h:256
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
void copyLinks(const LINE *aParent)
Copies m_segmentRefs from the line aParent.
Definition: pns_line.cpp:117
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:313
int m_net
Definition: pns_item.h:255
int m_width
our width
Definition: pns_line.h:310

References copyLinks(), m_hasVia, PNS::ITEM::m_layers, m_line, PNS::ITEM::m_marker, PNS::ITEM::m_movable, PNS::ITEM::m_net, PNS::ITEM::m_owner, PNS::ITEM::m_rank, m_via, and m_width.

◆ Owner()

NODE* PNS::ITEM::Owner ( ) const
inlineinherited

Function Owner()

Returns the owner of this item, or NULL if there's none.

Definition at line 172 of file pns_item.h.

172 { return m_owner; }
NODE * m_owner
Definition: pns_item.h:251

References PNS::ITEM::m_owner.

Referenced by PNS::SIZES_SETTINGS::inheritTrackWidth(), and PNS::LINE_PLACER::Move().

◆ Parent()

◆ PointCount()

int PNS::LINE::PointCount ( ) const
inline

◆ Rank()

int PNS::LINE::Rank ( ) const
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 800 of file pns_line.cpp.

801 {
802  int min_rank = INT_MAX;
803 
804  if( IsLinked() ) {
805  for( SEGMENT *s : m_segmentRefs )
806  {
807  min_rank = std::min( min_rank, s->Rank() );
808  }
809  } else {
810  min_rank = m_rank;
811  }
812 
813  int rank = ( min_rank == INT_MAX ) ? -1 : min_rank;
814 
815  return rank;
816 }
int m_rank
Definition: pns_item.h:257
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304
bool IsLinked() const
Definition: pns_line.h:202
#define min(a, b)
Definition: auxiliary.h:85

References IsLinked(), PNS::ITEM::m_rank, m_segmentRefs, and min.

Referenced by PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onCollidingVia(), PNS::SHOVE::onReverseCollidingVia(), PNS::SEGMENT::SEGMENT(), and PNS::SHOVE::shoveIteration().

◆ RemoveVia()

void PNS::LINE::RemoveVia ( )
inline

Definition at line 267 of file pns_line.h.

267 { m_hasVia = false; }
bool m_hasVia
If true, the line ends with a via
Definition: pns_line.h:313

References m_hasVia.

Referenced by ClipToNearestObstacle(), PNS::LINE_PLACER::initPlacement(), PNS::SHOVE::onReverseCollidingVia(), and PNS::LINE_PLACER::ToggleVia().

◆ Reverse()

void PNS::LINE::Reverse ( )

Reverses the point/vertex order

Definition at line 769 of file pns_line.cpp.

770 {
771  m_line = m_line.Reverse();
772 
773  std::reverse( m_segmentRefs.begin(), m_segmentRefs.end() );
774 }
const SHAPE_LINE_CHAIN Reverse() const
Function Reverse()
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304
static void reverse(privcurve_t *curve)
Definition: trace.cpp:1025

References m_line, m_segmentRefs, SHAPE_LINE_CHAIN::Reverse(), and reverse().

Referenced by AppendVia(), dragCorner45(), PNS::DRAGGER::findViaFanoutByHandle(), and PNS::TOPOLOGY::followTrivialPath().

◆ SegmentCount()

◆ SetLayer()

void PNS::ITEM::SetLayer ( int  aLayer)
inlineinherited

◆ SetLayers()

void PNS::ITEM::SetLayers ( const LAYER_RANGE aLayers)
inlineinherited

Definition at line 151 of file pns_item.h.

151 { m_layers = aLayers; }
LAYER_RANGE m_layers
Definition: pns_item.h:252

References PNS::ITEM::m_layers.

Referenced by PNS::TOPOLOGY::AssembleDiffPair(), PNS::NODE::AssembleLine(), PNS::VIA::Clone(), PNS::SEGMENT::SetLayer(), and PNS::VIA::VIA().

◆ SetNet()

◆ SetOwner()

void PNS::ITEM::SetOwner ( NODE aOwner)
inlineinherited

Functon SetOwner()

Sets the node that owns this item. An item can belong to a single NODE or be unowned.

Definition at line 179 of file pns_item.h.

179 { m_owner = aOwner; }
NODE * m_owner
Definition: pns_item.h:251

References PNS::ITEM::m_owner.

Referenced by PNS::NODE::AssembleLine(), PNS::NODE::doRemove(), and PNS::NODE::Remove().

◆ SetParent()

void PNS::ITEM::SetParent ( BOARD_CONNECTED_ITEM aParent)
inlineinherited

Definition at line 144 of file pns_item.h.

144 { m_parent = aParent; }
BOARD_CONNECTED_ITEM * m_parent
Definition: pns_item.h:250

References PNS::ITEM::m_parent.

Referenced by PNS_KICAD_IFACE::AddItem().

◆ SetRank()

void PNS::LINE::SetRank ( int  aRank)
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 790 of file pns_line.cpp.

791 {
792  m_rank = aRank;
793 
794  for( SEGMENT* s : m_segmentRefs )
795  s->SetRank( aRank );
796 
797 }
int m_rank
Definition: pns_item.h:257
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References PNS::ITEM::m_rank, and m_segmentRefs.

Referenced by PNS::SHOVE::onCollidingLine(), PNS::SHOVE::onCollidingSegment(), PNS::SHOVE::onCollidingSolid(), PNS::SHOVE::onReverseCollidingVia(), PNS::SHOVE::ShoveLines(), and PNS::SHOVE::ShoveMultiLines().

◆ SetRoutable()

void PNS::ITEM::SetRoutable ( bool  aRoutable)
inlineinherited

Definition at line 240 of file pns_item.h.

240 { m_routable = aRoutable; }
bool m_routable
Definition: pns_item.h:258

References PNS::ITEM::m_routable.

◆ SetShape()

◆ SetWidth()

void PNS::LINE::SetWidth ( int  aWidth)
inline

Sets line width

Definition at line 169 of file pns_line.h.

170  {
171  m_width = aWidth;
172  }
int m_width
our width
Definition: pns_line.h:310

References m_width.

Referenced by PNS::NODE::AssembleLine(), PNS::LINE_PLACER::initPlacement(), and PNS::DIFF_PAIR::updateLine().

◆ Shape()

const SHAPE* PNS::LINE::Shape ( ) const
inlineoverridevirtual

Returns the shape of the line

Reimplemented from PNS::ITEM.

Definition at line 127 of file pns_line.h.

128  {
129  return &m_line;
130  }
SHAPE_LINE_CHAIN m_line
The actual shape of the line
Definition: pns_line.h:307

References m_line.

Referenced by PNS::LOGGER::Log(), and PNS::SHOVE::onCollidingVia().

◆ ShowLinks()

void PNS::LINE::ShowLinks ( ) const

Prints out all linked segments

Definition at line 354 of file pns_line.cpp.

355 {
356  if( !IsLinked() )
357  {
358  wxLogTrace( "PNS", "line %p: no links", this );
359  return;
360  }
361 
362  wxLogTrace( "PNS", "line %p: %d linked segs", this, (int) m_segmentRefs.size() );
363 
364  for( int i = 0; i < (int) m_segmentRefs.size(); i++ )
365  wxLogTrace( "PNS", "seg %d: %p\n", i, m_segmentRefs[i] );
366 }
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304
size_t i
Definition: json11.cpp:597
bool IsLinked() const
Definition: pns_line.h:202

References i, IsLinked(), and m_segmentRefs.

◆ snapDraggedCorner()

VECTOR2I PNS::LINE::snapDraggedCorner ( const SHAPE_LINE_CHAIN aPath,
const VECTOR2I aP,
int  aIndex,
int  aThreshold 
) const
private

Definition at line 501 of file pns_line.cpp.

503 {
504  int s_start = std::max( aIndex - 2, 0 );
505  int s_end = std::min( aIndex + 2, aPath.SegmentCount() - 1 );
506 
507  int i, j;
508  int best_dist = INT_MAX;
509  VECTOR2I best_snap = aP;
510 
511  if( aThreshold <= 0 )
512  return aP;
513 
514  for( i = s_start; i <= s_end; i++ )
515  {
516  const SEG& a = aPath.CSegment( i );
517 
518  for( j = s_start; j < i; j++ )
519  {
520  const SEG& b = aPath.CSegment( j );
521 
522  if( !( DIRECTION_45( a ).IsObtuse(DIRECTION_45( b ) ) ) )
523  continue;
524 
525  OPT_VECTOR2I ip = a.IntersectLines(b);
526 
527  if( ip )
528  {
529  int dist = ( *ip - aP ).EuclideanNorm();
530 
531  if( dist < aThreshold && dist < best_dist )
532  {
533  best_dist = dist;
534  best_snap = *ip;
535  }
536  }
537  }
538  }
539 
540  return best_snap;
541 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:123
static const int dist[10][10]
Definition: ar_matrix.cpp:320
OPT_VECTOR2I IntersectLines(const SEG &aSeg) const
Function IntersectLines()
Definition: seg.h:183
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:34
Class DIRECTION_45.
Definition: direction45.h:36
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:36
const SEG CSegment(int aIndex) const
Function CSegment()
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597
#define min(a, b)
Definition: auxiliary.h:85

References SHAPE_LINE_CHAIN::CSegment(), dist, EuclideanNorm(), i, SEG::IntersectLines(), max, min, and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by dragCorner45().

◆ snapToNeighbourSegments()

VECTOR2I PNS::LINE::snapToNeighbourSegments ( const SHAPE_LINE_CHAIN aPath,
const VECTOR2I aP,
int  aIndex,
int  aThreshold 
) const
private

Definition at line 543 of file pns_line.cpp.

545 {
546  VECTOR2I snap_p[2];
547  DIRECTION_45 dragDir( aPath.CSegment( aIndex ) );
548  int snap_d[2] = { -1, -1 };
549 
550  if( aThreshold == 0 )
551  return aP;
552 
553  if( aIndex >= 2 )
554  {
555  SEG s = aPath.CSegment( aIndex - 2 );
556 
557  if( DIRECTION_45( s ) == dragDir )
558  snap_d[0] = s.LineDistance( aP );
559 
560  snap_p[0] = s.A;
561  }
562 
563  if( aIndex < aPath.SegmentCount() - 2 )
564  {
565  SEG s = aPath.CSegment( aIndex + 2 );
566 
567  if( DIRECTION_45( s ) == dragDir )
568  snap_d[1] = s.LineDistance(aP);
569 
570  snap_p[1] = s.A;
571  }
572 
573  VECTOR2I best = aP;
574  int minDist = INT_MAX;
575 
576  for( int i = 0; i < 2; i++ )
577  {
578  if( snap_d[i] >= 0 && snap_d[i] < minDist && snap_d[i] <= aThreshold )
579  {
580  minDist = snap_d[i];
581  best = snap_p[i];
582  }
583  }
584 
585  return best;
586 }
int LineDistance(const VECTOR2I &aP, bool aDetermineSide=false) const
Function LineDistance()
Definition: seg.h:357
Class DIRECTION_45.
Definition: direction45.h:36
int SegmentCount() const
Function SegmentCount()
Definition: seg.h:36
const SEG CSegment(int aIndex) const
Function CSegment()
size_t i
Definition: json11.cpp:597
VECTOR2I A
Definition: seg.h:44

References SEG::A, SHAPE_LINE_CHAIN::CSegment(), i, SEG::LineDistance(), and SHAPE_LINE_CHAIN::SegmentCount().

Referenced by dragSegment45().

◆ Unmark()

void PNS::LINE::Unmark ( int  aMarker = -1)
overridevirtual

Reimplemented from PNS::ITEM.

Definition at line 95 of file pns_line.cpp.

96 {
97  for( SEGMENT* s : m_segmentRefs )
98  s->Unmark( aMarker );
99 
100  m_marker = 0;
101 }
int m_marker
Definition: pns_item.h:256
SEGMENT_REFS m_segmentRefs
List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is...
Definition: pns_line.h:304

References PNS::ITEM::m_marker, and m_segmentRefs.

Referenced by PNS::DRAGGER::dragShove(), and PNS::SHOVE::onCollidingSolid().

◆ Via()

◆ Walkaround() [1/2]

bool PNS::LINE::Walkaround ( SHAPE_LINE_CHAIN  aObstacle,
SHAPE_LINE_CHAIN aPre,
SHAPE_LINE_CHAIN aWalk,
SHAPE_LINE_CHAIN aPost,
bool  aCw 
) const

Calculates a line thightly wrapping a convex hull of an obstacle object (aObstacle).

aPrePath = path from origin to the obstacle aWalkaroundPath = path around the obstacle aPostPath = past from obstacle till the end aCW = whether to walk around in clockwise or counter-clockwise direction.

Definition at line 159 of file pns_line.cpp.

161 {
162  const SHAPE_LINE_CHAIN& line( CLine() );
163 
164  if( line.SegmentCount() < 1 )
165  return false;
166 
167  const auto pFirst = line.CPoint(0);
168  const auto pLast = line.CPoint(-1);
169 
170  if( aObstacle.PointInside( line.CPoint( 0 ) ) || aObstacle.PointInside( line.CPoint( -1 ) ) )
171  {
172  return false;
173  }
174 
176 
177  line.Intersect( aObstacle, ips );
178 
179  auto eFirst = aObstacle.EdgeContainingPoint( pFirst );
180  auto eLast = aObstacle.EdgeContainingPoint( pLast );
181 
182  aWalk.Clear();
183  aPost.Clear();
184 
185  int nearest_dist = INT_MAX;
186  int farthest_dist = 0;
187 
188  SHAPE_LINE_CHAIN::INTERSECTION nearest, farthest;
190 
191  if( eFirst >= 0 )
192  {
193  is.our = line.CSegment(0);
194  is.their = aObstacle.CSegment( eFirst );
195  is.p = pFirst;
196  ips.push_back(is);
197  }
198 
199  if ( eLast >= 0 )
200  {
201  is.our = line.CSegment(-1);
202  is.their = aObstacle.CSegment( eLast );
203  is.p = pLast;
204  ips.push_back(is);
205  }
206 
207  for( int i = 0; i < (int) ips.size(); i++ )
208  {
209  const VECTOR2I p = ips[i].p;
210  int dist = line.PathLength( p );
211 
212  if( dist < 0 )
213  return false;
214 
215  if( dist <= nearest_dist )
216  {
217  nearest_dist = dist;
218  nearest = ips[i];
219  }
220 
221  if( dist >= farthest_dist )
222  {
223  farthest_dist = dist;
224  farthest = ips[i];
225  }
226  }
227 
228  if( ips.size() <= 1 || nearest.p == farthest.p )
229  {
230  aPre = line;
231  return true;
232  }
233 
234  aPre = line.Slice( 0, nearest.our.Index() );
235  aPre.Append( nearest.p );
236  aPre.Simplify();
237 
238  aWalk.Clear();
239  aWalk.SetClosed( false );
240  aWalk.Append( nearest.p );
241 
242  assert( nearest.their.Index() >= 0 );
243  assert( farthest.their.Index() >= 0 );
244 
245  assert( nearest_dist <= farthest_dist );
246 
247  aObstacle.Split( nearest.p );
248  aObstacle.Split( farthest.p );
249 
250  int i_first = aObstacle.Find( nearest.p );
251  int i_last = aObstacle.Find( farthest.p );
252 
253  int i = i_first;
254 
255  if( i_first < 0 || i_last < 0 )
256  return false;
257 
258  while( i != i_last )
259  {
260  aWalk.Append( aObstacle.CPoint( i ) );
261  i += ( aCw ? 1 : -1 );
262 
263  if( i < 0 )
264  i = aObstacle.PointCount() - 1;
265  else if( i == aObstacle.PointCount() )
266  i = 0;
267  }
268 
269  aWalk.Append( farthest.p );
270  aWalk.Simplify();
271 
272  aPost.Clear();
273  aPost.Append( farthest.p );
274  aPost.Append( line.Slice( farthest.our.Index() + 1, -1 ) );
275  aPost.Simplify();
276 
277  return true;
278 }
int Find(const VECTOR2I &aP) const
Function Find()
const SHAPE_LINE_CHAIN & CLine() const
Const accessor to the underlying shape
Definition: pns_line.h:139
int Index() const
Function Index()
Definition: seg.h:314
int Split(const VECTOR2I &aP)
Function Split()
int EdgeContainingPoint(const VECTOR2I &aP, int aAccuracy=0) const
Function EdgeContainingPoint()
std::vector< INTERSECTION > INTERSECTIONS
static const int dist[10][10]
Definition: ar_matrix.cpp:320
const SHAPE_LINE_CHAIN Slice(int aStartIndex, int aEndIndex=-1) const
Function Slice()
VECTOR2I p
point of intersection between our and their.
int PointCount() const
Function PointCount()
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
const VECTOR2I & CPoint(int aIndex) const
Function CPoint()
void SetClosed(bool aClosed)
Function SetClosed()
SEG their
segment belonging from the aOther argument of Intersect()
const SEG CSegment(int aIndex) const
Function CSegment()
Class SHAPE_LINE_CHAIN.
size_t i
Definition: json11.cpp:597
void Clear()
Function Clear() Removes all points from the line chain.
bool PointInside(const VECTOR2I &aPt, int aAccuracy=0, bool aUseBBoxCache=false) const
Function PointInside()
SEG our
segment belonging from the (this) argument of Intersect()

References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::Clear(), CLine(), SHAPE_LINE_CHAIN::CPoint(), SHAPE_LINE_CHAIN::CSegment(), dist, SHAPE_LINE_CHAIN::EdgeContainingPoint(), SHAPE_LINE_CHAIN::Find(), i, SEG::Index(), SHAPE_LINE_CHAIN::Intersect(), SHAPE_LINE_CHAIN::INTERSECTION::our, SHAPE_LINE_CHAIN::INTERSECTION::p, SHAPE_LINE_CHAIN::PathLength(), SHAPE_LINE_CHAIN::PointCount(), SHAPE_LINE_CHAIN::PointInside(), SHAPE_LINE_CHAIN::SegmentCount(), SHAPE_LINE_CHAIN::SetClosed(), SHAPE_LINE_CHAIN::Simplify(), SHAPE_LINE_CHAIN::Slice(), SHAPE_LINE_CHAIN::Split(), and SHAPE_LINE_CHAIN::INTERSECTION::their.

Referenced by PNS::SHOVE::processHullSet(), PNS::WALKAROUND::singleStep(), Walkaround(), and PNS::SHOVE::walkaroundLoneVia().

◆ Walkaround() [2/2]

bool PNS::LINE::Walkaround ( const SHAPE_LINE_CHAIN aObstacle,
SHAPE_LINE_CHAIN aPath,
bool  aCw 
) const

Definition at line 281 of file pns_line.cpp.

282 {
283  SHAPE_LINE_CHAIN walk, post;
284 
285  if( ! Walkaround( aObstacle, aPath, walk, post, aCw ) )
286  return false;
287 
288  aPath.Append( walk );
289  aPath.Append( post );
290  aPath.Simplify();
291 
292  return true;
293 }
bool Walkaround(SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN &aPre, SHAPE_LINE_CHAIN &aWalk, SHAPE_LINE_CHAIN &aPost, bool aCw) const
Calculates a line thightly wrapping a convex hull of an obstacle object (aObstacle).
Definition: pns_line.cpp:159
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN & Simplify()
Function Simplify()
Class SHAPE_LINE_CHAIN.

References SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::Simplify(), and Walkaround().

◆ Width()

Member Data Documentation

◆ m_hasVia

bool PNS::LINE::m_hasVia
private

If true, the line ends with a via

Definition at line 313 of file pns_line.h.

Referenced by AppendVia(), EndsWithVia(), LINE(), operator=(), and RemoveVia().

◆ m_kind

PnsKind PNS::ITEM::m_kind
protectedinherited

◆ m_layers

◆ m_line

◆ m_marker

◆ m_movable

bool PNS::ITEM::m_movable
protectedinherited

Definition at line 254 of file pns_item.h.

Referenced by PNS::ITEM::ITEM(), LINE(), operator=(), and PNS::SOLID::SOLID().

◆ m_net

◆ m_owner

NODE* PNS::ITEM::m_owner
protectedinherited

◆ m_parent

BOARD_CONNECTED_ITEM* PNS::ITEM::m_parent
protectedinherited

◆ m_rank

◆ m_routable

bool PNS::ITEM::m_routable
protectedinherited

Definition at line 258 of file pns_item.h.

Referenced by PNS::ITEM::IsRoutable(), PNS::ITEM::ITEM(), and PNS::ITEM::SetRoutable().

◆ m_segmentRefs

SEGMENT_REFS PNS::LINE::m_segmentRefs
private

List of segments in the owning NODE (ITEM::m_owner) that constitute this line, or NULL if the line is not a part of any node.

Definition at line 304 of file pns_line.h.

Referenced by ClearSegmentLinks(), ClipVertexRange(), ContainsSegment(), copyLinks(), GetLink(), HasLockedSegments(), IsLinked(), LinkCount(), LinkedSegments(), LinkSegment(), Mark(), Marker(), Rank(), Reverse(), SetRank(), ShowLinks(), and Unmark().

◆ m_via

VIA PNS::LINE::m_via
private

Via at the end point, if m_hasVia == true

Definition at line 316 of file pns_line.h.

Referenced by AppendVia(), LINE(), operator=(), and Via().

◆ m_width

int PNS::LINE::m_width
private

our width

Definition at line 310 of file pns_line.h.

Referenced by LINE(), operator=(), SetWidth(), and Width().

◆ UnusedNet

const int PNS::ITEM::UnusedNet = INT_MAX
staticinherited

Definition at line 56 of file pns_item.h.

Referenced by PNS::ITEM::ITEM().


The documentation for this class was generated from the following files: