mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Div-by-0 safety.
This commit is contained in:
parent
fb46ca39df
commit
c5a053d51c
@ -386,13 +386,19 @@ const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, cons
|
|||||||
return center;
|
return center;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent div=0 errors
|
// Prevent div-by-0 errors
|
||||||
if( xDelta_21 == 0.0 )
|
if( xDelta_21 == 0.0 )
|
||||||
xDelta_21 = std::numeric_limits<double>::epsilon();
|
xDelta_21 = std::numeric_limits<double>::epsilon();
|
||||||
|
|
||||||
if( xDelta_32 == 0.0 )
|
if( xDelta_32 == 0.0 )
|
||||||
xDelta_32 = -std::numeric_limits<double>::epsilon();
|
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 aSlope = yDelta_21 / xDelta_21;
|
||||||
double bSlope = yDelta_32 / xDelta_32;
|
double bSlope = yDelta_32 / xDelta_32;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user