32 startDiagonal = aStartDiagonal;
36 int w = abs( aP1.
x - aP0.
x );
37 int h = abs( aP1.
y - aP0.
y );
38 int sw =
sign( aP1.
x - aP0.
x );
39 int sh =
sign( aP1.
y - aP0.
y );
46 if( w == 0 || h == 0 || ( !is90mode && h == w ) )
54 int tangentLength = 0;
58 if( startDiagonal == ( h >= w ) )
101 pl.
Append( startDiagonal ? ( aP0 + mp1 ) : ( aP0 + mp0 ) );
131 double diagLength = std::sqrt( ( 2 * diag2 ) - ( 2 * diag2 * std::cos( 3 * M_PI_4 ) ) );
132 int arcRadius =
KiROUND( diagLength / ( 2.0 * std::cos( 67.5 * M_PI / 180.0 ) ) );
141 int rotationSign = ( w > h ) ? ( sw * sh * -1 ) : ( sw * sh );
143 if( tangentLength >= 0 )
146 arcEndpoint = aP1 - mp0.
Resize( tangentLength );
172 int rotationSign = ( w > h ) ? ( sw * sh * -1 ) : ( sw * sh );
177 if( tangentLength >= 0 )
180 arcEndpoint = aP0 + mp0.
Resize( tangentLength );
269 int y = aP0.
y + ( w * sh );
278 int x = aP0.
x + ( h * sw );
290 int x = aP1.
x - ( h * sw );
299 int y = aP1.
y - ( w * sh );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
const SHAPE_LINE_CHAIN BuildInitialTrace(const VECTOR2I &aP0, const VECTOR2I &aP1, bool aStartDiagonal=false, CORNER_MODE aMode=CORNER_MODE::MITERED_45) const
Build a 2-segment line chain between points aP0 and aP1 and following 45-degree routing regime.
bool IsDiagonal() const
Returns true if the direction is diagonal (e.g.
@ ROUNDED_90
H/V with filleted corners.
@ MITERED_90
H/V only (90-degree corners)
@ ROUNDED_45
H/V/45 with filleted corners.
@ MITERED_45
H/V/45 with mitered corners (default)
Directions m_dir
Are we routing on 45 or 90 degree increments.
SHAPE_ARC & ConstructFromStartEndAngle(const VECTOR2I &aStart, const VECTOR2I &aEnd, const EDA_ANGLE &aAngle, double aWidth=0)
Construct this arc from the given start, end and angle.
SHAPE_ARC & ConstructFromStartEndCenter(const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, bool aClockwise=false, double aWidth=0)
Constructs this arc from the given start, end and center.
const VECTOR2I & GetP1() const
const VECTOR2I & GetP0() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
void Simplify(int aMaxError=0)
Simplify the line chain by removing colinear adjacent segments and duplicate vertices.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
static const int MIN_PRECISION_IU
This is the minimum precision for all the points in a shape.
constexpr extended_type SquaredEuclideanNorm() const
Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2).
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_45
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
constexpr int sign(T val)
VECTOR2< int32_t > VECTOR2I