KiCad PCB EDA Suite
SEG Class Reference

#include <seg.h>

Public Types

using ecoord = VECTOR2I::extended_type
 

Public Member Functions

 SEG ()
 Create an empty (0, 0) segment. More...
 
 SEG (int aX1, int aY1, int aX2, int aY2)
 Create a segment between (aX1, aY1) and (aX2, aY2). More...
 
 SEG (const VECTOR2I &aA, const VECTOR2I &aB)
 Create a segment between (aA) and (aB). More...
 
 SEG (const VECTOR2I &aA, const VECTOR2I &aB, int aIndex)
 Create a segment between (aA) and (aB), referenced to a multi-segment shape. More...
 
 SEG (const SEG &aSeg)
 Copy constructor. More...
 
SEGoperator= (const SEG &aSeg)
 
bool operator== (const SEG &aSeg) const
 
bool operator!= (const SEG &aSeg) const
 
VECTOR2I LineProject (const VECTOR2I &aP) const
 Compute the perpendicular projection point of aP on a line passing through ends of the segment. More...
 
int Side (const VECTOR2I &aP) const
 Determine on which side of directed line passing via segment ends point aP lies. More...
 
int LineDistance (const VECTOR2I &aP, bool aDetermineSide=false) const
 Return the closest Euclidean distance between point aP and the line defined by the ends of segment (this). More...
 
double AngleDegrees (const SEG &aOther) const
 Determine the smallest angle between two segments (result in degrees) More...
 
const VECTOR2I NearestPoint (const VECTOR2I &aP) const
 Compute a point on the segment (this) that is closest to point aP. More...
 
const VECTOR2I NearestPoint (const SEG &aSeg) const
 Compute a point on the segment (this) that is closest to any point on aSeg. More...
 
const VECTOR2I ReflectPoint (const VECTOR2I &aP) const
 Reflect a point using this segment as axis. More...
 
OPT_VECTOR2I Intersect (const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
 Compute intersection point of segment (this) with segment aSeg. More...
 
bool Intersects (const SEG &aSeg) const
 
OPT_VECTOR2I IntersectLines (const SEG &aSeg) const
 Compute the intersection point of lines passing through ends of (this) and aSeg. More...
 
SEG PerpendicularSeg (const VECTOR2I &aP) const
 Compute a segment perpendicular to this one, passing through point aP. More...
 
SEG ParallelSeg (const VECTOR2I &aP) const
 Compute a segment parallel to this one, passing through point aP. More...
 
bool Collide (const SEG &aSeg, int aClearance, int *aActual=nullptr) const
 
ecoord SquaredDistance (const SEG &aSeg) const
 
int Distance (const SEG &aSeg) const
 Compute minimum Euclidean distance to segment aSeg. More...
 
ecoord SquaredDistance (const VECTOR2I &aP) const
 
int Distance (const VECTOR2I &aP) const
 Compute minimum Euclidean distance to point aP. More...
 
void CanonicalCoefs (ecoord &qA, ecoord &qB, ecoord &qC) const
 
bool Collinear (const SEG &aSeg) const
 Check if segment aSeg lies on the same line as (this). More...
 
bool ApproxCollinear (const SEG &aSeg) const
 
bool ApproxParallel (const SEG &aSeg) const
 
bool ApproxPerpendicular (const SEG &aSeg) const
 
bool Overlaps (const SEG &aSeg) const
 
bool Contains (const SEG &aSeg) const
 
int Length () const
 Return the length (this). More...
 
ecoord SquaredLength () const
 
ecoord TCoef (const VECTOR2I &aP) const
 
int Index () const
 Return the index of this segment in its parent shape (applicable only to non-local segments). More...
 
bool Contains (const VECTOR2I &aP) const
 
void Reverse ()
 
SEG Reversed () const
 Returns the center point of the line. More...
 
VECTOR2I Center () const
 

Static Public Member Functions

static SEG::ecoord Square (int a)
 

Public Attributes

VECTOR2I A
 
VECTOR2I B
 

Private Member Functions

bool ccw (const VECTOR2I &aA, const VECTOR2I &aB, const VECTOR2I &aC) const
 
bool intersects (const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false, VECTOR2I *aPt=nullptr) const
 

Private Attributes

int m_index
 < index within the parent shape (used when m_is_local == false) More...
 

Friends

std::ostream & operator<< (std::ostream &aStream, const SEG &aSeg)
 

Detailed Description

Definition at line 40 of file seg.h.

Member Typedef Documentation

◆ ecoord

Definition at line 43 of file seg.h.

Constructor & Destructor Documentation

◆ SEG() [1/5]

SEG::SEG ( )
inline

Create an empty (0, 0) segment.

Definition at line 54 of file seg.h.

55  {
56  m_index = -1;
57  }
int m_index
< index within the parent shape (used when m_is_local == false)
Definition: seg.h:399

References m_index.

Referenced by ParallelSeg(), PerpendicularSeg(), and Reversed().

◆ SEG() [2/5]

SEG::SEG ( int  aX1,
int  aY1,
int  aX2,
int  aY2 
)
inline

Create a segment between (aX1, aY1) and (aX2, aY2).

Definition at line 62 of file seg.h.

62  :
63  A( VECTOR2I( aX1, aY1 ) ),
64  B( VECTOR2I( aX2, aY2 ) )
65  {
66  m_index = -1;
67  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
VECTOR2I A
Definition: seg.h:48
int m_index
< index within the parent shape (used when m_is_local == false)
Definition: seg.h:399
VECTOR2I B
Definition: seg.h:49

References m_index.

◆ SEG() [3/5]

SEG::SEG ( const VECTOR2I aA,
const VECTOR2I aB 
)
inline

Create a segment between (aA) and (aB).

Definition at line 72 of file seg.h.

72  :
73  A( aA ),
74  B( aB )
75  {
76  m_index = -1;
77  }
VECTOR2I A
Definition: seg.h:48
int m_index
< index within the parent shape (used when m_is_local == false)
Definition: seg.h:399
VECTOR2I B
Definition: seg.h:49

References m_index.

◆ SEG() [4/5]

SEG::SEG ( const VECTOR2I aA,
const VECTOR2I aB,
int  aIndex 
)
inline

Create a segment between (aA) and (aB), referenced to a multi-segment shape.

Parameters
aAreference to the start point in the parent shape
aBreference to the end point in the parent shape
aIndexindex of the segment within the parent shape

Definition at line 86 of file seg.h.

86  :
87  A( aA ),
88  B( aB )
89  {
90  m_index = aIndex;
91  }
VECTOR2I A
Definition: seg.h:48
int m_index
< index within the parent shape (used when m_is_local == false)
Definition: seg.h:399
VECTOR2I B
Definition: seg.h:49

References m_index.

◆ SEG() [5/5]

SEG::SEG ( const SEG aSeg)
inline

Copy constructor.

Definition at line 96 of file seg.h.

96  :
97  A( aSeg.A ),
98  B( aSeg.B ),
99  m_index( aSeg.m_index )
100  {
101  }
VECTOR2I A
Definition: seg.h:48
int m_index
< index within the parent shape (used when m_is_local == false)
Definition: seg.h:399
VECTOR2I B
Definition: seg.h:49

Member Function Documentation

◆ AngleDegrees()

double SEG::AngleDegrees ( const SEG aOther) const

Determine the smallest angle between two segments (result in degrees)

Parameters
aOtherpoint to determine the orientation wrs to self
Returns
smallest angle between this and aOther (degrees)

Definition at line 61 of file seg.cpp.

62 {
63  VECTOR2I thisVec = A - B;
64  VECTOR2I otherVec = aOther.A - aOther.B;
65 
66  double thisVecAngle = NormalizeAngle180( RAD2DECIDEG( thisVec.Angle() ) );
67  double otherVecAngle = NormalizeAngle180( RAD2DECIDEG( otherVec.Angle() ) );
68  double angleDegrees = std::abs( NormalizeAngle180( thisVecAngle - otherVecAngle ) ) / 10.0;
69 
70  return std::min( 180.0 - angleDegrees, angleDegrees );
71 }
Define a general 2D-vector/point.
Definition: vector2d.h:61
double RAD2DECIDEG(double rad)
Definition: trigo.h:234
T NormalizeAngle180(T Angle)
Normalize angle to be in the -180.0 .. 180.0 range.
Definition: trigo.h:387
double Angle() const
Compute the angle of the vector.
Definition: vector2d.h:307
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, VECTOR2< T >::Angle(), B, NormalizeAngle180(), and RAD2DECIDEG().

◆ ApproxCollinear()

bool SEG::ApproxCollinear ( const SEG aSeg) const
inline

Definition at line 279 of file seg.h.

280  {
281  ecoord p, q, r;
282  CanonicalCoefs( p, q, r );
283 
284  ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
285  ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
286 
287  return std::abs( dist1 ) <= 1 && std::abs( dist2 ) <= 1;
288  }
void CanonicalCoefs(ecoord &qA, ecoord &qB, ecoord &qC) const
Definition: seg.h:255
VECTOR2I::extended_type ecoord
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, B, CanonicalCoefs(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_TRACK::ApproxCollinear().

◆ ApproxParallel()

bool SEG::ApproxParallel ( const SEG aSeg) const
inline

Definition at line 290 of file seg.h.

291  {
292  ecoord p, q, r;
293  CanonicalCoefs( p, q, r );
294 
295  ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
296  ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
297 
298  return std::abs( dist1 - dist2 ) <= 1;
299  }
void CanonicalCoefs(ecoord &qA, ecoord &qB, ecoord &qC) const
Definition: seg.h:255
VECTOR2I::extended_type ecoord
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, B, CanonicalCoefs(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_GRID_HELPER::AlignToSegment(), ApproxPerpendicular(), PNS::MEANDERED_LINE::CheckSelfIntersections(), CIRCLE::ConstructFromTanTanPt(), PNS::DIFF_PAIR::CoupledLength(), PNS::DIFF_PAIR::CoupledSegmentPairs(), PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), PNS::findCoupledVertices(), and SegParallelCorrect().

◆ ApproxPerpendicular()

bool SEG::ApproxPerpendicular ( const SEG aSeg) const
inline

Definition at line 301 of file seg.h.

302  {
303  SEG perp = PerpendicularSeg( A );
304 
305  return aSeg.ApproxParallel( perp );
306  }
SEG PerpendicularSeg(const VECTOR2I &aP) const
Compute a segment perpendicular to this one, passing through point aP.
Definition: seg.cpp:165
bool ApproxParallel(const SEG &aSeg) const
Definition: seg.h:290
Definition: seg.h:40

References ApproxParallel(), and PerpendicularSeg().

Referenced by SegPerpendicularCorrect().

◆ CanonicalCoefs()

void SEG::CanonicalCoefs ( ecoord qA,
ecoord qB,
ecoord qC 
) const
inline

Definition at line 255 of file seg.h.

256  {
257  qA = ecoord{ A.y } - B.y;
258  qB = ecoord{ B.x } - A.x;
259  qC = -qA * A.x - qB * A.y;
260  }
VECTOR2I::extended_type ecoord

Referenced by ApproxCollinear(), ApproxParallel(), and Collinear().

◆ ccw()

bool SEG::ccw ( const VECTOR2I aA,
const VECTOR2I aB,
const VECTOR2I aC 
) const
private

Definition at line 183 of file seg.cpp.

184 {
185  return (ecoord) ( aC.y - aA.y ) * ( aB.x - aA.x ) > (ecoord) ( aB.y - aA.y ) * ( aC.x - aA.x );
186 }
VECTOR2I::extended_type ecoord
Definition: seg.h:43
VECTOR2I::extended_type ecoord

References VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Collide().

◆ Center()

VECTOR2I SEG::Center ( ) const
inline

Definition at line 386 of file seg.h.

387  {
388  return A + ( B - A ) / 2;
389  }
VECTOR2I A
Definition: seg.h:48

References A.

Referenced by PCB_GRID_HELPER::computeAnchors(), SCH_EAGLE_PLUGIN::findNearestLinePoint(), and SHAPE_ARC::SHAPE_ARC().

◆ Collide()

bool SEG::Collide ( const SEG aSeg,
int  aClearance,
int *  aActual = nullptr 
) const

Definition at line 189 of file seg.cpp.

190 {
191  // check for intersection
192  // fixme: move to a method
193  if( ccw( A, aSeg.A, aSeg.B ) != ccw( B, aSeg.A, aSeg.B ) &&
194  ccw( A, B, aSeg.A ) != ccw( A, B, aSeg.B ) )
195  {
196  if( aActual )
197  *aActual = 0;
198 
199  return true;
200  }
201 
202  ecoord dist_sq = VECTOR2I::ECOORD_MAX;
203 
204  dist_sq = std::min( dist_sq, SquaredDistance( aSeg.A ) );
205  dist_sq = std::min( dist_sq, SquaredDistance( aSeg.B ) );
206  dist_sq = std::min( dist_sq, aSeg.SquaredDistance( A ) );
207  dist_sq = std::min( dist_sq, aSeg.SquaredDistance( B ) );
208 
209  if( dist_sq == 0 || dist_sq < (ecoord) aClearance * aClearance )
210  {
211  if( aActual )
212  *aActual = sqrt( dist_sq );
213 
214  return true;
215  }
216 
217  return false;
218 }
bool ccw(const VECTOR2I &aA, const VECTOR2I &aB, const VECTOR2I &aC) const
Definition: seg.cpp:183
ecoord SquaredDistance(const SEG &aSeg) const
Definition: seg.cpp:39
static constexpr extended_type ECOORD_MAX
Definition: vector2d.h:79
VECTOR2I::extended_type ecoord
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, B, ccw(), VECTOR2< T >::ECOORD_MAX, and SquaredDistance().

Referenced by SHAPE_POLY_SET::IsPolygonSelfIntersecting(), SegCollideCorrect(), and BOARD::TestZoneIntersection().

◆ Collinear()

bool SEG::Collinear ( const SEG aSeg) const
inline

Check if segment aSeg lies on the same line as (this).

Parameters
aSegthe segment to check colinearity with
Returns
true, when segments are collinear.

Definition at line 268 of file seg.h.

269  {
270  ecoord qa, qb, qc;
271  CanonicalCoefs( qa, qb, qc );
272 
273  ecoord d1 = std::abs( aSeg.A.x * qa + aSeg.A.y * qb + qc );
274  ecoord d2 = std::abs( aSeg.B.x * qa + aSeg.B.y * qb + qc );
275 
276  return ( d1 <= 1 && d2 <= 1 );
277  }
void CanonicalCoefs(ecoord &qA, ecoord &qB, ecoord &qC) const
Definition: seg.h:255
VECTOR2I::extended_type ecoord
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, B, CanonicalCoefs(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PNS::DP_GATEWAYS::BuildGeneric(), Contains(), SHAPE_LINE_CHAIN::Intersect(), PNS::OPTIMIZER::mergeColinear(), Overlaps(), SegCollinearCorrect(), and POLYGON_GEOM_MANAGER::updateLeaderPoints().

◆ Contains() [1/2]

bool SEG::Contains ( const SEG aSeg) const
inline

Definition at line 331 of file seg.h.

332  {
333  if( aSeg.A == aSeg.B ) // single point corner case
334  return Contains( aSeg.A );
335 
336  if( !Collinear( aSeg ) )
337  return false;
338 
339  if( Contains( aSeg.A ) && Contains( aSeg.B ) )
340  return true;
341 
342  return false;
343  }
bool Collinear(const SEG &aSeg) const
Check if segment aSeg lies on the same line as (this).
Definition: seg.h:268
VECTOR2I A
Definition: seg.h:48
bool Contains(const SEG &aSeg) const
Definition: seg.h:331
VECTOR2I B
Definition: seg.h:49

References A, B, and Collinear().

Referenced by PNS::TOPOLOGY::AssembleTuningPath(), BuildFootprintPolygonOutlines(), PNS::LINE::ChangedArea(), findEndSegments(), SHAPE_LINE_CHAIN::Intersect(), PNS::MEANDERED_LINE::MeanderSegment(), Overlaps(), and PNS::LINE_PLACER::simplifyNewLine().

◆ Contains() [2/2]

bool SEG::Contains ( const VECTOR2I aP) const

Definition at line 221 of file seg.cpp.

222 {
223  return Distance( aP ) <= 1;
224 }
int Distance(const SEG &aSeg) const
Compute minimum Euclidean distance to segment aSeg.
Definition: seg.cpp:285

References Distance().

◆ Distance() [1/2]

int SEG::Distance ( const SEG aSeg) const

Compute minimum Euclidean distance to segment aSeg.

Parameters
aSegother segment
Returns
minimum distance

Definition at line 285 of file seg.cpp.

286 {
287  return KiROUND( sqrt( SquaredDistance( aSeg ) ) );
288 }
ecoord SquaredDistance(const SEG &aSeg) const
Definition: seg.cpp:39
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References KiROUND(), and SquaredDistance().

Referenced by PCB_GRID_HELPER::AlignToSegment(), SHAPE_LINE_CHAIN::CheckClearance(), PNS::checkGap(), Collide(), SHAPE_POLY_SET::CollideEdge(), Contains(), PNS::DIFF_PAIR::CoupledLength(), PNS::DIFF_PAIR::CoupledSegmentPairs(), SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint(), SHAPE_LINE_CHAIN::FindSegment(), SHAPE_LINE_CHAIN::NearestPoint(), SHAPE_LINE_CHAIN::NearestSegment(), SHAPE_LINE_CHAIN::PathLength(), pushoutForce(), SegDistanceCorrect(), SegVecDistanceCorrect(), and SHAPE_LINE_CHAIN::Split().

◆ Distance() [2/2]

int SEG::Distance ( const VECTOR2I aP) const

Compute minimum Euclidean distance to point aP.

Parameters
aPthe point
Returns
minimum distance

Definition at line 291 of file seg.cpp.

292 {
293  return KiROUND( sqrt( SquaredDistance( aP ) ) );
294 }
ecoord SquaredDistance(const SEG &aSeg) const
Definition: seg.cpp:39
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References KiROUND(), and SquaredDistance().

◆ Index()

int SEG::Index ( ) const
inline

Return the index of this segment in its parent shape (applicable only to non-local segments).

Returns
index value

Definition at line 368 of file seg.h.

369  {
370  return m_index;
371  }
int m_index
< index within the parent shape (used when m_is_local == false)
Definition: seg.h:399

References m_index.

Referenced by PNS::OPTIMIZER::mergeDpStep(), PNS::OPTIMIZER::mergeObtuse(), and PNS::OPTIMIZER::mergeStep().

◆ Intersect()

OPT_VECTOR2I SEG::Intersect ( const SEG aSeg,
bool  aIgnoreEndpoints = false,
bool  aLines = false 
) const

Compute intersection point of segment (this) with segment aSeg.

Parameters
aSegsegment to intersect with
aIgnoreEndpointsdon't treat corner cases (i.e. end of one segment touching the other) as intersections.
aLinestreat segments as infinite lines
Returns
intersection point, if exists

Definition at line 154 of file seg.cpp.

155 {
156  VECTOR2I ip;
157 
158  if( intersects( aSeg, aIgnoreEndpoints, aLines, &ip ) )
159  return ip;
160  else
161  return OPT_VECTOR2I();
162 }
Define a general 2D-vector/point.
Definition: vector2d.h:61
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:38
bool intersects(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false, VECTOR2I *aPt=nullptr) const
Definition: seg.cpp:116

References intersects().

Referenced by EC_CONVERGING::Apply(), PNS::LINE::dragSegment45(), ALTIUM_PCB::HelperParseDimensions6Linear(), SHAPE_LINE_CHAIN::Intersect(), IntersectLines(), SCH_EAGLE_PLUGIN::loadSegments(), NearestPoint(), SHAPE_LINE_CHAIN::SelfIntersecting(), and SHAPE_ARC::SHAPE_ARC().

◆ IntersectLines()

OPT_VECTOR2I SEG::IntersectLines ( const SEG aSeg) const
inline

Compute the intersection point of lines passing through ends of (this) and aSeg.

Parameters
aSegsegment defining the line to intersect with
Returns
intersection point, if exists

Definition at line 209 of file seg.h.

210  {
211  return Intersect( aSeg, false, true );
212  }
OPT_VECTOR2I Intersect(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
Compute intersection point of segment (this) with segment aSeg.
Definition: seg.cpp:154

References Intersect().

Referenced by PCB_GRID_HELPER::AlignToSegment(), BuildFootprintPolygonOutlines(), PNS::DP_GATEWAYS::BuildGeneric(), CIRCLE::ConstructFromTanTanPt(), PNS::ConvexHull(), CornerListToPolygon(), EDIT_TOOL::DragArcTrack(), PNS::OPTIMIZER::mergeObtuse(), and PNS::LINE::snapDraggedCorner().

◆ Intersects()

bool SEG::Intersects ( const SEG aSeg) const

Definition at line 148 of file seg.cpp.

149 {
150  return intersects( aSeg );
151 }
bool intersects(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false, VECTOR2I *aPt=nullptr) const
Definition: seg.cpp:116

References intersects().

Referenced by SquaredDistance().

◆ intersects()

bool SEG::intersects ( const SEG aSeg,
bool  aIgnoreEndpoints = false,
bool  aLines = false,
VECTOR2I aPt = nullptr 
) const
private

Definition at line 116 of file seg.cpp.

117 {
118  const VECTOR2I e( B - A );
119  const VECTOR2I f( aSeg.B - aSeg.A );
120  const VECTOR2I ac( aSeg.A - A );
121 
122  ecoord d = f.Cross( e );
123  ecoord p = f.Cross( ac );
124  ecoord q = e.Cross( ac );
125 
126  if( d == 0 )
127  return false;
128 
129  if( !aLines && d > 0 && ( q < 0 || q > d || p < 0 || p > d ) )
130  return false;
131 
132  if( !aLines && d < 0 && ( q < d || p < d || p > 0 || q > 0 ) )
133  return false;
134 
135  if( !aLines && aIgnoreEndpoints && ( q == 0 || q == d ) && ( p == 0 || p == d ) )
136  return false;
137 
138  if( aPt )
139  {
140  *aPt = VECTOR2I( aSeg.A.x + rescale( q, (ecoord) f.x, d ),
141  aSeg.A.y + rescale( q, (ecoord) f.y, d ) );
142  }
143 
144  return true;
145 }
Define a general 2D-vector/point.
Definition: vector2d.h:61
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
VECTOR2I::extended_type ecoord
VECTOR2I A
Definition: seg.h:48
T rescale(T aNumerator, T aValue, T aDenominator)
Scale a number (value) by rational (numerator/denominator).
Definition: util.h:98
VECTOR2I B
Definition: seg.h:49

References A, B, VECTOR2< T >::Cross(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Intersect(), and Intersects().

◆ Length()

◆ LineDistance()

int SEG::LineDistance ( const VECTOR2I aP,
bool  aDetermineSide = false 
) const

Return the closest Euclidean distance between point aP and the line defined by the ends of segment (this).

Parameters
aPthe point to test
aDetermineSidewhen true, the sign of the returned value indicates the side of the line at which we are (negative = left)
Returns
the distance

Definition at line 297 of file seg.cpp.

298 {
299  ecoord p = ecoord{ A.y } - B.y;
300  ecoord q = ecoord{ B.x } - A.x;
301  ecoord r = -p * A.x - q * A.y;
302 
303  ecoord dist = KiROUND( ( p * aP.x + q * aP.y + r ) / sqrt( p * p + q * q ) );
304 
305  return aDetermineSide ? dist : std::abs( dist );
306 }
VECTOR2I::extended_type ecoord
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73

References KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CIRCLE::ConstructFromTanTanPt(), SHAPE_LINE_CHAIN::NearestPoint(), and PNS::LINE::snapToNeighbourSegments().

◆ LineProject()

VECTOR2I SEG::LineProject ( const VECTOR2I aP) const

Compute the perpendicular projection point of aP on a line passing through ends of the segment.

Parameters
aPpoint to project
Returns
projected point

Definition at line 268 of file seg.cpp.

269 {
270  VECTOR2I d = B - A;
271  ecoord l_squared = d.Dot( d );
272 
273  if( l_squared == 0 )
274  return A;
275 
276  ecoord t = d.Dot( aP - A );
277 
278  int xp = rescale( t, ecoord{ d.x }, l_squared );
279  int yp = rescale( t, ecoord{ d.y }, l_squared );
280 
281  return A + VECTOR2I( xp, yp );
282 }
Define a general 2D-vector/point.
Definition: vector2d.h:61
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
VECTOR2I::extended_type ecoord
extended_type Dot(const VECTOR2< T > &aVector) const
Compute dot product of self with aVector.
Definition: vector2d.h:521
VECTOR2I A
Definition: seg.h:48
T rescale(T aNumerator, T aValue, T aDenominator)
Scale a number (value) by rational (numerator/denominator).
Definition: util.h:98

References A, VECTOR2< T >::Dot(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PNS::LINE_PLACER::buildInitialLine(), PNS::DP_GATEWAYS::BuildOrthoProjections(), commonParallelProjection(), PNS::commonParallelProjection(), CIRCLE::ConstructFromTanTanPt(), EDIT_TOOL::DragArcTrack(), PNS::findCoupledVertices(), CIRCLE::IntersectLine(), PNS::DIFF_PAIR_PLACER::routeHead(), SHAPE_ARC::SHAPE_ARC(), and PNS::MEANDER_SHAPE::updateBaseSegment().

◆ NearestPoint() [1/2]

const VECTOR2I SEG::NearestPoint ( const VECTOR2I aP) const

Compute a point on the segment (this) that is closest to point aP.

Returns
the nearest point

Definition at line 227 of file seg.cpp.

228 {
229  VECTOR2I d = B - A;
230  ecoord l_squared = d.Dot( d );
231 
232  if( l_squared == 0 )
233  return A;
234 
235  ecoord t = d.Dot( aP - A );
236 
237  if( t < 0 )
238  return A;
239  else if( t > l_squared )
240  return B;
241 
242  int xp = rescale( t, (ecoord) d.x, l_squared );
243  int yp = rescale( t, (ecoord) d.y, l_squared );
244 
245  return A + VECTOR2I( xp, yp );
246 }
Define a general 2D-vector/point.
Definition: vector2d.h:61
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
VECTOR2I::extended_type ecoord
extended_type Dot(const VECTOR2< T > &aVector) const
Compute dot product of self with aVector.
Definition: vector2d.h:521
VECTOR2I A
Definition: seg.h:48
T rescale(T aNumerator, T aValue, T aDenominator)
Scale a number (value) by rational (numerator/denominator).
Definition: util.h:98
VECTOR2I B
Definition: seg.h:49

References A, B, VECTOR2< T >::Dot(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by PCB_POINT_EDITOR::addCorner(), PNS::closestProjectedPoint(), Collide(), SHAPE_CIRCLE::Collide(), SHAPE_SEGMENT::Collide(), SHAPE_RECT::Collide(), SHAPE_LINE_CHAIN_BASE::Collide(), PNS::cursorDistMinimum(), EDIT_TOOL::DragArcTrack(), NearestPoint(), SHAPE_LINE_CHAIN::NearestPoint(), pushoutForce(), SquaredDistance(), and PNS::LINE::Walkaround().

◆ NearestPoint() [2/2]

const VECTOR2I SEG::NearestPoint ( const SEG aSeg) const

Compute a point on the segment (this) that is closest to any point on aSeg.

Returns
the nearest point

Definition at line 74 of file seg.cpp.

75 {
76  if( OPT_VECTOR2I p = Intersect( aSeg ) )
77  return *p;
78 
79  const VECTOR2I pts_origin[4] =
80  {
81  aSeg.NearestPoint( A ),
82  aSeg.NearestPoint( B ),
83  NearestPoint( aSeg.A ),
84  NearestPoint( aSeg.B )
85  };
86 
87 
88  const VECTOR2I* pts_out[4] =
89  {
90  &A,
91  &B,
92  &pts_origin[2],
93  &pts_origin[3]
94  };
95 
96  const ecoord pts_dist[4] =
97  {
98  ( pts_origin[0] - A ).SquaredEuclideanNorm(),
99  ( pts_origin[1] - B ).SquaredEuclideanNorm(),
100  ( pts_origin[2] - aSeg.A ).SquaredEuclideanNorm(),
101  ( pts_origin[3] - aSeg.B ).SquaredEuclideanNorm()
102  };
103 
104  int min_i = 0;
105 
106  for( int i = 0; i < 4; i++ )
107  {
108  if( pts_dist[i] < pts_dist[min_i] )
109  min_i = i;
110  }
111 
112  return *pts_out[min_i];
113 }
OPT_VECTOR2I Intersect(const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const
Compute intersection point of segment (this) with segment aSeg.
Definition: seg.cpp:154
Define a general 2D-vector/point.
Definition: vector2d.h:61
OPT< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:38
VECTOR2I::extended_type ecoord
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
Definition: seg.cpp:227
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, B, Intersect(), and NearestPoint().

◆ operator!=()

bool SEG::operator!= ( const SEG aSeg) const
inline

Definition at line 117 of file seg.h.

118  {
119  return (A != aSeg.A || B != aSeg.B);
120  }
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, and B.

◆ operator=()

SEG& SEG::operator= ( const SEG aSeg)
inline

Definition at line 103 of file seg.h.

104  {
105  A = aSeg.A;
106  B = aSeg.B;
107  m_index = aSeg.m_index;
108 
109  return *this;
110  }
VECTOR2I A
Definition: seg.h:48
int m_index
< index within the parent shape (used when m_is_local == false)
Definition: seg.h:399
VECTOR2I B
Definition: seg.h:49

References A, B, and m_index.

◆ operator==()

bool SEG::operator== ( const SEG aSeg) const
inline

Definition at line 112 of file seg.h.

113  {
114  return (A == aSeg.A && B == aSeg.B) ;
115  }
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, and B.

◆ Overlaps()

bool SEG::Overlaps ( const SEG aSeg) const
inline

Definition at line 308 of file seg.h.

309  {
310  if( aSeg.A == aSeg.B ) // single point corner case
311  {
312  if( A == aSeg.A || B == aSeg.A )
313  return false;
314 
315  return Contains( aSeg.A );
316  }
317 
318  if( !Collinear( aSeg ) )
319  return false;
320 
321  if( Contains( aSeg.A ) || Contains( aSeg.B ) )
322  return true;
323 
324  if( aSeg.Contains( A ) || aSeg.Contains( B ) )
325  return true;
326 
327  return false;
328  }
bool Collinear(const SEG &aSeg) const
Check if segment aSeg lies on the same line as (this).
Definition: seg.h:268
VECTOR2I A
Definition: seg.h:48
bool Contains(const SEG &aSeg) const
Definition: seg.h:331
VECTOR2I B
Definition: seg.h:49

References A, B, Collinear(), and Contains().

◆ ParallelSeg()

SEG SEG::ParallelSeg ( const VECTOR2I aP) const

Compute a segment parallel to this one, passing through point aP.

Parameters
aPPoint through which the new segment will pass
Returns
SEG parallel to this passing through point aP

Definition at line 174 of file seg.cpp.

175 {
176  VECTOR2I slope( B - A );
177  VECTOR2I endPoint = slope + aP;
178 
179  return SEG( aP, endPoint );
180 }
SEG()
Create an empty (0, 0) segment.
Definition: seg.h:54
Define a general 2D-vector/point.
Definition: vector2d.h:61

References SEG().

Referenced by BOOST_AUTO_TEST_CASE(), and CIRCLE::ConstructFromTanTanPt().

◆ PerpendicularSeg()

SEG SEG::PerpendicularSeg ( const VECTOR2I aP) const

Compute a segment perpendicular to this one, passing through point aP.

Parameters
aPPoint through which the new segment will pass
Returns
SEG perpendicular to this passing through point aP

Definition at line 165 of file seg.cpp.

166 {
167  VECTOR2I slope( B - A );
168  VECTOR2I endPoint = slope.Perpendicular() + aP;
169 
170  return SEG( aP, endPoint );
171 }
VECTOR2< T > Perpendicular() const
Compute the perpendicular vector.
Definition: vector2d.h:314
SEG()
Create an empty (0, 0) segment.
Definition: seg.h:54
Define a general 2D-vector/point.
Definition: vector2d.h:61

References VECTOR2< T >::Perpendicular(), and SEG().

Referenced by ApproxPerpendicular(), BOOST_AUTO_TEST_CASE(), and CIRCLE::ConstructFromTanTanPt().

◆ ReflectPoint()

const VECTOR2I SEG::ReflectPoint ( const VECTOR2I aP) const

Reflect a point using this segment as axis.

Returns
the reflected point

Definition at line 249 of file seg.cpp.

250 {
251  VECTOR2I d = B - A;
252  VECTOR2I::extended_type l_squared = d.Dot( d );
253  VECTOR2I::extended_type t = d.Dot( aP - A );
254  VECTOR2I c;
255 
256  if( !l_squared )
257  c = aP;
258  else
259  {
260  c.x = A.x + rescale( t, static_cast<VECTOR2I::extended_type>( d.x ), l_squared );
261  c.y = A.y + rescale( t, static_cast<VECTOR2I::extended_type>( d.y ), l_squared );
262  }
263 
264  return 2 * c - aP;
265 }
VECTOR2_TRAITS< int >::extended_type extended_type
Definition: vector2d.h:76
Define a general 2D-vector/point.
Definition: vector2d.h:61
extended_type Dot(const VECTOR2< T > &aVector) const
Compute dot product of self with aVector.
Definition: vector2d.h:521
VECTOR2I A
Definition: seg.h:48
T rescale(T aNumerator, T aValue, T aDenominator)
Scale a number (value) by rational (numerator/denominator).
Definition: util.h:98

References A, VECTOR2< T >::Dot(), rescale(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CornerListToPolygon(), SHAPE_ARC::Mirror(), and SHAPE_LINE_CHAIN::Mirror().

◆ Reverse()

void SEG::Reverse ( )
inline

Definition at line 375 of file seg.h.

376  {
377  std::swap( A, B );
378  }

◆ Reversed()

SEG SEG::Reversed ( ) const
inline

Returns the center point of the line.

Definition at line 380 of file seg.h.

References SEG().

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

◆ Side()

int SEG::Side ( const VECTOR2I aP) const
inline

Determine on which side of directed line passing via segment ends point aP lies.

Parameters
aPpoint to determine the orientation wrs to self
Returns
: < 0: left, 0 : on the line, > 0 : right

Definition at line 142 of file seg.h.

143  {
144  const ecoord det = ( B - A ).Cross( aP - A );
145 
146  return det < 0 ? -1 : ( det > 0 ? 1 : 0 );
147  }
VECTOR2I::extended_type ecoord
VECTOR2I A
Definition: seg.h:48

References A.

Referenced by PNS::ArcHull(), PNS::DP_GATEWAYS::buildDpContinuation(), CornerListToPolygon(), EDIT_TOOL::DragArcTrack(), PNS::DP_MEANDER_PLACER::pairOrientation(), and PNS::SegmentHull().

◆ Square()

◆ SquaredDistance() [1/2]

SEG::ecoord SEG::SquaredDistance ( const SEG aSeg) const

Definition at line 39 of file seg.cpp.

40 {
41  if( Intersects( aSeg ) )
42  return 0;
43 
44  const VECTOR2I pts[4] =
45  {
46  aSeg.NearestPoint( A ) - A,
47  aSeg.NearestPoint( B ) - B,
48  NearestPoint( aSeg.A ) - aSeg.A,
49  NearestPoint( aSeg.B ) - aSeg.B
50  };
51 
53 
54  for( int i = 0; i < 4; i++ )
55  m = std::min( m, pts[i].SquaredEuclideanNorm() );
56 
57  return m;
58 }
bool Intersects(const SEG &aSeg) const
Definition: seg.cpp:148
Define a general 2D-vector/point.
Definition: vector2d.h:61
static constexpr extended_type ECOORD_MAX
Definition: vector2d.h:79
VECTOR2I::extended_type ecoord
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
Definition: seg.cpp:227
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

References A, B, VECTOR2< T >::ECOORD_MAX, Intersects(), and NearestPoint().

Referenced by PNS::MOUSE_TRAIL_TRACER::AddTrailPoint(), PNS::PRESERVE_VERTEX_CONSTRAINT::Check(), SHAPE_SEGMENT::Collide(), SHAPE_RECT::Collide(), SHAPE_ARC::Collide(), Collide(), SHAPE_LINE_CHAIN_BASE::Collide(), Distance(), SHAPE_LINE_CHAIN_BASE::SquaredDistance(), and TestSegmentHit().

◆ SquaredDistance() [2/2]

ecoord SEG::SquaredDistance ( const VECTOR2I aP) const
inline

Definition at line 242 of file seg.h.

243  {
244  return ( NearestPoint( aP ) - aP ).SquaredEuclideanNorm();
245  }
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
Definition: seg.cpp:227

References NearestPoint().

◆ SquaredLength()

ecoord SEG::SquaredLength ( ) const
inline

Definition at line 355 of file seg.h.

356  {
357  return ( A - B ).SquaredEuclideanNorm();
358  }

Referenced by commonParallelProjection(), PNS::commonParallelProjection(), PNS::OPTIMIZER::mergeColinear(), and POLYGON_GEOM_MANAGER::updateLeaderPoints().

◆ TCoef()

SEG::ecoord SEG::TCoef ( const VECTOR2I aP) const
inline

Definition at line 402 of file seg.h.

403 {
404  VECTOR2I d = B - A;
405  return d.Dot( aP - A);
406 }
Define a general 2D-vector/point.
Definition: vector2d.h:61
extended_type Dot(const VECTOR2< T > &aVector) const
Compute dot product of self with aVector.
Definition: vector2d.h:521
VECTOR2I A
Definition: seg.h:48

References A, and VECTOR2< T >::Dot().

Referenced by commonParallelProjection(), and PNS::commonParallelProjection().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  aStream,
const SEG aSeg 
)
friend

Definition at line 408 of file seg.h.

409 {
410  aStream << "[ " << aSeg.A << " - " << aSeg.B << " ]";
411 
412  return aStream;
413 }
VECTOR2I A
Definition: seg.h:48
VECTOR2I B
Definition: seg.h:49

Member Data Documentation

◆ A

VECTOR2I SEG::A

Definition at line 48 of file seg.h.

Referenced by PNS::NODE::Add(), PNS_KICAD_IFACE::AddItem(), PNS_TEST_DEBUG_DECORATOR::AddSegment(), PNS::NODE::addSegment(), PNS_PCBNEW_DEBUG_DECORATOR::AddSegment(), BOARD_ADAPTER::addShapeWithClearance(), PCB_GRID_HELPER::AlignToSegment(), PNS::SEGMENT::Anchor(), AngleDegrees(), ApproxCollinear(), PNS::ApproximateSegmentAsRect(), ApproxParallel(), PNS::DP_MEANDER_PLACER::baselineSegment(), SHAPE_SEGMENT::BBox(), BOOST_AUTO_TEST_CASE(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), Center(), SHAPE_LINE_CHAIN::CheckClearance(), PNS::DRAGGER::checkVirtualVia(), PNS::SEGMENT::CLine(), SHAPE_RECT::Collide(), SHAPE_ARC::Collide(), Collide(), SHAPE_LINE_CHAIN_BASE::Collide(), Collinear(), commonParallelProjection(), PNS::commonParallelProjection(), PCB_GRID_HELPER::computeAnchors(), PNS::TOPOLOGY::ConnectedJoints(), CIRCLE::ConstructFromTanTanPt(), Contains(), BOARD_ADAPTER::createPadWithClearance(), BOARD_ADAPTER::createPadWithDrill(), PNS::cursorDistMinimum(), PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), PNS::MEANDER_PLACER_BASE::cutTunedLine(), DIRECTION_45::DIRECTION_45(), PNS::MEANDER_PLACER::doMove(), EDIT_TOOL::DragArcTrack(), PNS::LINE::dragSegment45(), KIGFX::PCB_PAINTER::draw(), ROUTER_PREVIEW_ITEM::drawLineChain(), KI_TEST::DrawSegment(), ROUTER_PREVIEW_ITEM::drawShape(), SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint(), extractDiffPairCoupledItems(), findEndSegments(), PNS::NODE::findRedundantSegment(), PNS::MEANDER_SHAPE::Fit(), SHAPE_SEGMENT::Format(), PNS::getDanglingAnchor(), PNS::LINE_PLACER::handlePullback(), PNS::LINE_PLACER::handleSelfIntersections(), ZONE::HatchBorder(), PNS::HullIntersection(), CIRCLE::Intersect(), SHAPE_LINE_CHAIN::Intersect(), CIRCLE::IntersectLine(), intersects(), PNS::LINE::Is45Degree(), KIGFX::VIEW_OVERLAY::Line(), LineProject(), CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices(), PNS::MEANDER_SHAPE::MakeCorner(), PCB_SHAPE::MakeEffectiveShapes(), PNS::MEANDER_SHAPE::MakeEmpty(), PNS::MEANDERED_LINE::MeanderSegment(), PNS::OPTIMIZER::mergeDpStep(), PNS::OPTIMIZER::mergeObtuse(), PNS::OPTIMIZER::mergeStep(), ZONE::Mirror(), SHAPE_SEGMENT::Move(), ZONE::Move(), PNS::MoveDiagonal(), NearestPoint(), operator!=(), POLY_GRID_PARTITION::segsEqual::operator()(), POLY_GRID_PARTITION::segHash::operator()(), operator<<(), operator=(), operator==(), Overlaps(), DIALOG_PAD_PROPERTIES::padValuesOK(), PNS::DP_MEANDER_PLACER::pairOrientation(), SHAPE_LINE_CHAIN::PathLength(), BRDITEMS_PLOTTER::PlotDimension(), PlotLayerOutlines(), SHAPE_LINE_CHAIN::PointAlong(), PNS::MEANDER_SHAPE::Recalculate(), PNS::LINE_PLACER::reduceTail(), ReflectPoint(), PNS::NODE::removeSegmentIndex(), ZONE::Rotate(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), POLY_GRID_PARTITION::scanCell(), PCB_DIMENSION_BASE::segCircleIntersection(), GEOM_TEST::SegmentCompletelyInQuadrant(), GEOM_TEST::SegmentCompletelyWithinRadius(), GEOM_TEST::SegmentEndsInQuadrant(), PNS::SegmentHull(), PCB_DIMENSION_BASE::segPolyIntersection(), SHAPE_LINE_CHAIN::SelfIntersecting(), SHAPE_ARC::SHAPE_ARC(), Side(), PNS::LINE::snapToNeighbourSegments(), SHAPE_LINE_CHAIN::Split(), PNS::LINE_PLACER::SplitAdjacentSegments(), SquaredDistance(), SHAPE_POLY_SET::SquaredDistanceToPolygon(), PNS::LINE_PLACER::Start(), PNS::DRAGGER::startDragSegment(), PNS::SEGMENT::SwapEnds(), TCoef(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), PNS::tightenSegment(), PAD::TransformHoleWithClearanceToPolygon(), unfracture(), SHAPE_POLY_SET::unfractureSingle(), PNS::MEANDER_SHAPE::updateBaseSegment(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), and PNS_KICAD_IFACE::UpdateItem().

◆ B

VECTOR2I SEG::B

Definition at line 49 of file seg.h.

Referenced by PNS::NODE::Add(), PNS_KICAD_IFACE::AddItem(), PNS::MEANDERED_LINE::AddMeander(), PNS_TEST_DEBUG_DECORATOR::AddSegment(), PNS::NODE::addSegment(), PNS_PCBNEW_DEBUG_DECORATOR::AddSegment(), BOARD_ADAPTER::addShapeWithClearance(), PCB_GRID_HELPER::AlignToSegment(), PNS::SEGMENT::Anchor(), AngleDegrees(), ApproxCollinear(), PNS::ApproximateSegmentAsRect(), ApproxParallel(), PNS::DP_MEANDER_PLACER::baselineSegment(), SHAPE_SEGMENT::BBox(), BOOST_AUTO_TEST_CASE(), POLY_GRID_PARTITION::build(), PNS::DP_GATEWAYS::BuildFromPrimitivePair(), SHAPE_LINE_CHAIN::CheckClearance(), PNS::DRAGGER::checkVirtualVia(), PNS::SEGMENT::CLine(), SHAPE_RECT::Collide(), SHAPE_ARC::Collide(), Collide(), Collinear(), commonParallelProjection(), PNS::commonParallelProjection(), PCB_GRID_HELPER::computeAnchors(), PNS::TOPOLOGY::ConnectedJoints(), CIRCLE::ConstructFromTanTanPt(), Contains(), BOARD_ADAPTER::createPadWithClearance(), BOARD_ADAPTER::createPadWithDrill(), PNS::cursorDistMinimum(), PNS::DP_PRIMITIVE_PAIR::CursorOrientation(), PNS::MEANDER_PLACER_BASE::cutTunedLine(), DIRECTION_45::DIRECTION_45(), PNS::MEANDER_PLACER::doMove(), EDIT_TOOL::DragArcTrack(), PNS::LINE::dragSegment45(), KIGFX::PCB_PAINTER::draw(), ROUTER_PREVIEW_ITEM::drawLineChain(), KI_TEST::DrawSegment(), ROUTER_PREVIEW_ITEM::drawShape(), SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint(), PNS::MEANDER_SHAPE::End(), findEndSegments(), SCH_EAGLE_PLUGIN::findNearestLinePoint(), PNS::NODE::findRedundantSegment(), PNS::MEANDER_SHAPE::Fit(), SHAPE_SEGMENT::Format(), PNS::getDanglingAnchor(), ZONE::HatchBorder(), PNS::HullIntersection(), CIRCLE::Intersect(), SHAPE_LINE_CHAIN::Intersect(), CIRCLE::IntersectLine(), intersects(), PNS::LINE::Is45Degree(), KIGFX::VIEW_OVERLAY::Line(), CADSTAR_SCH_ARCHIVE_LOADER::loadShapeVertices(), PNS::MEANDER_SHAPE::MakeCorner(), PCB_SHAPE::MakeEffectiveShapes(), PNS::MEANDER_SHAPE::MakeEmpty(), PNS::MEANDERED_LINE::MeanderSegment(), PNS::OPTIMIZER::mergeDpStep(), PNS::LINE_PLACER::mergeHead(), PNS::OPTIMIZER::mergeObtuse(), PNS::OPTIMIZER::mergeStep(), ZONE::Mirror(), SHAPE_SEGMENT::Move(), ZONE::Move(), PNS::MoveDiagonal(), NearestPoint(), operator!=(), POLY_GRID_PARTITION::segsEqual::operator()(), POLY_GRID_PARTITION::segHash::operator()(), operator<<(), operator=(), operator==(), Overlaps(), DIALOG_PAD_PROPERTIES::padValuesOK(), BRDITEMS_PLOTTER::PlotDimension(), PlotLayerOutlines(), SHAPE_LINE_CHAIN::PointAlong(), PNS::MEANDER_SHAPE::Recalculate(), PNS::NODE::removeSegmentIndex(), ZONE::Rotate(), DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run(), POLY_GRID_PARTITION::scanCell(), PCB_DIMENSION_BASE::segCircleIntersection(), GEOM_TEST::SegmentCompletelyInQuadrant(), GEOM_TEST::SegmentCompletelyWithinRadius(), GEOM_TEST::SegmentEndsInQuadrant(), PNS::SegmentHull(), PCB_DIMENSION_BASE::segPolyIntersection(), SHAPE_LINE_CHAIN::SelfIntersecting(), SHAPE_ARC::SHAPE_ARC(), SHAPE_LINE_CHAIN::Split(), PNS::LINE_PLACER::SplitAdjacentSegments(), SquaredDistance(), SHAPE_POLY_SET::SquaredDistanceToPolygon(), PNS::LINE_PLACER::Start(), PNS::DRAGGER::startDragSegment(), PNS::SEGMENT::SwapEnds(), DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones(), PNS::tightenSegment(), PAD::TransformHoleWithClearanceToPolygon(), unfracture(), SHAPE_POLY_SET::unfractureSingle(), PNS::MEANDER_SHAPE::updateBaseSegment(), PCB_DIM_ALIGNED::updateGeometry(), PCB_DIM_ORTHOGONAL::updateGeometry(), PNS_KICAD_IFACE::UpdateItem(), and POLYGON_GEOM_MANAGER::updateLeaderPoints().

◆ m_index

int SEG::m_index
private

< index within the parent shape (used when m_is_local == false)

Definition at line 399 of file seg.h.

Referenced by Index(), operator=(), and SEG().


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