Prevent inf when presented with 0 errormax
acos(1) returns 0, so this implies infinite segements to get to 0 error. This is not reasonable but might be encountered in bad arcs or circles that have 0 radius. Instead of returning infinite or std::max segments, we limit the error to be at least 1 IU
This commit is contained in:
parent
f41f04b301
commit
1fda68099f
|
@ -46,6 +46,7 @@ int GetArcToSegmentCount( int aRadius, int aErrorMax, const EDA_ANGLE& aArcAngle
|
|||
|
||||
// avoid divide-by-zero
|
||||
aRadius = std::max( 1, aRadius );
|
||||
aErrorMax = std::max( 1, aErrorMax );
|
||||
|
||||
// error relative to the radius value:
|
||||
double rel_error = (double)aErrorMax / aRadius;
|
||||
|
|
Loading…
Reference in New Issue