41 int64_t abX =
static_cast<int64_t
>( b.
x ) - a.
x;
42 int64_t abY =
static_cast<int64_t
>( b.
y ) - a.
y;
43 int64_t acX =
static_cast<int64_t
>( c.
x ) - a.
x;
44 int64_t acY =
static_cast<int64_t
>( c.
y ) - a.
y;
59 double paX =
static_cast<double>( a.
x ) - p.
x, paY =
static_cast<double>( a.
y ) - p.
y;
60 double pbX =
static_cast<double>( b.
x ) - p.
x, pbY =
static_cast<double>( b.
y ) - p.
y;
61 double pcX =
static_cast<double>( c.
x ) - p.
x, pcY =
static_cast<double>( c.
y ) - p.
y;
63 double paSq = paX * paX + paY * paY;
64 double pbSq = pbX * pbX + pbY * pbY;
65 double pcSq = pcX * pcX + pcY * pcY;
67 double det = paX * ( pbY * pcSq - pbSq * pcY ) - paY * ( pbX * pcSq - pbSq * pcX )
68 + paSq * ( pbX * pcY - pbY * pcX );
69 double sumSq = paSq + pbSq + pcSq;
71 return det <= 1e-13 * sumSq * sumSq;
82 int64_t paX =
static_cast<int64_t
>( a.
x ) - p.
x, paY =
static_cast<int64_t
>( a.
y ) - p.
y;
83 int64_t pbX =
static_cast<int64_t
>( b.
x ) - p.
x, pbY =
static_cast<int64_t
>( b.
y ) - p.
y;
84 int64_t pcX =
static_cast<int64_t
>( c.
x ) - p.
x, pcY =
static_cast<int64_t
>( c.
y ) - p.
y;
87 constexpr int64_t kMaxSafeDiff = 1500000000LL;
96 const KI_INT128 paX128( paX ), paY128( paY ), pbX128( pbX ), pbY128( pbY ), pcX128( pcX ), pcY128( pcY );
98 const KI_INT128 paSq = paX128 * paX128 + paY128 * paY128;
99 const KI_INT128 pbSq = pbX128 * pbX128 + pbY128 * pbY128;
100 const KI_INT128 pcSq = pcX128 * pcX128 + pcY128 * pcY128;
102 const KI_INT128 det = paX128 * ( pbY128 * pcSq - pbSq * pcY128 ) - paY128 * ( pbX128 * pcSq - pbSq * pcX128 )
103 + paSq * ( pbX128 * pcY128 - pbY128 * pcX128 );
112 double abX =
static_cast<double>( b.
x ) - a.
x, abY =
static_cast<double>( b.
y ) - a.
y;
113 double bcX =
static_cast<double>( c.
x ) - b.
x, bcY =
static_cast<double>( c.
y ) - b.
y;
114 double caX =
static_cast<double>( a.
x ) - c.
x, caY =
static_cast<double>( a.
y ) - c.
y;
116 double abSquared = abX * abX + abY * abY;
117 double bcSquared = bcX * bcX + bcY * bcY;
118 double caSquared = caX * caX + caY * caY;
120 double longestSquared = std::max( { abSquared, bcSquared, caSquared } );
121 double shortestSquared = std::min( { abSquared, bcSquared, caSquared } );
123 return shortestSquared > 0.0 && longestSquared > 100.0 * shortestSquared;
bool inCircleLegalDouble(const VECTOR2I &a, const VECTOR2I &b, const VECTOR2I &c, const VECTOR2I &p)
Filtered-double legality test; the tie margin treats a near-cocircular quad as legal to keep a flip l...
Construction helpers for the interactive arc drawing modes.
int OrientationSign(const VECTOR2I &a, const VECTOR2I &b, const VECTOR2I &c)
Orientation of triangle (a, b, c): +1 counter-clockwise, -1 clockwise, 0 collinear.
bool InCircleDelaunayLegal(const VECTOR2I &a, const VECTOR2I &b, const VECTOR2I &c, const VECTOR2I &p)
True when p is outside the circumcircle of CCW triangle (a, b, c): the shared edge is already Delauna...
bool IsSliverTriangle(const VECTOR2I &a, const VECTOR2I &b, const VECTOR2I &c)
A triangle is a sliver when its longest edge exceeds ten times its shortest.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
VECTOR2< int32_t > VECTOR2I
VECTOR2< int64_t > VECTOR2L
128-bit integers for exact products of 64-bit coordinate deltas.
constexpr KI_INT128 CrossWide(const VECTOR2L &aA, const VECTOR2L &aB)
Exact aA.x * aB.y - aA.y * aB.x.