diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-11-04 21:06:15 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-11-05 05:35:12 +0100 |
commit | 35b3abf5831fe05360f58dd7d292602785a55281 (patch) | |
tree | dc33335378207a76d32c47b9935ee7ade2ff0283 /basegfx/source | |
parent | 9e3803ae438ddcf91ec0e15431be379561d28ba6 (diff) |
Simplify a bit
The expression can't be negative. It's a Pythagorean sum.
Change-Id: Ic07783c5291da71de6701a139227def2f1c4f77b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175989
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basegfx/source')
-rw-r--r-- | basegfx/source/polygon/b2dsvgpolypolygon.cxx | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 7e525d5e1644..a7a25e6e17bb 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -543,20 +543,7 @@ namespace basegfx::utils // of radicant solved for fRY, // with s=fRX/fRY) const double fRatio(fRX/fRY); - const double fRadicant2( - p1_prime.getY()*p1_prime.getY() + - p1_prime.getX()*p1_prime.getX()/(fRatio*fRatio)); - if( fRadicant2 < 0.0 ) - { - // only trivial solution, one - // of the axes 0 -> straight - // line segment according to - // SVG spec - aCurrPoly.append(B2DPoint(nX, nY)); - continue; - } - - fRY=sqrt(fRadicant2); + fRY=std::hypot(p1_prime.getY(), p1_prime.getX()/fRatio); fRX=fRatio*fRY; // keep center_prime forced to (0,0) |