Div-by-0 safety.

This commit is contained in:
Jeff Young 2025-06-09 12:49:29 +01:00
parent fb46ca39df
commit c5a053d51c

View File

@ -386,13 +386,19 @@ const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, cons
return center;
}
// Prevent div=0 errors
// Prevent div-by-0 errors
if( xDelta_21 == 0.0 )
xDelta_21 = std::numeric_limits<double>::epsilon();
if( xDelta_32 == 0.0 )
xDelta_32 = -std::numeric_limits<double>::epsilon();
if( yDelta_21 == 0.0 )
yDelta_21 = std::numeric_limits<double>::epsilon();
if( yDelta_32 == 0.0 )
yDelta_32 = -std::numeric_limits<double>::epsilon();
double aSlope = yDelta_21 / xDelta_21;
double bSlope = yDelta_32 / xDelta_32;