24 bool aStartDiagonal,
bool aFillet )
const 29 startDiagonal = aStartDiagonal;
33 int w = abs( aP1.
x - aP0.
x );
34 int h = abs( aP1.
y - aP0.
y );
35 int sw =
sign( aP1.
x - aP0.
x );
36 int sh =
sign( aP1.
y - aP0.
y );
90 if( w == h || w == 0 || h == 0 )
104 double diagLength = std::sqrt( ( 2 * diag2 ) - ( 2 * diag2 * std::cos( 3 * M_PI_4 ) ) );
105 int arcRadius =
KiROUND( diagLength / ( 2.0 * std::cos( 67.5 * M_PI / 180.0 ) ) );
114 int rotationSign = ( w > h ) ? ( sw * sh * -1 ) : ( sw * sh );
116 if( tangentLength >= 0 )
119 arcEndpoint = aP1 - mp0.
Resize( tangentLength );
132 arcEndpoint = aP0 + mp1.
Resize( std::abs( tangentLength ) );
145 int rotationSign = ( w > h ) ? ( sw * sh ) : ( sw * sh * -1 );
148 if( tangentLength >= 0 )
151 arcEndpoint = aP0 + mp0.
Resize( tangentLength );
165 SHAPE_ARC ca( arcCenter, aP0, 45 * rotationSign );
195 pl.
Append( startDiagonal ? ( aP0 + mp1 ) : ( aP0 + mp0 ) );
SHAPE_LINE_CHAIN & Simplify(bool aRemoveColinear=true)
Function Simplify()
SHAPE_ARC & ConstructFromStartEndAngle(const VECTOR2I &aStart, const VECTOR2I &aEnd, double aAngle, double aWidth=0)
Constructs this arc from the given start, end and angle.
extended_type SquaredEuclideanNorm() const
Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2).
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
const VECTOR2I & GetP0() const
static const int MIN_PRECISION_IU
This is the minimum precision for all the points in a shape.
const SHAPE_LINE_CHAIN BuildInitialTrace(const VECTOR2I &aP0, const VECTOR2I &aP1, bool aStartDiagonal=false, bool aFillet=false) 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.
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
VECTOR2< T > Rotate(double aAngle) const
Rotate the vector by a given angle.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Directions m_dir
Are we routing on 45 or 90 degree increments.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
const VECTOR2I & GetP1() const