summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2020-06-07 23:54:20 +0200
committerRegina Henschel <rb.henschel@t-online.de>2020-06-08 13:36:06 +0200
commit91f06123298bb8870cd6fa4e19d3aea9909f8e5b (patch)
treeb0656191fafdd1184227ace31c21c11fd9be1e7d /svx/source
parent1027f7a0e1c10d957de34e27af16a4d0e825ffb2 (diff)
tdf#103474 handle quarter angles before using atan2
sin(basegfx::deg2rad(fEAngleDeg)) does not result in 0 for fEAngleDeg=180 because of rounding errors and therefore atan2 later in the code gives wrong angle. Because the corresponding circle angle is the same as the ellipse angle for 0°, 90°, 180° and 270°, these angles are now handled before using atan2. Change-Id: Iae2a4d188b837ff787f2af4d79f874ba21c9aa2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95772 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 7bf8383ab8f6..8b570edd809e 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -1997,6 +1997,8 @@ static double lcl_getNormalizedCircleAngleRad(const double fWR, const double fHR
double fEAngleDeg(fmod(fEllipseAngleDeg, 360.0));
if (fEAngleDeg < 0.0)
fEAngleDeg += 360.0;
+ if (fEAngleDeg == 0.0 || fEAngleDeg == 90.0 || fEAngleDeg == 180.0 || fEAngleDeg == 270.0)
+ return basegfx::deg2rad(fEAngleDeg);
const double fX(fHR * cos(basegfx::deg2rad(fEAngleDeg)));
const double fY(fWR * sin(basegfx::deg2rad(fEAngleDeg)));
if (fX != 0.0 || fY != 0.0)