58    auto furthestFromIntersect =
 
   61            if( ( aPt1 - intersectPoint ).EuclideanNorm()
 
   62                > ( aPt2 - intersectPoint ).EuclideanNorm() )
 
   72    auto closestToIntersect =
 
   75            if( ( aPt1 - intersectPoint ).EuclideanNorm()
 
   76                <= ( aPt2 - intersectPoint ).EuclideanNorm() )
 
   95        Radius = ( midPt - aLineA.
A ).EuclideanNorm();
 
  100        std::vector<VECTOR2I> possibleCenters = 
IntersectLine( anglebisector );
 
  102        wxCHECK_MSG( possibleCenters.size() > 0, *
this, wxT( 
"No solutions exist!" ) );
 
  103        intersectPoint = aLineA.
A; 
 
  107        Center = closestToIntersect( possibleCenters.front(), possibleCenters.back() );
 
  115        wxCHECK_MSG( intersectCalc, *
this, wxT( 
"Lines do not intersect but are not parallel?" ) );
 
  116        intersectPoint = *intersectCalc;
 
  118        if( aP == intersectPoint )
 
  127        VECTOR2I lineApt = furthestFromIntersect( aLineA.
A, aLineA.
B );
 
  128        VECTOR2I lineBpt = furthestFromIntersect( aLineB.
A, aLineB.
B );
 
  131        anglebisector.
A = intersectPoint;
 
  132        anglebisector.
B = bisectorPt;
 
  140        SEG                   throughaP( intersectPoint, aP );
 
  141        std::vector<VECTOR2I> hProjections = hSolution.
IntersectLine( throughaP );
 
  142        wxCHECK_MSG( hProjections.size() > 0, *
this, wxT( 
"No solutions exist!" ) );
 
  146        VECTOR2I hSelected = closestToIntersect( hProjections.front(), hProjections.back() );
 
  152        if( ( hTanLineA - aP ).SquaredEuclideanNorm() > ( hTanLineB - aP ).SquaredEuclideanNorm() )
 
  155            SEG          hT( hTanLineA, hSelected );
 
  157            wxCHECK_MSG( actTanA, *
this, wxT( 
"No solutions exist!" ) );
 
  162            wxCHECK_MSG( actCenter, *
this, wxT( 
"No solutions exist!" ) );
 
  170            SEG          hT( hTanLineB, hSelected );
 
  172            wxCHECK_MSG( actTanB, *
this, wxT( 
"No solutions exist!" ) );
 
  177            wxCHECK_MSG( actCenter, *
this, wxT( 
"No solutions exist!" ) );
 
 
  202    if( vec.
x == 0 && vec.
y == 0 )
 
 
  214    if( vec.
x == 0 && vec.
y == 0 )
 
 
  244    std::vector<VECTOR2I> retval;
 
  249    int64_t  r2 = aCircle.
Radius;
 
  251    if( d > ( r1 + r2 ) || ( d < ( 
std::abs( r1 - r2 ) ) ) )
 
  258    int64_t x = ( ( d * d ) + ( r1 * r1 ) - ( r2 * r2 ) ) / ( int64_t( 2 ) * d );
 
  259    int64_t r1sqMinusXsq = ( r1 * r1 ) - ( x * x );
 
  261    if( r1sqMinusXsq < 0 )
 
  265    int64_t y = 
KiROUND( sqrt( r1sqMinusXsq ) );
 
  272    retval.push_back( solution1 );
 
  279        retval.push_back( solution2 );
 
 
  288    std::vector<VECTOR2I> retval;
 
  293            retval.push_back( intersection );
 
 
  302    std::vector<VECTOR2I> retval;
 
  336        retval.push_back( m );
 
  340    int64_t radiusSquared = (int64_t) 
Radius * (int64_t) 
Radius;
 
  341    int64_t omDistSquared = omDist * omDist;
 
  343    int mTo1dist = sqrt( radiusSquared - omDistSquared );
 
  345    VECTOR2I mTo1vec = ( aLine.
B - aLine.
A ).Resize( mTo1dist );
 
  348    retval.push_back( mTo1vec + m );
 
  349    retval.push_back( mTo2vec + m );
 
 
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
 
VECTOR2I Center
Public to make access simpler.
 
int Radius
Public to make access simpler.
 
std::vector< VECTOR2I > Intersect(const CIRCLE &aCircle) const
Compute the intersection points between this circle and aCircle.
 
std::vector< VECTOR2I > IntersectLine(const SEG &aLine) const
Compute the intersection points between this circle and aLine.
 
CIRCLE & ConstructFromTanTanPt(const SEG &aLineA, const SEG &aLineB, const VECTOR2I &aP)
Construct this circle such that it is tangent to the given segments and passes through the given poin...
 
VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute the point on the circumference of the circle that is the closest to aP.
 
bool Contains(const VECTOR2I &aP) const
Return true if aP is on the circumference of this circle.
 
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 (t...
 
bool ApproxParallel(const SEG &aSeg, int aDistanceThreshold=1) const
 
SEG ParallelSeg(const VECTOR2I &aP) const
Compute a segment parallel to this one, passing through point aP.
 
OPT_VECTOR2I IntersectLines(const SEG &aSeg) const
Compute the intersection point of lines passing through ends of (this) and aSeg.
 
bool Contains(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.
 
SEG PerpendicularSeg(const VECTOR2I &aP) const
Compute a segment perpendicular to this one, passing through point aP.
 
static const int MIN_PRECISION_IU
This is the minimum precision for all the points in a shape.
 
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.
 
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
 
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
 
std::optional< VECTOR2I > OPT_VECTOR2I
 
const VECTOR2I CalcArcMid(const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCenter, bool aMinArcAngle=true)
Return the middle point of an arc, half-way between aStart and aEnd.
 
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.
 
VECTOR2< int32_t > VECTOR2I
 
VECTOR2< double > VECTOR2D
 
VECTOR2< int64_t > VECTOR2L