diff options
-rw-r--r-- | basegfx/source/workbench/bezierclip.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 3 | ||||
-rw-r--r-- | emfio/source/reader/mtftools.cxx | 2 |
4 files changed, 7 insertions, 8 deletions
diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx index 7c9999939f9b..676f239efd10 100644 --- a/basegfx/source/workbench/bezierclip.cxx +++ b/basegfx/source/workbench/bezierclip.cxx @@ -87,7 +87,7 @@ void Impl_calcFatLine( FatLine& line, const Bezier& c ) line.b = (c.p0.x - c.p3.x); // normalize - const double len( sqrt( line.a*line.a + line.b*line.b ) ); + const double len(std::hypot(line.a, line.b)); if( !tolZero(len) ) { line.a /= len; diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index cf1bfde1c294..cde47b9912fc 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -512,8 +512,7 @@ void PieChart::createTextLabelShape( { //when the line is very short compared to the page size don't create one ::basegfx::B2DVector aLength(nX1 - nX2, nY1 - nY2); - double fPageDiagonaleLength = sqrt(double(nPageWidth) * double(nPageWidth) - + double(nPageHeight) * double(nPageHeight)); + double fPageDiagonaleLength = std::hypot(nPageWidth, nPageHeight); if ((aLength.getLength() / fPageDiagonaleLength) >= 0.01) { drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } }; @@ -1235,7 +1234,7 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi if(!bMoveableFound) return; - double fPageDiagonaleLength = sqrt( double(rPageSize.Width)*double(rPageSize.Width) + double(rPageSize.Height)*double(rPageSize.Height) ); + double fPageDiagonaleLength = std::hypot(rPageSize.Width, rPageSize.Height); if( fPageDiagonaleLength == 0.0 ) return; @@ -1475,8 +1474,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab // compute the length of the diagonal vector d, // that is the distance between P and F - double fSquaredDistancePF = fDistancePM * fDistancePM + fOrthogonalEdgeLength * fOrthogonalEdgeLength; - double fDistancePF = sqrt( fSquaredDistancePF ); + double fDistancePF = std::hypot(fDistancePM, fOrthogonalEdgeLength); SAL_INFO( "chart2.pie.label.bestfit.inside", " width = " << fLabelWidth ); diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 50bff922f861..8e5e9d5bf9af 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -720,7 +720,8 @@ rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Referen //when the line is very short compared to the page size don't create one ::basegfx::B2DVector aLength(nX1 - nX2, nY1 - nY2); - double fPageDiagonaleLength = sqrt(double(m_aPageReferenceSize.Width)*double(m_aPageReferenceSize.Width) + double(m_aPageReferenceSize.Height)*double(m_aPageReferenceSize.Height)); + double fPageDiagonaleLength + = std::hypot(m_aPageReferenceSize.Width, m_aPageReferenceSize.Height); if ((aLength.getLength() / fPageDiagonaleLength) >= 0.01) { drawing::PointSequenceSequence aPoints{ { {nX1, nY1}, {nX2, nY2} } }; diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index 5117411fc54f..b4973f6e51ab 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -1740,7 +1740,7 @@ namespace emfio double fY = aP2.Y(); if ( fX ) { - double fOrientation = basegfx::rad2deg( acos( fX / sqrt( fX * fX + fY * fY ) ) ); + double fOrientation = basegfx::rad2deg(acos(fX / std::hypot(fX, fY))); if ( fY > 0 ) fOrientation = 360 - fOrientation; fOrientation += 90; |