Use basegfx::rad2deg() instead of *57.29577951308

* Replaced multiplying by magic number 57.29577951308 with
    basegfx::rad2deg() which is equal to 180.0/M_PI
* Instances of this could be found using:

   git grep 57.29577951308 *.cxx *.hxx

Change-Id: I0ae99a5d63d104b79c6df2dc88e9dda6973a1d3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124226
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Hossein
2021-11-09 13:25:37 +01:00
committed by Mike Kaganski
parent 7a0d3ed55c
commit 52ad81c748
4 changed files with 13 additions and 13 deletions

View File

@@ -1733,7 +1733,7 @@ namespace emfio
double fY = aP2.Y();
if ( fX )
{
double fOrientation = acos( fX / sqrt( fX * fX + fY * fY ) ) * 57.29577951308;
double fOrientation = basegfx::rad2deg( acos( fX / sqrt( fX * fX + fY * fY ) ) );
if ( fY > 0 )
fOrientation = 360 - fOrientation;
fOrientation += 90;

View File

@@ -792,7 +792,7 @@ void CGMImpressOutAct::DrawText(awt::Point const & rTextPos, awt::Size const & r
double nX = mpCGM->pElement->nCharacterOrientation[ 2 ];
double nY = mpCGM->pElement->nCharacterOrientation[ 3 ];
double fSqrt = sqrt(nX * nX + nY * nY);
double nOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
double nOrientation = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if ( nY < 0 )
nOrientation = 360 - nOrientation;

View File

@@ -227,7 +227,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
nY = rDesc.mnR.Y - rDesc.mnP.Y;
double fSqrt = sqrt(nX * nX + nY * nY);
rDesc.mnOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
rDesc.mnOrientation = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if ( nY > 0 )
rDesc.mnOrientation = 360 - rDesc.mnOrientation;
@@ -241,7 +241,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
nY = -( fSin * nX - fCos * nY );
fSqrt = sqrt(nX * nX + nY * nY);
fAngle = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
fAngle = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if ( nY > 0 )
fAngle = 360 - fAngle;

View File

@@ -37,7 +37,7 @@ double CGM::ImplGetOrientation( FloatPoint const & rCenter, FloatPoint const & r
double nY = rPoint.Y - rCenter.Y;
double fSqrt = sqrt(nX * nX + nY * nY);
double fOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
double fOrientation = fSqrt != 0.0 ? basegfx::rad2deg(acos(nX / fSqrt)) : 0.0;
if (nY > 0)
fOrientation = 360 - fOrientation;
@@ -549,9 +549,9 @@ void CGM::ImplDoClass4()
if (!bUseless)
{
const double fStartSqrt = sqrt(vector[0] * vector[ 0 ] + vector[1] * vector[1]);
fStartAngle = fStartSqrt != 0.0 ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0;
fStartAngle = fStartSqrt != 0.0 ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
const double fEndSqrt = sqrt(vector[2] * vector[ 2 ] + vector[3] * vector[3]);
fEndAngle = fEndSqrt != 0.0 ? (acos(vector[ 2 ] / fEndSqrt) * 57.29577951308) : 0.0;
fEndAngle = fEndSqrt != 0.0 ? basegfx::rad2deg(acos(vector[ 2 ] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
fStartAngle = 360 - fStartAngle;
@@ -627,9 +627,9 @@ void CGM::ImplDoClass4()
if (!bUseless)
{
const double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
double fStartAngle = fStartSqrt ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0;
double fStartAngle = fStartSqrt ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
const double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]);
double fEndAngle = fEndSqrt ? acos(vector[2] / fEndSqrt) * 57.29577951308 : 0.0;
double fEndAngle = fEndSqrt ? basegfx::rad2deg(acos(vector[2] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
fStartAngle = 360 - fStartAngle;
@@ -684,9 +684,9 @@ void CGM::ImplDoClass4()
if (!bUseless)
{
double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
fStartAngle = fStartSqrt ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0;
fStartAngle = fStartSqrt ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]);
fEndAngle = fEndSqrt ? (acos(vector[2] / fEndSqrt) * 57.29577951308) : 0.0;
fEndAngle = fEndSqrt ? basegfx::rad2deg(acos(vector[2] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
fStartAngle = 360 - fStartAngle;
@@ -720,9 +720,9 @@ void CGM::ImplDoClass4()
if (!bUseless)
{
double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
fStartAngle = fStartSqrt ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0;
fStartAngle = fStartSqrt ? basegfx::rad2deg(acos(vector[0] / fStartSqrt)) : 0.0;
double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]);
fEndAngle = fEndSqrt ? (acos(vector[2] / fEndSqrt) * 57.29577951308) : 0.0;
fEndAngle = fEndSqrt ? basegfx::rad2deg(acos(vector[2] / fEndSqrt)) : 0.0;
if ( vector[ 1 ] > 0 )
fStartAngle = 360 - fStartAngle;