diff options
author | Radek Doulik <rodo@novell.com> | 2011-10-05 14:40:20 +0200 |
---|---|---|
committer | Radek Doulik <rodo@novell.com> | 2011-10-05 17:40:21 +0200 |
commit | 4e6ee8000aa9ab75982351dce5a7c90ed2a465aa (patch) | |
tree | 42533439c82a3caf9913f0321e427aaea220f535 /tools | |
parent | 4b23e3a6d8fb9fe18ff57bd6abf5793ca2e0c409 (diff) |
fix construction of ARC polygon in case the ellipse width != height
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/generic/poly.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 4ba1ef0e1ad4..385e39e8d185 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -327,10 +327,12 @@ inline void Polygon::ImplMakeUnique() // ----------------------------------------------------------------------- -inline double ImplGetAngle( const Point& rCenter, const Point& rPt ) +inline double ImplGetParameter( const Point& rCenter, const Point& rPt, double fWR, double fHR ) { const long nDX = rPt.X() - rCenter.X(); - return( atan2( -rPt.Y() + rCenter.Y(), ( ( nDX == 0L ) ? 0.000000001 : nDX ) ) ); + double fAngle = atan2( -rPt.Y() + rCenter.Y(), ( ( nDX == 0L ) ? 0.000000001 : nDX ) ); + + return atan2(fWR*sin(fAngle), fHR*cos(fAngle)); } // ----------------------------------------------------------------------- @@ -537,8 +539,8 @@ Polygon::Polygon( const Rectangle& rBound, const double fRadY = nRadY; const double fCenterX = aCenter.X(); const double fCenterY = aCenter.Y(); - double fStart = ImplGetAngle( aCenter, rStart ); - double fEnd = ImplGetAngle( aCenter, rEnd ); + double fStart = ImplGetParameter( aCenter, rStart, fRadX, fRadY ); + double fEnd = ImplGetParameter( aCenter, rEnd, fRadX, fRadY ); double fDiff = fEnd - fStart; double fStep; sal_uInt16 nStart; |