diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-08-04 10:37:17 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-08-04 20:51:27 +0200 |
commit | 8c48d69f06ddb3cb6c807a1e7db62dddb9778ded (patch) | |
tree | 8b6bf137be41ebe93746c4958ab9106bbf5cc339 /svx/source | |
parent | c05fbde6c870b7e6bc2f9bf642dc7d76215a496f (diff) |
Use more basegfx deg<->rad functions, instead of direct formulas
Also make the functions constexpr.
Due to slight changes in floating-point arithmetics (90.0 instead of
180.0, M_PI2 instead of M_PI resp.), results might differ in last
digits (usually 17th decimal digit). This has lead to need to tweak
char2dump's PieChartTest unit test.
Change-Id: I20323dd7dab27e4deb408ea4181e390cc05e7cd3
Reviewed-on: https://gerrit.libreoffice.org/58583
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 20 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape3d.cxx | 10 | ||||
-rw-r--r-- | svx/source/dialog/dialcontrol.cxx | 8 | ||||
-rw-r--r-- | svx/source/dialog/dlgctl3d.cxx | 22 | ||||
-rw-r--r-- | svx/source/engine3d/dragmt3d.cxx | 4 | ||||
-rw-r--r-- | svx/source/engine3d/obj3d.cxx | 2 | ||||
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 5 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/overlay/overlaytools.cxx | 2 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 3 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx | 4 | ||||
-rw-r--r-- | svx/source/sidebar/possize/SidebarDialControl.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/gradtrns.cxx | 20 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 9 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 6 |
16 files changed, 61 insertions, 60 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 6c64f2e9de23..266dde8a1ad7 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1144,7 +1144,7 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r GetParameter( fRadius, aHandle.aPosition.First, false, false ); GetParameter( fAngle, aHandle.aPosition.Second, false, false ); - double a = ( 360.0 - fAngle ) * F_PI180; + double a = basegfx::deg2rad(360.0 - fAngle); double dx = fRadius * fXScale; double fX = dx * cos( a ); double fY =-dx * sin( a ); @@ -1280,7 +1280,7 @@ bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nIndex fYRef = fHeight / 2; } const double fDX = fPos1 - fXRef; - fAngle = -( atan2( -fPos2 + fYRef, ( ( fDX == 0.0L ) ? 0.000000001 : fDX ) ) / F_PI180 ); + fAngle = -basegfx::rad2deg(atan2(-fPos2 + fYRef, (fDX == 0.0) ? 0.000000001 : fDX)); double fX = ( fPos1 - fXRef ); double fY = ( fPos2 - fYRef ); double fRadius = sqrt( fX * fX + fY * fY ); @@ -1674,10 +1674,14 @@ void EnhancedCustomShape2d::CreateSubPath( } double fCenterX = aRect.Center().X(); double fCenterY = aRect.Center().Y(); - double fx1 = ( cos( fStartAngle * F_PI180 ) * 65536.0 * fXScale ) + fCenterX; - double fy1 = ( -sin( fStartAngle * F_PI180 ) * 65536.0 * fYScale ) + fCenterY; - double fx2 = ( cos( fEndAngle * F_PI180 ) * 65536.0 * fXScale ) + fCenterX; - double fy2 = ( -sin( fEndAngle * F_PI180 ) * 65536.0 * fYScale ) + fCenterY; + double fx1 = cos(basegfx::deg2rad(fStartAngle)) * 65536.0 * fXScale + + fCenterX; + double fy1 = -sin(basegfx::deg2rad(fStartAngle)) * 65536.0 * fYScale + + fCenterY; + double fx2 = cos(basegfx::deg2rad(fEndAngle)) * 65536.0 * fXScale + + fCenterX; + double fy2 = -sin(basegfx::deg2rad(fEndAngle)) * 65536.0 * fYScale + + fCenterY; aNewB2DPolygon.append(CreateArc( aRect, Point( static_cast<sal_Int32>(fx1), static_cast<sal_Int32>(fy1) ), Point( static_cast<sal_Int32>(fx2), static_cast<sal_Int32>(fy2) ), false)); } else @@ -1814,8 +1818,8 @@ void EnhancedCustomShape2d::CreateSubPath( // Convert angles to radians, but don't do any scaling / translation yet. - fStartAngle *= F_PI180; - fSwingAngle *= F_PI180; + fStartAngle = basegfx::deg2rad(fStartAngle); + fSwingAngle = basegfx::deg2rad(fSwingAngle); SAL_INFO("svx", "ARCANGLETO scale: " << fWR << "x" << fHR << " angles: " << fStartAngle << "," << fSwingAngle); diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index 752054bce703..54aef0e0c845 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -82,8 +82,8 @@ void GetRotateAngle( const SdrCustomShapeGeometryItem& rItem, double& rAngleX, d rAngleX = 0.0; rAngleY = 0.0; } - rAngleX *= F_PI180; - rAngleY *= F_PI180; + rAngleX = basegfx::deg2rad(rAngleX); + rAngleY = basegfx::deg2rad(rAngleY); } void GetSkew( const SdrCustomShapeGeometryItem& rItem, double& rSkewAmount, double& rSkewAngle ) @@ -95,7 +95,7 @@ void GetSkew( const SdrCustomShapeGeometryItem& rItem, double& rSkewAmount, doub rSkewAmount = 50; rSkewAngle = -135; } - rSkewAngle *= F_PI180; + rSkewAngle = basegfx::deg2rad(rSkewAngle); } void GetExtrusionDepth( const SdrCustomShapeGeometryItem& rItem, const double* pMap, double& rBackwardDepth, double& rForwardDepth ) @@ -613,7 +613,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( double fXRotate, fYRotate; GetRotateAngle( rGeometryItem, fXRotate, fYRotate ); - double fZRotate(rSdrObjCustomShape.GetObjectRotation() * F_PI180); + double fZRotate(basegfx::deg2rad(rSdrObjCustomShape.GetObjectRotation())); if ( fZRotate != 0.0 ) aNewTransform.rotate( 0.0, 0.0, fZRotate ); if ( bIsMirroredX ) @@ -789,7 +789,7 @@ tools::Rectangle EnhancedCustomShape3d::CalculateNewSnapRect( double fXRotate, fYRotate; GetRotateAngle( rGeometryItem, fXRotate, fYRotate ); - double fZRotate(rSdrObjCustomShape.GetObjectRotation() * F_PI180); + double fZRotate(basegfx::deg2rad(rSdrObjCustomShape.GetObjectRotation())); // rotating bound volume basegfx::B3DHomMatrix aMatrix; diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 7270710e048a..f4bc875fccf6 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -66,7 +66,7 @@ void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled ) void DialControlBmp::DrawElements( const OUString& rText, sal_Int32 nAngle ) { - double fAngle = nAngle * F_PI180 / 100.0; + double fAngle = basegfx::deg2rad(nAngle) / 100.0; double fSin = sin( fAngle ); double fCos = cos( fAngle ); double fWidth = GetTextWidth( rText ) / 2.0; @@ -200,7 +200,7 @@ void DialControlBmp::DrawBackground() for( int nAngle = 0; nAngle < 360; nAngle += 15 ) { SetLineColor( (nAngle % 45) ? aLightColor : aFullColor ); - double fAngle = nAngle * F_PI180; + double fAngle = basegfx::deg2rad(nAngle); long nX = static_cast< long >( -mnCenterX * cos( fAngle ) ); long nY = static_cast< long >( mnCenterY * sin( fAngle ) ); DrawLine( aStartPos, Point( mnCenterX - nX, mnCenterY - nY ) ); @@ -485,7 +485,7 @@ void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) if( fH != 0.0 ) { double fAngle = acos( nX / fH ); - sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 ); + sal_Int32 nAngle = static_cast<sal_Int32>(basegfx::rad2deg(fAngle) * 100.0); if( nY < 0 ) nAngle = 36000 - nAngle; if( bInitial ) // round to entire 15 degrees @@ -720,7 +720,7 @@ void SvxDialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) if( fH != 0.0 ) { double fAngle = acos( nX / fH ); - sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 ); + sal_Int32 nAngle = static_cast<sal_Int32>(basegfx::rad2deg(fAngle) * 100.0); if( nY < 0 ) nAngle = 36000 - nAngle; if( bInitial ) // round to entire 15 degrees diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index 1e6fa863c638..ff8845ae2d4b 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -633,8 +633,8 @@ void Svx3DLightControl::Tracking( const TrackingEvent& rTEvt ) { if(mbGeometrySelected) { - double fNewRotX = mfSaveActionStartVer - (static_cast<double>(aDeltaPos.Y()) * F_PI180); - double fNewRotY = mfSaveActionStartHor + (static_cast<double>(aDeltaPos.X()) * F_PI180); + double fNewRotX = mfSaveActionStartVer - basegfx::deg2rad(aDeltaPos.Y()); + double fNewRotY = mfSaveActionStartHor + basegfx::deg2rad(aDeltaPos.X()); // cut horizontal while(fNewRotY < 0.0) @@ -731,15 +731,13 @@ void Svx3DLightControl::GetPosition(double& rHor, double& rVer) { basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight)); aDirection.normalize(); - rHor = atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI; // 0..2PI - rVer = atan2(aDirection.getY(), aDirection.getXZLength()); // -PI2..PI2 - rHor /= F_PI180; // 0..360.0 - rVer /= F_PI180; // -90.0..90.0 + rHor = basegfx::rad2deg(atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI); // 0..360.0 + rVer = basegfx::rad2deg(atan2(aDirection.getY(), aDirection.getXZLength())); // -90.0..90.0 } if(IsGeometrySelected()) { - rHor = mfRotateY / F_PI180; // 0..360.0 - rVer = mfRotateX / F_PI180; // -90.0..90.0 + rHor = basegfx::rad2deg(mfRotateY); // 0..360.0 + rVer = basegfx::rad2deg(mfRotateX); // -90.0..90.0 } } @@ -748,8 +746,8 @@ void Svx3DLightControl::SetPosition(double fHor, double fVer) if(IsSelectionValid()) { // set selected light's direction - fHor = (fHor * F_PI180) - F_PI; // -PI..PI - fVer *= F_PI180; // -PI2..PI2 + fHor = basegfx::deg2rad(fHor) - F_PI; // -PI..PI + fVer = basegfx::deg2rad(fVer); // -PI2..PI2 basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor)); aDirection.normalize(); @@ -782,8 +780,8 @@ void Svx3DLightControl::SetPosition(double fHor, double fVer) { if(mfRotateX != fVer || mfRotateY != fHor) { - mfRotateX = fVer * F_PI180; - mfRotateY = fHor * F_PI180; + mfRotateX = basegfx::deg2rad(fVer); + mfRotateY = basegfx::deg2rad(fHor); if(mp3DObj) { diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 6052a6df9610..dd53fed14666 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -368,8 +368,8 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt) } // to radians - fWAngle *= F_PI180; - fHAngle *= F_PI180; + fWAngle = basegfx::deg2rad(fWAngle); + fHAngle = basegfx::deg2rad(fHAngle); // Determine transformation basegfx::B3DHomMatrix aRotMat; diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index d3cf4bf8fbe5..139b98d170ac 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -474,7 +474,7 @@ void E3dObject::NbcRotate(const Point& rRef, long nAngle, double sn, double cs) // Before turning the glue points are defined relative to the page. They // take no part in the rotation of the scene. To ensure this, there is the // SetGlueReallyAbsolute(sal_True); - double fAngleInRad = nAngle/100.0 * F_PI180; + double fAngleInRad = basegfx::deg2rad(nAngle/100.0); basegfx::B3DHomMatrix aRotateZ; aRotateZ.rotate(0.0, 0.0, fAngleInRad); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 4e3d06bea40a..32f413ab3567 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -642,7 +642,7 @@ void E3dScene::NbcRotate(const Point& rRef, long nAngle, double sn, double cs) // through the enter of aOutRect's (Steiner's theorem), so RotateZ RotateScene (rRef, sn, cs); // Rotates the scene - double fAngleInRad = nAngle/100.0 * F_PI180; + double fAngleInRad = basegfx::deg2rad(nAngle/100.0); basegfx::B3DHomMatrix aRotation; aRotation.rotate(0.0, 0.0, fAngleInRad); diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 10089a8b0dd0..c3f8666ad1d9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -173,7 +173,8 @@ namespace sdr { basegfx::B2DVector aTranslation(0.5, 0.5); aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() ); - aTextBoxMatrix.rotate((360.0 - GetCustomShapeObj().GetExtraTextRotation(true)) * F_PI180); + aTextBoxMatrix.rotate(basegfx::deg2rad( + 360.0 - GetCustomShapeObj().GetExtraTextRotation(true))); aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() ); } // give text object a size @@ -199,7 +200,7 @@ namespace sdr ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ), ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) ); aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() ); - aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); + aTextBoxMatrix.rotate(basegfx::deg2rad(360.0 - fExtraTextRotation)); aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() ); } diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index a2ca6ffe7b05..a7af478edc10 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -116,7 +116,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfSdrOle2Obj::c const drawinglayer::attribute::FillHatchAttribute aFillHatch( drawinglayer::attribute::HatchStyle::Single, // single hatch 125.0, // 1.25 mm - 45.0 * F_PI180, // 45 degree diagonal + basegfx::deg2rad(45.0), // 45 degree diagonal COL_BLACK.getBColor(), // black color 3, // same default as VCL, a minimum of three discrete units (pixels) offset false); // no filling diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx index 367b336a3579..a511bd045276 100644 --- a/svx/source/sdr/overlay/overlaytools.cxx +++ b/svx/source/sdr/overlay/overlaytools.cxx @@ -344,7 +344,7 @@ namespace drawinglayer // for high contrast, use hatch const basegfx::BColor aHighContrastLineColor(Application::GetSettings().GetStyleSettings().GetFontColor().getBColor()); const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0); - const double fHatchRotation(45 * F_PI180); + const double fHatchRotation(basegfx::deg2rad(45)); const double fDiscreteHatchDistance(3.0); const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute( drawinglayer::attribute::HatchStyle::Single, diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 4ee872eb681e..7dc13f36aa28 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -896,7 +896,8 @@ namespace drawinglayer const double fDistance(rSet.Get(SDRATTR_3DSCENE_DISTANCE).GetValue()); // get shadow slant - const double fShadowSlant(F_PI180 * rSet.Get(SDRATTR_3DSCENE_SHADOW_SLANT).GetValue()); + const double fShadowSlant( + basegfx::deg2rad(rSet.Get(SDRATTR_3DSCENE_SHADOW_SLANT).GetValue())); // get shade mode css::drawing::ShadeMode aShadeMode(css::drawing::ShadeMode_FLAT); diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 191d7811f7bd..1fd696ad0d6a 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -104,8 +104,8 @@ namespace drawinglayer if(getTextRotation()) { - aTextMatrix.rotate(-90.0 * F_PI180); - fTestAngle -= (90.0 * F_PI180); + aTextMatrix.rotate(-F_PI2); + fTestAngle -= (F_PI2); if(getTextAutoAngle() && fTestAngle < -F_PI) { diff --git a/svx/source/sidebar/possize/SidebarDialControl.cxx b/svx/source/sidebar/possize/SidebarDialControl.cxx index a934a9a08ebb..55593f87e723 100644 --- a/svx/source/sidebar/possize/SidebarDialControl.cxx +++ b/svx/source/sidebar/possize/SidebarDialControl.cxx @@ -56,7 +56,7 @@ void SidebarDialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) if( fH != 0.0 ) { double fAngle = acos( nX / fH ); - sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 ); + sal_Int32 nAngle = static_cast<sal_Int32>(basegfx::deg2rad(fAngle) * 100.0); if( nY < 0 ) nAngle = 36000 - nAngle; if( bInitial ) // round to entire 15 degrees diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx index 660f94b0d61b..640636bf44c9 100644 --- a/svx/source/svdraw/gradtrns.cxx +++ b/svx/source/svdraw/gradtrns.cxx @@ -68,7 +68,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; @@ -91,7 +91,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; @@ -115,7 +115,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; @@ -150,7 +150,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetAngle()) { - const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); + const double fAngle = basegfx::deg2rad(rG.aGradient.GetAngle() / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; @@ -219,8 +219,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r aFullVec.normalize(); - double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX())); - fNewFullAngle /= F_PI180; + double fNewFullAngle(basegfx::rad2deg(atan2(aFullVec.getY(), aFullVec.getX()))); fNewFullAngle *= -10.0; fNewFullAngle += 900.0; @@ -304,8 +303,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r } aFullVec.normalize(); - double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX())); - fNewFullAngle /= F_PI180; + double fNewFullAngle(basegfx::rad2deg(atan2(aFullVec.getY(), aFullVec.getX()))); fNewFullAngle *= -10.0; fNewFullAngle += 900.0; @@ -400,8 +398,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r // angle is not definitely necessary for these modes, but it makes // controlling more fun for the user aFullVec.normalize(); - double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX())); - fNewFullAngle /= F_PI180; + double fNewFullAngle(basegfx::rad2deg(atan2(aFullVec.getY(), aFullVec.getX()))); fNewFullAngle *= -10.0; fNewFullAngle += 900.0; @@ -496,8 +493,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r // angle is not definitely necessary for these modes, but it makes // controlling more fun for the user aFullVec.normalize(); - double fNewFullAngle(atan2(aFullVec.getY(), aFullVec.getX())); - fNewFullAngle /= F_PI180; + double fNewFullAngle(basegfx::rad2deg(atan2(aFullVec.getY(), aFullVec.getX()))); fNewFullAngle *= -10.0; fNewFullAngle += 900.0; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 8d839abb77d5..317dd6daa40d 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1741,7 +1741,8 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded() if ( nShearAngle ) ShearPoint( aGlue, aRef, fTan ); - RotatePoint( aGlue, aRef, sin( fObjectRotation * F_PI180 ), cos( fObjectRotation * F_PI180 ) ); + RotatePoint(aGlue, aRef, sin(basegfx::deg2rad(fObjectRotation)), + cos(basegfx::deg2rad(fObjectRotation))); if ( bMirroredX ) aGlue.setX( maRect.GetWidth() - aGlue.X() ); if ( bMirroredY ) @@ -2938,7 +2939,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, // #i123181# The fix for #121932# here was wrong, the trunk version does not correct the // mirrored shear values, neither at the object level, nor on the API or XML level. Taking // back the mirroring of the shear angle - aGeoStat.nShearAngle = FRound((atan(fShearX) / F_PI180) * 100.0); + aGeoStat.nShearAngle = FRound(basegfx::rad2deg(atan(fShearX)) * 100.0); aGeoStat.RecalcTan(); Shear(Point(), aGeoStat.nShearAngle, aGeoStat.nTan, false); } @@ -2967,8 +2968,8 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, bool SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const { // get turn and shear - double fRotate = fObjectRotation * F_PI180; - double fShearX = (aGeo.nShearAngle / 100.0) * F_PI180; + double fRotate = basegfx::deg2rad(fObjectRotation); + double fShearX = basegfx::deg2rad(aGeo.nShearAngle / 100.0); // get aRect, this is the unrotated snaprect tools::Rectangle aRectangle(maRect); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 54fcda68de12..b0799a92b5d8 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1603,8 +1603,8 @@ void SdrTextObj::SetVerticalWriting(bool bVertical) bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const { // get turn and shear - double fRotate = (aGeo.nRotationAngle / 100.0) * F_PI180; - double fShearX = (aGeo.nShearAngle / 100.0) * F_PI180; + double fRotate = basegfx::deg2rad(aGeo.nRotationAngle / 100.0); + double fShearX = basegfx::deg2rad(aGeo.nShearAngle / 100.0); // get aRect, this is the unrotated snaprect tools::Rectangle aRectangle(maRect); @@ -1690,7 +1690,7 @@ void SdrTextObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b if(!basegfx::fTools::equalZero(fShearX)) { GeoStat aGeoStat; - aGeoStat.nShearAngle = FRound((atan(fShearX) / F_PI180) * 100.0); + aGeoStat.nShearAngle = FRound(basegfx::rad2deg(atan(fShearX)) * 100.0); aGeoStat.RecalcTan(); Shear(Point(), aGeoStat.nShearAngle, aGeoStat.nTan, false); } |