| 
    KiCad PCB EDA Suite
    
   | 
 
The geometry of a single meander. More...
#include <pns_meander.h>
Public Member Functions | |
| MEANDER_SHAPE (MEANDER_PLACER_BASE *aPlacer, int aWidth, bool aIsDual=false) | |
| void | SetType (MEANDER_TYPE aType) | 
| Set the type of the meander.   | |
| MEANDER_TYPE | Type () const | 
| void | SetBaseIndex (int aIndex) | 
| Set an auxiliary index of the segment being meandered in its original LINE.   | |
| int | BaseIndex () const | 
| int | Amplitude () const | 
| void | MakeCorner (const VECTOR2I &aP1, const VECTOR2I &aP2=VECTOR2I(0, 0)) | 
| Create a dummy meander shape representing a line corner.   | |
| void | MakeArc (const SHAPE_ARC &aArc1, const SHAPE_ARC &aArc2=SHAPE_ARC()) | 
| Create a dummy meander shape representing an arc corner.   | |
| void | Resize (int aAmpl) | 
| Change the amplitude of the meander shape to aAmpl and recalculates the resulting line chain.   | |
| void | Recalculate () | 
| Recalculate the line chain representing the meander's shape.   | |
| bool | IsDual () const | 
| bool | Side () const | 
| VECTOR2I | End () const | 
| const SHAPE_LINE_CHAIN & | CLine (int aShape) const | 
| void | MakeEmpty () | 
| Replace the meander with straight bypass line(s), effectively clearing it.   | |
| bool | Fit (MEANDER_TYPE aType, const SEG &aSeg, const VECTOR2I &aP, bool aSide) | 
| Attempt to fit a meander of a given type onto a segment, avoiding collisions with other board features.   | |
| const SEG & | BaseSegment () const | 
| Return the base segment the meander was fitted to.   | |
| int | BaselineLength () const | 
| long long int | CurrentLength () const | 
| long long int | MinTunableLength () const | 
| int | MinAmplitude () const | 
| const MEANDER_SETTINGS & | Settings () const | 
| int | Width () const | 
| void | SetBaselineOffset (int aOffset) | 
| Set the parallel offset between the base segment and the meandered line.   | |
| void | SetTargetBaselineLength (int aLength) | 
| Sets the target length of the baseline.   | |
Private Member Functions | |
| void | start (SHAPE_LINE_CHAIN *aTarget, const VECTOR2D &aWhere, const VECTOR2D &aDir) | 
| Move turtle forward by aLength.   | |
| void | forward (int aLength) | 
| Turn the turtle by aAngle.   | |
| void | turn (const EDA_ANGLE &aAngle) | 
| Tell the turtle to draw a mitered corner of given radius and turn direction.   | |
| void | miter (int aRadius, bool aSide) | 
| Tell the turtle to draw an U-like shape.   | |
| void | uShape (int aSides, int aCorner, int aTop) | 
| Generate a 90-degree circular arc.   | |
| SHAPE_LINE_CHAIN | makeMiterShape (const VECTOR2D &aP, const VECTOR2D &aDir, bool aSide) | 
| Produce a meander shape of given type.   | |
| SHAPE_LINE_CHAIN | genMeanderShape (const VECTOR2D &aP, const VECTOR2D &aDir, bool aSide, MEANDER_TYPE aType, int aBaselineOffset=0) | 
| Recalculate the clipped baseline after the parameters of the meander have been changed.   | |
| void | updateBaseSegment () | 
| Return sanitized corner radius value.   | |
| int | cornerRadius () const | 
| Return sanitized spacing value.   | |
| int | spacing () const | 
| The type of meander.   | |
Private Attributes | |
| MEANDER_TYPE | m_type | 
| The placer that placed this meander.   | |
| MEANDER_PLACER_BASE * | m_placer | 
| Dual or single line.   | |
| bool | m_dual | 
| Width of the line.   | |
| int | m_width | 
| Amplitude of the meander.   | |
| int | m_amplitude | 
| Offset wrs the base segment (dual only).   | |
| int | m_baselineOffset | 
| Average radius of meander corners (for correction of DP meanders).   | |
| int | m_meanCornerRadius | 
| Minimum length of the base segment to target when resizing.   | |
| int | m_targetBaseLen | 
| First point of the meandered line.   | |
| VECTOR2I | m_p0 | 
| Base segment (unclipped).   | |
| SEG | m_baseSeg | 
| Base segment (clipped).   | |
| SEG | m_clippedBaseSeg | 
| Side (true = right).   | |
| bool | m_side | 
| The actual shapes (0 used for single, both for dual).   | |
| SHAPE_LINE_CHAIN | m_shapes [2] | 
| Index of the meandered segment in the base line.   | |
| int | m_baseIndex | 
| The current turtle direction.   | |
| VECTOR2D | m_currentDir | 
| The current turtle position.   | |
| VECTOR2D | m_currentPos | 
| The line the turtle is drawing on.   | |
| SHAPE_LINE_CHAIN * | m_currentTarget | 
Friends | |
| class | MEANDERED_LINE | 
| Start turtle drawing.   | |
The geometry of a single meander.
Definition at line 149 of file pns_meander.h.
      
  | 
  inline | 
| aPlacer | the meander placer instance. | 
| aWidth | width of the meandered line. | 
| aIsDual | when true, the shape contains two meandered lines at a given offset (diff pairs). | 
Definition at line 158 of file pns_meander.h.
References m_amplitude, m_baseIndex, m_baselineOffset, m_currentTarget, m_dual, m_meanCornerRadius, m_placer, m_side, m_targetBaseLen, m_type, m_width, and PNS::MT_SINGLE.
Referenced by Fit(), and MinTunableLength().
      
  | 
  inline | 
Definition at line 209 of file pns_meander.h.
References m_amplitude.
Referenced by PNS::findAmplitudeForLength(), and Fit().
      
  | 
  inline | 
Definition at line 201 of file pns_meander.h.
References m_baseIndex.
| int PNS::MEANDER_SHAPE::BaselineLength | ( | ) | const | 
Definition at line 878 of file pns_meander.cpp.
References m_clippedBaseSeg.
Referenced by PNS::findAmplitudeForLength(), and MinTunableLength().
      
  | 
  inline | 
Return the base segment the meander was fitted to.
Definition at line 299 of file pns_meander.h.
References m_clippedBaseSeg.
Referenced by PNS::MEANDERED_LINE::AddMeander(), and PNS::MEANDERED_LINE::CheckSelfIntersections().
      
  | 
  inline | 
Definition at line 272 of file pns_meander.h.
References m_shapes.
Referenced by PNS::DP_MEANDER_PLACER::CheckFit(), PNS::MEANDER_PLACER::CheckFit(), PNS::MEANDERED_LINE::CheckSelfIntersections(), CurrentLength(), and updateBaseSegment().
      
  | 
  private | 
Return sanitized spacing value.
Definition at line 368 of file pns_meander.cpp.
References std::abs(), DEG2RAD(), m_amplitude, m_baselineOffset, PNS::MEANDER_SETTINGS::m_cornerRadiusPercentage, m_placer, m_width, PNS::MEANDER_STYLE_ROUND, Settings(), and spacing().
Referenced by genMeanderShape(), and PNS::MEANDERED_LINE::MeanderSegment().
| long long int PNS::MEANDER_SHAPE::CurrentLength | ( | ) | const | 
Definition at line 884 of file pns_meander.cpp.
References CLine(), and SHAPE_LINE_CHAIN::Length().
Referenced by PNS::findAmplitudeBinarySearch(), and PNS::findAmplitudeForLength().
      
  | 
  inline | 
Definition at line 264 of file pns_meander.h.
References m_clippedBaseSeg.
Referenced by Fit().
| bool PNS::MEANDER_SHAPE::Fit | ( | MEANDER_TYPE | aType, | 
| const SEG & | aSeg, | ||
| const VECTOR2I & | aP, | ||
| bool | aSide ) | 
Attempt to fit a meander of a given type onto a segment, avoiding collisions with other board features.
| aType | type of meander shape. | 
| aSeg | base segment for meandering. | 
| aP | start point of the meander. | 
| aSide | side of aSeg to put the meander on (true = right). | 
Definition at line 671 of file pns_meander.cpp.
References SEG::A, Amplitude(), SEG::B, End(), Fit(), genMeanderShape(), m2, m_amplitude, m_baseIndex, m_baselineOffset, m_baseSeg, m_dual, PNS::MEANDER_SETTINGS::m_maxAmplitude, m_p0, m_placer, m_shapes, m_side, PNS::MEANDER_SETTINGS::m_step, m_type, m_width, MEANDER_SHAPE(), MinAmplitude(), PNS::MT_CHECK_FINISH, PNS::MT_CHECK_START, PNS::MT_EMPTY, PNS::MT_FINISH, PNS::MT_START, PNS::MT_TURN, SetBaselineOffset(), Settings(), and updateBaseSegment().
Referenced by Fit(), and PNS::MEANDERED_LINE::MeanderSegment().
      
  | 
  private | 
Turn the turtle by aAngle.
Definition at line 479 of file pns_meander.cpp.
References m_currentDir, m_currentPos, and m_currentTarget.
Referenced by genMeanderShape(), and uShape().
      
  | 
  private | 
Recalculate the clipped baseline after the parameters of the meander have been changed.
Definition at line 524 of file pns_meander.cpp.
References std::abs(), ANGLE_90, SHAPE_LINE_CHAIN::Append(), cornerRadius(), forward(), m_amplitude, m_currentTarget, m_meanCornerRadius, m_targetBaseLen, SHAPE_LINE_CHAIN::Mirror(), miter(), PNS::MT_EMPTY, PNS::MT_FINISH, PNS::MT_SINGLE, PNS::MT_START, PNS::MT_TURN, VECTOR2< T >::Perpendicular(), VECTOR2< T >::Resize(), spacing(), start(), turn(), and uShape().
Referenced by Fit(), MakeEmpty(), and Recalculate().
      
  | 
  inline | 
Definition at line 248 of file pns_meander.h.
References m_dual.
Create a dummy meander shape representing an arc corner.
Allows representing existing arc tracks so they can be reconstructed after length tuning.
| aArc1 | Arc shape on the 1st line. | 
| aArc2 | Arc shape on the 2nd line (if m_dual == true). | 
Definition at line 850 of file pns_meander.cpp.
References SHAPE_ARC::GetP1(), m_clippedBaseSeg, m_shapes, PNS::MT_CORNER, and SetType().
Referenced by PNS::MEANDERED_LINE::AddArc().
| void PNS::MEANDER_SHAPE::MakeCorner | ( | const VECTOR2I & | aP1, | 
| const VECTOR2I & | aP2 = VECTOR2I( 0, 0 ) ) | 
Create a dummy meander shape representing a line corner.
Used to define the starts/ends of meandered segments.
| aP1 | corner point of the 1st line. | 
| aP2 | corner point of the 2nd line (if m_dual == true). | 
Definition at line 838 of file pns_meander.cpp.
References m_clippedBaseSeg, m_shapes, PNS::MT_CORNER, and SetType().
Referenced by PNS::MEANDERED_LINE::AddCorner().
| void PNS::MEANDER_SHAPE::MakeEmpty | ( | ) | 
Replace the meander with straight bypass line(s), effectively clearing it.
Definition at line 784 of file pns_meander.cpp.
References genMeanderShape(), m_amplitude, m_baselineOffset, m_clippedBaseSeg, m_dual, m_p0, m_shapes, m_side, m_type, PNS::MT_EMPTY, and updateBaseSegment().
      
  | 
  private | 
Produce a meander shape of given type.
Definition at line 409 of file pns_meander.cpp.
References ANGLE_90, SHAPE_LINE_CHAIN::Append(), SHAPE_ARC::ConstructFromStartEndAngle(), correction, DEG2RAD(), VECTOR2< T >::EuclideanNorm(), m_baselineOffset, m_dual, m_meanCornerRadius, m_placer, PNS::MEANDER_STYLE_CHAMFER, PNS::MEANDER_STYLE_ROUND, VECTOR2< T >::Perpendicular(), radius, VECTOR2< T >::Resize(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by miter().
| int PNS::MEANDER_SHAPE::MinAmplitude | ( | ) | const | 
Definition at line 350 of file pns_meander.cpp.
References std::abs(), correction, DEG2RAD(), m_baselineOffset, PNS::MEANDER_SETTINGS::m_minAmplitude, m_placer, m_width, PNS::MEANDER_STYLE_ROUND, and Settings().
Referenced by Fit().
| long long int PNS::MEANDER_SHAPE::MinTunableLength | ( | ) | const | 
Definition at line 890 of file pns_meander.cpp.
References BaselineLength(), copy, and MEANDER_SHAPE().
      
  | 
  private | 
Tell the turtle to draw an U-like shape.
Definition at line 496 of file pns_meander.cpp.
References ANGLE_90, SHAPE_LINE_CHAIN::CLastPoint(), m_currentDir, m_currentPos, m_currentTarget, makeMiterShape(), and turn().
Referenced by genMeanderShape(), and uShape().
| void PNS::MEANDER_SHAPE::Recalculate | ( | ) | 
Recalculate the line chain representing the meander's shape.
Definition at line 760 of file pns_meander.cpp.
References genMeanderShape(), m_baselineOffset, m_baseSeg, m_dual, m_p0, m_shapes, m_side, m_type, and updateBaseSegment().
Referenced by Resize().
| void PNS::MEANDER_SHAPE::Resize | ( | int | aAmpl | ) | 
Change the amplitude of the meander shape to aAmpl and recalculates the resulting line chain.
| aAmpl | new amplitude. | 
Definition at line 773 of file pns_meander.cpp.
References m_amplitude, and Recalculate().
Referenced by PNS::findAmplitudeBinarySearch().
      
  | 
  inline | 
Set an auxiliary index of the segment being meandered in its original LINE.
Definition at line 193 of file pns_meander.h.
References m_baseIndex.
Referenced by PNS::MEANDERED_LINE::MeanderSegment().
      
  | 
  inline | 
Set the parallel offset between the base segment and the meandered line.
Used for dual meanders (diff pair) only.
| aOffset | the offset. | 
Definition at line 343 of file pns_meander.h.
References m_baselineOffset.
Referenced by Fit(), and PNS::MEANDERED_LINE::MeanderSegment().
      
  | 
  inline | 
Sets the target length of the baseline.
When resizing, the meander will try to fit the baseline length into the specified value.
| aLength | the minimum baseline length. | 
Definition at line 354 of file pns_meander.h.
References m_targetBaseLen.
| const MEANDER_SETTINGS & PNS::MEANDER_SHAPE::Settings | ( | ) | const | 
Definition at line 179 of file pns_meander.cpp.
References m_placer.
Referenced by cornerRadius(), Fit(), MinAmplitude(), and spacing().
      
  | 
  inline | 
Set the type of the meander.
Definition at line 177 of file pns_meander.h.
References m_type.
Referenced by MakeArc(), and MakeCorner().
      
  | 
  inline | 
Definition at line 256 of file pns_meander.h.
References m_side.
      
  | 
  private | 
The type of meander.
Definition at line 395 of file pns_meander.cpp.
References std::abs(), m_baselineOffset, m_dual, m_placer, m_width, and Settings().
Referenced by cornerRadius(), genMeanderShape(), and PNS::MEANDERED_LINE::MeanderSegment().
      
  | 
  private | 
Move turtle forward by aLength.
Definition at line 469 of file pns_meander.cpp.
References m_currentDir, m_currentPos, and m_currentTarget.
Referenced by genMeanderShape().
      
  | 
  private | 
Tell the turtle to draw a mitered corner of given radius and turn direction.
Definition at line 490 of file pns_meander.cpp.
References m_currentDir, and RotatePoint().
Referenced by genMeanderShape(), and miter().
      
  | 
  inline | 
Definition at line 185 of file pns_meander.h.
References m_type.
Referenced by PNS::MEANDERED_LINE::CheckSelfIntersections().
      
  | 
  private | 
Return sanitized corner radius value.
Definition at line 901 of file pns_meander.cpp.
References SHAPE_LINE_CHAIN::CLastPoint(), CLine(), SHAPE_LINE_CHAIN::CPoint(), m_baseSeg, m_clippedBaseSeg, and m_dual.
Referenced by Fit(), MakeEmpty(), and Recalculate().
      
  | 
  private | 
Generate a 90-degree circular arc.
Definition at line 514 of file pns_meander.cpp.
References forward(), and miter().
Referenced by genMeanderShape().
      
  | 
  inline | 
Definition at line 332 of file pns_meander.h.
References m_width.
Referenced by PNS::DP_MEANDER_PLACER::CheckFit(), and PNS::MEANDER_PLACER::CheckFit().
      
  | 
  friend | 
Start turtle drawing.
Definition at line 357 of file pns_meander.h.
References MEANDERED_LINE.
Referenced by MEANDERED_LINE.
      
  | 
  private | 
Offset wrs the base segment (dual only).
Definition at line 403 of file pns_meander.h.
Referenced by Amplitude(), cornerRadius(), Fit(), genMeanderShape(), MakeEmpty(), MEANDER_SHAPE(), and Resize().
      
  | 
  private | 
The current turtle direction.
Definition at line 430 of file pns_meander.h.
Referenced by BaseIndex(), Fit(), MEANDER_SHAPE(), and SetBaseIndex().
      
  | 
  private | 
Average radius of meander corners (for correction of DP meanders).
Definition at line 406 of file pns_meander.h.
Referenced by cornerRadius(), Fit(), MakeEmpty(), makeMiterShape(), MEANDER_SHAPE(), MinAmplitude(), Recalculate(), SetBaselineOffset(), and spacing().
      
  | 
  private | 
Base segment (clipped).
Definition at line 418 of file pns_meander.h.
Referenced by Fit(), Recalculate(), and updateBaseSegment().
      
  | 
  private | 
Side (true = right).
Definition at line 421 of file pns_meander.h.
Referenced by BaselineLength(), BaseSegment(), End(), MakeArc(), MakeCorner(), MakeEmpty(), and updateBaseSegment().
      
  | 
  private | 
      
  | 
  private | 
The line the turtle is drawing on.
Definition at line 436 of file pns_meander.h.
      
  | 
  private | 
Definition at line 439 of file pns_meander.h.
Referenced by forward(), genMeanderShape(), MEANDER_SHAPE(), miter(), and start().
      
  | 
  private | 
Width of the line.
Definition at line 397 of file pns_meander.h.
Referenced by Fit(), IsDual(), MakeEmpty(), makeMiterShape(), MEANDER_SHAPE(), Recalculate(), spacing(), and updateBaseSegment().
      
  | 
  private | 
Minimum length of the base segment to target when resizing.
Definition at line 409 of file pns_meander.h.
Referenced by genMeanderShape(), makeMiterShape(), and MEANDER_SHAPE().
      
  | 
  private | 
Base segment (unclipped).
Definition at line 415 of file pns_meander.h.
Referenced by Fit(), MakeEmpty(), and Recalculate().
      
  | 
  private | 
Dual or single line.
Definition at line 394 of file pns_meander.h.
Referenced by cornerRadius(), Fit(), makeMiterShape(), MEANDER_SHAPE(), MinAmplitude(), Settings(), and spacing().
      
  | 
  private | 
Index of the meandered segment in the base line.
Definition at line 427 of file pns_meander.h.
Referenced by CLine(), Fit(), MakeArc(), MakeCorner(), MakeEmpty(), and Recalculate().
      
  | 
  private | 
The actual shapes (0 used for single, both for dual).
Definition at line 424 of file pns_meander.h.
Referenced by Fit(), MakeEmpty(), MEANDER_SHAPE(), Recalculate(), and Side().
      
  | 
  private | 
First point of the meandered line.
Definition at line 412 of file pns_meander.h.
Referenced by genMeanderShape(), MEANDER_SHAPE(), and SetTargetBaselineLength().
      
  | 
  private | 
The placer that placed this meander.
Definition at line 391 of file pns_meander.h.
Referenced by Fit(), MakeEmpty(), MEANDER_SHAPE(), Recalculate(), SetType(), and Type().
      
  | 
  private | 
Amplitude of the meander.
Definition at line 400 of file pns_meander.h.
Referenced by cornerRadius(), Fit(), MEANDER_SHAPE(), MinAmplitude(), spacing(), and Width().