arc: fix incorrect arc center calculation for angle < 0 or > 180 deg

This commit is contained in:
jean-pierre charras 2021-08-05 18:15:55 +02:00
parent 77680eba30
commit b6664eecf2
1 changed files with 3 additions and 3 deletions

View File

@ -376,14 +376,14 @@ const wxPoint GetArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, double
aAngle = 360 - aAngle; aAngle = 360 - aAngle;
} }
int chord = ( aStart - aEnd ).EuclideanNorm(); int chord = ( start - end ).EuclideanNorm();
int r = ( chord / 2 ) / sin( aAngle * M_PI / 360.0 ); int r = ( chord / 2 ) / sin( aAngle * M_PI / 360.0 );
VECTOR2I vec = aEnd - aStart; VECTOR2I vec = end - start;
vec = vec.Resize( r ); vec = vec.Resize( r );
vec = vec.Rotate( ( 180.0 - aAngle ) * M_PI / 360.0 ); vec = vec.Rotate( ( 180.0 - aAngle ) * M_PI / 360.0 );
return (wxPoint) ( aStart + vec ); return (wxPoint) ( start + vec );
} }