[Libreoffice-commits] core.git: basegfx/source basegfx/test canvas/source chart2/qa chart2/source cppcanvas/source drawinglayer/source filter/source include/basegfx include/drawinglayer include/vcl oox/source sax/source sc/source slideshow/source svgio/source svx/source sw/source tools/source vcl/backendtest vcl/headless vcl/opengl vcl/source vcl/workben
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Aug 4 18:51:50 UTC 2018
basegfx/source/curve/b2dcubicbezier.cxx | 3
basegfx/source/matrix/b2dhommatrix.cxx | 2
basegfx/source/polygon/b2dlinegeometry.cxx | 2
basegfx/source/polygon/b2dsvgpolypolygon.cxx | 5
basegfx/test/basegfx2d.cxx | 16 +-
canvas/source/vcl/canvashelper.cxx | 2
chart2/qa/extras/chart2dump/reference/piecharttest/normal_pie_chart.txt | 6
chart2/source/controller/main/DragMethod_RotateDiagram.cxx | 6
chart2/source/tools/ThreeDHelper.cxx | 64 +++++-----
chart2/source/view/axes/VCartesianAxis.cxx | 6
chart2/source/view/axes/VPolarAngleAxis.cxx | 2
chart2/source/view/charttypes/VSeriesPlotter.cxx | 2
chart2/source/view/main/AbstractShapeFactory.cxx | 2
chart2/source/view/main/LabelPositionHelper.cxx | 42 +++---
chart2/source/view/main/PlottingPositionHelper.cxx | 2
chart2/source/view/main/PolarLabelPositionHelper.cxx | 2
chart2/source/view/main/ShapeFactory.cxx | 20 +--
chart2/source/view/main/VPolarTransformation.cxx | 2
chart2/source/view/main/VTitle.cxx | 2
cppcanvas/source/mtfrenderer/emfplus.cxx | 6
drawinglayer/source/attribute/lineattribute.cxx | 2
drawinglayer/source/primitive2d/polygonprimitive2d.cxx | 2
drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 2
drawinglayer/source/tools/emfphelperdata.cxx | 8 -
filter/source/graphicfilter/ipict/shape.cxx | 5
filter/source/msfilter/msdffimp.cxx | 6
include/basegfx/numeric/ftools.hxx | 4
include/basegfx/polygon/b2dlinegeometry.hxx | 4
include/drawinglayer/attribute/lineattribute.hxx | 2
include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx | 4
include/vcl/outdev.hxx | 4
oox/source/drawingml/chart/converterbase.cxx | 2
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 4
oox/source/drawingml/effectproperties.cxx | 2
oox/source/drawingml/shape.cxx | 4
oox/source/export/drawingml.cxx | 2
sax/source/tools/converter.cxx | 2
sc/source/core/data/documen4.cxx | 2
sc/source/core/tool/interpr1.cxx | 4
slideshow/source/engine/shapes/drawinglayeranimation.cxx | 2
slideshow/source/engine/tools.cxx | 4
svgio/source/svgreader/svgcharacternode.cxx | 6
svgio/source/svgreader/svgtools.cxx | 2
svx/source/customshapes/EnhancedCustomShape2d.cxx | 20 +--
svx/source/customshapes/EnhancedCustomShape3d.cxx | 10 -
svx/source/dialog/dialcontrol.cxx | 8 -
svx/source/dialog/dlgctl3d.cxx | 22 +--
svx/source/engine3d/dragmt3d.cxx | 4
svx/source/engine3d/obj3d.cxx | 2
svx/source/engine3d/scene3d.cxx | 2
svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 5
svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx | 2
svx/source/sdr/overlay/overlaytools.cxx | 2
svx/source/sdr/primitive2d/sdrattributecreator.cxx | 3
svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx | 4
svx/source/sidebar/possize/SidebarDialControl.cxx | 2
svx/source/svdraw/gradtrns.cxx | 20 +--
svx/source/svdraw/svdoashp.cxx | 9 -
svx/source/svdraw/svdotext.cxx | 6
sw/source/core/doc/notxtfrm.cxx | 2
sw/source/core/edit/edfcol.cxx | 2
sw/source/uibase/docvw/ShadowOverlayObject.cxx | 6
tools/source/generic/poly.cxx | 6
vcl/backendtest/VisualBackendTest.cxx | 4
vcl/headless/svpgdi.cxx | 2
vcl/opengl/gdiimpl.cxx | 2
vcl/source/bitmap/BitmapEmbossGreyFilter.cxx | 4
vcl/source/outdev/line.cxx | 4
vcl/source/outdev/polygon.cxx | 6
vcl/source/outdev/polyline.cxx | 8 -
vcl/source/outdev/transparent.cxx | 4
vcl/source/window/scrwnd.cxx | 2
vcl/workben/svptest.cxx | 6
73 files changed, 229 insertions(+), 223 deletions(-)
New commits:
commit 8c48d69f06ddb3cb6c807a1e7db62dddb9778ded
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Aug 4 10:37:17 2018 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Aug 4 20:51:27 2018 +0200
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 at collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx
index db2c7baed0b1..c0adc5a09b37 100644
--- a/basegfx/source/curve/b2dcubicbezier.cxx
+++ b/basegfx/source/curve/b2dcubicbezier.cxx
@@ -532,7 +532,8 @@ namespace basegfx
if(isBezier())
{
// use support method #i37443# and allow unsharpen the criteria
- ImpSubDivAngleStart(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget, fAngleBound * F_PI180);
+ ImpSubDivAngleStart(maStartPoint, maControlPointA, maControlPointB, maEndPoint, rTarget,
+ deg2rad(fAngleBound));
}
else
{
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx
index 053ca89d02de..1e991304a4f0 100644
--- a/basegfx/source/matrix/b2dhommatrix.cxx
+++ b/basegfx/source/matrix/b2dhommatrix.cxx
@@ -282,7 +282,7 @@ namespace basegfx
{
// there is - 180 degree rotated
rScale *= -1;
- rRotate = 180*F_PI180;
+ rRotate = M_PI;
}
}
else
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index d9c24377a16e..ca4b88238383 100644
--- a/basegfx/source/polygon/b2dlinegeometry.cxx
+++ b/basegfx/source/polygon/b2dlinegeometry.cxx
@@ -104,7 +104,7 @@ namespace basegfx
// from that vector, take the needed rotation and add rotate for arrow to transformation
const B2DVector aTargetDirection(aHead - aTail);
- const double fRotation(atan2(aTargetDirection.getY(), aTargetDirection.getX()) + (90.0 * F_PI180));
+ const double fRotation(atan2(aTargetDirection.getY(), aTargetDirection.getX()) + F_PI2);
// rotate around docking position
aArrowTransform.rotate(fRotation);
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index 4522ec94f99b..2de0daf1e82f 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -489,7 +489,8 @@ namespace basegfx
// |y1'| = |-sin phi cos phi| |(y1 - y2)/2|
const B2DPoint p1(nLastX, nLastY);
const B2DPoint p2(nX, nY);
- B2DHomMatrix aTransform(basegfx::utils::createRotateB2DHomMatrix(-fPhi*M_PI/180));
+ B2DHomMatrix aTransform(basegfx::utils::createRotateB2DHomMatrix(
+ -deg2rad(fPhi)));
const B2DPoint p1_prime( aTransform * B2DPoint(((p1-p2)/2.0)) );
@@ -581,7 +582,7 @@ namespace basegfx
aTransform = basegfx::utils::createScaleB2DHomMatrix(fRX, fRY);
aTransform.translate(aCenter_prime.getX(),
aCenter_prime.getY());
- aTransform.rotate(fPhi*M_PI/180);
+ aTransform.rotate(deg2rad(fPhi));
const B2DPoint aOffset((p1+p2)/2.0);
aTransform.translate(aOffset.getX(),
aOffset.getY());
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index 82131b417b23..acc28f91014b 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -234,7 +234,7 @@ public:
void rotate()
{
B2DHomMatrix mat;
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi/2 yields exact matrix", 0.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -247,7 +247,7 @@ public:
"rotate pi/2 yields exact matrix", 0.0, mat.get(1,1), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi/2 yields exact matrix", 0.0, mat.get(1,2), 1E-12);
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi yields exact matrix", -1.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -260,7 +260,7 @@ public:
"rotate pi yields exact matrix", -1.0, mat.get(1,1), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi yields exact matrix", 0.0, mat.get(1,2), 1E-12);
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate 3/2 pi yields exact matrix", 0.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -273,7 +273,7 @@ public:
"rotate 3/2 pi yields exact matrix", 0.0, mat.get(1,1), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate 3/2 pi yields exact matrix", 0.0, mat.get(1,2), 1E-12);
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate 2 pi yields exact matrix", 1.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -407,8 +407,8 @@ public:
// are just the two rightmost values and uncritical
static double fSX(10.0);
static double fSY(12.0);
- static double fR(45.0 * F_PI180);
- static double fS(15.0 * F_PI180);
+ static double fR(F_PI4);
+ static double fS(deg2rad(15.0));
// check all possible scaling combinations
CPPUNIT_ASSERT_MESSAGE("decompose: error test A1", impDecomposeComposeTest(fSX, fSY, 0.0, 0.0));
@@ -468,7 +468,7 @@ public:
B2DHomMatrix aTest=utils::createScaleShearXRotateTranslateB2DHomMatrix(
6425,3938,
0,
- 180*F_PI180,
+ F_PI,
10482,4921);
// decompose that matrix
B2DTuple aDScale;
@@ -479,7 +479,7 @@ public:
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", 6425.0, aDScale.getX(), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", 3938.0, aDScale.getY(), 1E-12);
CPPUNIT_ASSERT_MESSAGE("decompose: error test J1", aDTrans.getX() == 10482 && aDTrans.getY() == 4921);
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", 180*F_PI180, fDRot, 1E-12 );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", F_PI, fDRot, 1E-12 );
}
// Change the following lines only, if you add, remove or rename
diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index 2d4a29e04ace..cdbf15cd6b88 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -390,7 +390,7 @@ namespace vclcanvas
strokeAttributes.StrokeWidth*0.5,
b2DJoineFromJoin(strokeAttributes.JoinType),
unoCapeFromCap(strokeAttributes.StartCapType),
- 12.5 * F_PI180 /* default fMaxAllowedAngle*/ ,
+ basegfx::deg2rad(12.5) /* default fMaxAllowedAngle*/ ,
0.4 /* default fMaxPartOfEdge*/ ,
fMiterMinimumAngle
));
diff --git a/chart2/qa/extras/chart2dump/reference/piecharttest/normal_pie_chart.txt b/chart2/qa/extras/chart2dump/reference/piecharttest/normal_pie_chart.txt
index c009c97be800..1b97446cc2d8 100644
--- a/chart2/qa/extras/chart2dump/reference/piecharttest/normal_pie_chart.txt
+++ b/chart2/qa/extras/chart2dump/reference/piecharttest/normal_pie_chart.txt
@@ -35,15 +35,15 @@
16728590
/// /D=0:CS=0:CT=0:Series=0:Point=2
// aSlicePosition.X
-7678
+7679
// aSlicePosition.Y
1846
// aSliceSize.Height
3896
// aSliceSize.Width
-3327
+3326
// aSliceTransformation
-3327;0;7678;0;3896;1846;0;0;1
+3326;0;7679;0;3896;1846;0;0;1
// static_cast<sal_Int32>(aSliceFillStyle)
1
// static_cast<sal_Int32>(aSliceFillColor)
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
index 74bb7f7dd3a7..ccee914fdfbd 100644
--- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
+++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
@@ -113,7 +113,7 @@ void DragMethod_RotateDiagram::MoveSdrDrag(const Point& rPnt)
Hide();
//calculate new angle
- double fX = F_PI / 2.0 * static_cast<double>(rPnt.Y() - m_aStartPos.Y())
+ double fX = F_PI2 * static_cast<double>(rPnt.Y() - m_aStartPos.Y())
/ (m_aReferenceRect.GetHeight() > 0 ? static_cast<double>(m_aReferenceRect.GetHeight()) : 1.0);
double fY = F_PI * static_cast<double>(rPnt.X() - m_aStartPos.X())
/ (m_aReferenceRect.GetWidth() > 0 ? static_cast<double>(m_aReferenceRect.GetWidth()) : 1.0);
@@ -140,8 +140,8 @@ void DragMethod_RotateDiagram::MoveSdrDrag(const Point& rPnt)
+ atan((fCx - rPnt.X())/(fCy-rPnt.Y()));
}
- m_nAdditionalHorizontalAngleDegree = static_cast<sal_Int32>(m_fAdditionalXAngleRad*180.0/F_PI);
- m_nAdditionalVerticalAngleDegree = -static_cast<sal_Int32>(m_fAdditionalYAngleRad*180.0/F_PI);
+ m_nAdditionalHorizontalAngleDegree = static_cast<sal_Int32>(basegfx::rad2deg(m_fAdditionalXAngleRad));
+ m_nAdditionalVerticalAngleDegree = -static_cast<sal_Int32>(basegfx::rad2deg(m_fAdditionalYAngleRad));
DragStat().NextMove(rPnt);
Show();
diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx
index 3967ce42868d..067642e5a149 100644
--- a/chart2/source/tools/ThreeDHelper.cxx
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -404,8 +404,8 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
double& y = rfYAngleRad;
double& z = rfZAngleRad;
- double E = F_PI*nElevationDeg/180; //elevation in Rad
- double R = F_PI*nRotationDeg/180; //rotation in Rad
+ double E = basegfx::deg2rad(nElevationDeg); //elevation in Rad
+ double R = basegfx::deg2rad(nRotationDeg); //rotation in Rad
if( (nRotationDeg == 0 || nRotationDeg == 180 )
&& ( nElevationDeg == 90 || nElevationDeg == 270 ) )
@@ -415,20 +415,20 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
//element 23
double f23 = cos(R)*sin(E);
if(f23>0)
- x = F_PI/2;
+ x = F_PI2;
else
- x = -F_PI/2;
+ x = -F_PI2;
y = R;
}
else if( ( nRotationDeg == 90 || nRotationDeg == 270 )
&& ( nElevationDeg == 90 || nElevationDeg == 270 ) )
{
//cR==0 && cE==0
- z = F_PI/2;
+ z = F_PI2;
if( sin(R)>0 )
- x = F_PI/2.0;
+ x = F_PI2;
else
- x = -F_PI/2.0;
+ x = -F_PI2;
if( (sin(R)*sin(E))>0 )
y = 0.0;
@@ -450,9 +450,9 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
z = 0.0;
if( (sin(R)/cos(E))>0 )
- y = F_PI/2;
+ y = F_PI2;
else
- y = -F_PI/2;
+ y = -F_PI2;
if( (cos(E))>0 )
x = 0;
@@ -477,9 +477,9 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
z = atan(sin(R)/(cos(R)*sin(E)));
//use element 13 for sign for x
if( (sin(R)*sin(z))>0.0 )
- x = F_PI/2;
+ x = F_PI2;
else
- x = -F_PI/2;
+ x = -F_PI2;
//use element 21 for y
if( (sin(R)*sin(E)*sin(z))>0.0)
y = 0.0;
@@ -501,8 +501,8 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad(
//sE!=0 cE!=0 cR==0
//z = +- F_PI/2;
//x = +- F_PI/2;
- z = F_PI/2;
- x = F_PI/2;
+ z = F_PI2;
+ x = F_PI2;
double sR = sin(R);
if( sR<0.0 )
x *= -1.0; //different signs for x and z
@@ -610,9 +610,9 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
//element 23
double f23 = cos(z)*sin(x) / cos(R);
if( f23 > 0 )
- E = F_PI/2.0;
+ E = F_PI2;
else
- E = -F_PI/2.0;
+ E = -F_PI2;
}
else if( lcl_isCosZero(z) )
{
@@ -622,16 +622,16 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z);
//element 13+11
if( f13 > 0 )
- R = F_PI/2.0;
+ R = F_PI2;
else
- R = -F_PI/2.0;
+ R = -F_PI2;
//element 21
double f21 = cos(y)*sin(z) / sin(R);
if( f21 > 0 )
- E = F_PI/2.0;
+ E = F_PI2;
else
- E = -F_PI/2.0;
+ E = -F_PI2;
}
else
{
@@ -646,9 +646,9 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
//element 23
double f23 = cos(z)*sin(x);
if( f23/cos(R) > 0 )
- E = F_PI/2.0;
+ E = F_PI2;
else
- E = -F_PI/2.0;
+ E = -F_PI2;
}
}
else if( lcl_isSinZero(x) )
@@ -688,16 +688,16 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z);
//element 13+11
if( f13 > 0 )
- R = F_PI/2.0;
+ R = F_PI2;
else
- R = -F_PI/2.0;
+ R = -F_PI2;
//element 21+22
double f21 = cos(y)*sin(z);
if( f21/sin(R) > 0 )
- E = F_PI/2.0;
+ E = F_PI2;
else
- E = -F_PI/2.0;
+ E = -F_PI2;
}
else
{
@@ -722,9 +722,9 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
double f13 = sin(x)*sin(z)+cos(x)*cos(z)*sin(y);
if( f13 >= 0 )
- R = F_PI/2.0;
+ R = F_PI2;
else
- R = -F_PI/2.0;
+ R = -F_PI2;
double f22 = cos(x)*cos(z)+sin(x)*sin(y)*sin(z);
if( f22 >= 0 )
@@ -790,20 +790,20 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg(
R=0;//13 -> R=0 or F_PI
if( f11<0.0 )
R=F_PI;
- E=F_PI/2;//22 -> E=+-F_PI/2
+ E=F_PI2;//22 -> E=+-F_PI/2
//use element 11 and 23 for sign
double f23 = cos(z)*sin(x);
if( (f11*f23*sin(E))<0.0 )
- E=-F_PI/2.0;
+ E=-F_PI2;
}
else if( lcl_isCosZero(z) )
{
//cosY!=0 sinY!=0 cosX=0 cosZ=0
//element 11 & 13:
if( (sin(x)*sin(z))>0.0 )
- R=F_PI/2.0;
+ R=F_PI2;
else
- R=-F_PI/2.0;
+ R=-F_PI2;
//element 22:
E=acos( sin(x)*sin(y)*sin(z));
//use element 21 for sign:
@@ -920,7 +920,7 @@ void ThreeDHelper::getRotationAngleFromDiagram(
rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getY());
rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getZ());
- if(rfZAngleRad<(-F_PI/2) || rfZAngleRad>(F_PI/2))
+ if(rfZAngleRad<-F_PI2 || rfZAngleRad>F_PI2)
{
rfZAngleRad-=F_PI;
rfXAngleRad-=F_PI;
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 903e3b38405a..f88a45fe56dc 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -137,7 +137,7 @@ Reference< drawing::XShape > createSingleLabel(
return nullptr;
// #i78696# use mathematically correct rotation now
- const double fRotationAnglePi(rAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0));
+ const double fRotationAnglePi(-basegfx::deg2rad(rAxisLabelProperties.fRotationAngleDegree));
uno::Any aATransformation = AbstractShapeFactory::makeTransformation( rAnchorScreenPosition2D, fRotationAnglePi );
OUString aLabel = AbstractShapeFactory::getStackedString( rLabel, rAxisLabelProperties.bStackCharacters );
@@ -183,7 +183,7 @@ void lcl_getRotatedPolygon( B2DPolygon &aPoly, const ::basegfx::B2DRectangle &aR
// which is then moved to its final position by using the top-left
// vertex of the text label bounding box (aPos) as the translation vector.
::basegfx::B2DHomMatrix aMatrix;
- aMatrix.rotate( -fRotationAngleDegree*M_PI/180.0 );
+ aMatrix.rotate(-basegfx::deg2rad(fRotationAngleDegree));
aMatrix.translate( aPos.X, aPos.Y);
aPoly.transform( aMatrix );
}
@@ -1713,7 +1713,7 @@ void VCartesianAxis::updatePositions()
}
// #i78696# use mathematically correct rotation now
- const double fRotationAnglePi(fRotationAngleDegree * (F_PI / -180.0));
+ const double fRotationAnglePi(-basegfx::deg2rad(fRotationAngleDegree));
uno::Any aATransformation = AbstractShapeFactory::makeTransformation(aAnchorScreenPosition2D, fRotationAnglePi);
//set new position
diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx
index 64ec7be67d6f..bc13eb5830a9 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.cxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -121,7 +121,7 @@ void VPolarAngleAxis::createTextShapes_ForAngleAxis(
LabelPositionHelper::changeTextAdjustment( aPropValues, aPropNames, eLabelAlignment );
// #i78696# use mathematically correct rotation now
- const double fRotationAnglePi(rAxisLabelProperties.fRotationAngleDegree * (F_PI / -180.0));
+ const double fRotationAnglePi(-basegfx::deg2rad(rAxisLabelProperties.fRotationAngleDegree));
uno::Any aATransformation = AbstractShapeFactory::makeTransformation( aAnchorScreenPosition2D, fRotationAnglePi );
OUString aStackedLabel = AbstractShapeFactory::getStackedString( aLabel, rAxisLabelProperties.bStackCharacters );
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 2172206fb8c8..a52911ee76da 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -724,7 +724,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
const awt::Point aUnrotatedTextPos( xTextShape->getPosition() );
if( fRotationDegrees != 0.0 )
{
- const double fDegreesPi( fRotationDegrees * ( F_PI / -180.0 ) );
+ const double fDegreesPi( -basegfx::deg2rad(fRotationDegrees) );
uno::Reference< beans::XPropertySet > xProp( xTextShape, uno::UNO_QUERY );
if( xProp.is() )
xProp->setPropertyValue( "Transformation", AbstractShapeFactory::makeTransformation( aScreenPosition2D, fDegreesPi ) );
diff --git a/chart2/source/view/main/AbstractShapeFactory.cxx b/chart2/source/view/main/AbstractShapeFactory.cxx
index 6e85eb79a9ce..c6c718a2e4dc 100644
--- a/chart2/source/view/main/AbstractShapeFactory.cxx
+++ b/chart2/source/view/main/AbstractShapeFactory.cxx
@@ -271,7 +271,7 @@ awt::Size AbstractShapeFactory::getSizeAfterRotation(
else if(fRotationAngleDegree>90.0)
fRotationAngleDegree=180.0-fRotationAngleDegree;
- const double fAnglePi = fRotationAngleDegree*F_PI/180.0;
+ const double fAnglePi = basegfx::deg2rad(fRotationAngleDegree);
aRet.Height = static_cast<sal_Int32>(
aSize.Width*rtl::math::sin( fAnglePi )
diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx
index 111a396a4b49..d97de691fc18 100644
--- a/chart2/source/view/main/LabelPositionHelper.cxx
+++ b/chart2/source/view/main/LabelPositionHelper.cxx
@@ -117,7 +117,7 @@ void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
, double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
{
//correct label positions for labels on a left side of something with a right centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree==0.0 )
{
}
@@ -129,7 +129,7 @@ void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI/2.0;
+ double beta = fAnglePi-F_PI2;
rfXCorrection = -aSize.Width *rtl::math::sin( beta )
-aSize.Height *rtl::math::cos( beta )/2.0;
if( bRotateAroundCenter )
@@ -160,7 +160,7 @@ void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
, double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
{
//correct label positions for labels on a right side of something with a left centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree== 0.0 )
{
}
@@ -182,7 +182,7 @@ void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI/2.0 - fAnglePi;
+ double beta = 3*F_PI2 - fAnglePi;
rfXCorrection = aSize.Width *rtl::math::sin( beta )
+aSize.Height*rtl::math::cos( beta )/2.0;
if( bRotateAroundCenter )
@@ -202,7 +202,7 @@ void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection
, double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
{
//correct label positions for labels on top of something with a bottom centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree== 0.0 )
{
}
@@ -215,7 +215,7 @@ void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi - F_PI/2.0;
+ double beta = fAnglePi - F_PI2;
rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
if( !bRotateAroundCenter )
rfXCorrection -= aSize.Width*rtl::math::sin( beta )/2.0;
@@ -244,7 +244,7 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
, double fAnglePositiveDegree, const awt::Size& aSize, bool bRotateAroundCenter )
{
//correct label positions for labels below something with a top centered alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree==0.0 )
{
}
@@ -257,7 +257,7 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI/2.0;
+ double beta = fAnglePi-F_PI2;
rfXCorrection = -aSize.Height*rtl::math::cos( beta )/2.0;
if( !bRotateAroundCenter )
rfXCorrection += aSize.Width *rtl::math::sin( beta )/2.0;
@@ -266,7 +266,7 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI/2.0 - fAnglePi;
+ double beta = 3*F_PI2 - fAnglePi;
rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
if( !bRotateAroundCenter )
rfXCorrection -= aSize.Width *rtl::math::sin( beta )/2.0;
@@ -287,7 +287,7 @@ void lcl_correctRotation_Left_Top( double& rfXCorrection, double& rfYCorrection
, double fAnglePositiveDegree, const awt::Size& aSize )
{
//correct position for labels at the left top corner of something with a bottom right alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree==0.0 )
{
}
@@ -297,14 +297,14 @@ void lcl_correctRotation_Left_Top( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI/2.0;
+ double beta = fAnglePi-F_PI2;
rfXCorrection = -aSize.Width*rtl::math::sin( beta );
rfYCorrection = -aSize.Height*rtl::math::sin( beta )
-aSize.Width*rtl::math::cos( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI/2.0 - fAnglePi;
+ double beta = 3*F_PI2 - fAnglePi;
rfXCorrection = -aSize.Height*rtl::math::cos( beta )
-aSize.Width*rtl::math::sin( beta );
rfYCorrection = -aSize.Height*rtl::math::sin( beta );
@@ -319,7 +319,7 @@ void lcl_correctRotation_Left_Bottom( double& rfXCorrection, double& rfYCorrecti
, double fAnglePositiveDegree, const awt::Size& aSize )
{
//correct position for labels at the left bottom corner of something with a top right alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree==0.0 )
{
}
@@ -329,14 +329,14 @@ void lcl_correctRotation_Left_Bottom( double& rfXCorrection, double& rfYCorrecti
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI/2.0;
+ double beta = fAnglePi-F_PI2;
rfXCorrection = -aSize.Width*rtl::math::sin( beta )
-aSize.Height*rtl::math::cos( beta );
rfYCorrection = aSize.Height*rtl::math::sin( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI/2.0 - fAnglePi;
+ double beta = 3*F_PI2 - fAnglePi;
rfXCorrection = -aSize.Width*rtl::math::sin( beta );
rfYCorrection = aSize.Width*rtl::math::cos( beta )
+aSize.Height*rtl::math::sin( beta );
@@ -351,7 +351,7 @@ void lcl_correctRotation_Right_Top( double& rfXCorrection, double& rfYCorrection
, double fAnglePositiveDegree, const awt::Size& aSize )
{
//correct position for labels at the right top corner of something with a bottom left alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree==0.0 )
{
}
@@ -361,14 +361,14 @@ void lcl_correctRotation_Right_Top( double& rfXCorrection, double& rfYCorrection
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI/2.0;
+ double beta = fAnglePi-F_PI2;
rfXCorrection = aSize.Width*rtl::math::sin( beta )
+aSize.Height*rtl::math::cos( beta );
rfYCorrection = -aSize.Height*rtl::math::sin( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI/2.0 - fAnglePi;
+ double beta = 3*F_PI2 - fAnglePi;
rfXCorrection = aSize.Width*rtl::math::sin( beta );
rfYCorrection = -aSize.Width*rtl::math::cos( beta )
-aSize.Height*rtl::math::sin( beta );
@@ -383,7 +383,7 @@ void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrect
, double fAnglePositiveDegree, const awt::Size& aSize )
{
//correct position for labels at the right bottom corner of something with a top left alignment
- double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAnglePositiveDegree);
if( fAnglePositiveDegree==0.0 )
{
}
@@ -393,14 +393,14 @@ void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrect
}
else if( fAnglePositiveDegree<= 180.0 )
{
- double beta = fAnglePi-F_PI/2.0;
+ double beta = fAnglePi-F_PI2;
rfXCorrection = aSize.Width*rtl::math::sin( beta );
rfYCorrection = aSize.Height*rtl::math::sin( beta )
+aSize.Width*rtl::math::cos( beta );
}
else if( fAnglePositiveDegree<= 270.0 )
{
- double beta = 3*F_PI/2.0 - fAnglePi;
+ double beta = 3*F_PI2 - fAnglePi;
rfXCorrection = aSize.Height*rtl::math::cos( beta )
+aSize.Width*rtl::math::sin( beta );
rfYCorrection = aSize.Height*rtl::math::sin( beta );
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx
index da5cc4159aca..32aa4394127f 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -613,7 +613,7 @@ drawing::Position3D PolarPlottingPositionHelper::transformScaledLogicToScene( do
drawing::Position3D PolarPlottingPositionHelper::transformUnitCircleToScene( double fUnitAngleDegree, double fUnitRadius
, double fLogicZ ) const
{
- double fAnglePi = fUnitAngleDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fUnitAngleDegree);
double fX=fUnitRadius*rtl::math::cos(fAnglePi);
double fY=fUnitRadius*rtl::math::sin(fAnglePi);
diff --git a/chart2/source/view/main/PolarLabelPositionHelper.cxx b/chart2/source/view/main/PolarLabelPositionHelper.cxx
index 07bf9e8bae85..ac2f1c50d317 100644
--- a/chart2/source/view/main/PolarLabelPositionHelper.cxx
+++ b/chart2/source/view/main/PolarLabelPositionHelper.cxx
@@ -109,7 +109,7 @@ awt::Point PolarLabelPositionHelper::getLabelScreenPositionAndAlignmentForUnitCi
fDY*=-1.0;//drawing layer has inverse y values
if( fDX != 0.0 )
{
- fAngleDegree = atan(fDY/fDX)*180.0/F_PI;
+ fAngleDegree = basegfx::rad2deg(atan(fDY/fDX));
if(fDX<0.0)
fAngleDegree+=180.0;
}
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 696ca39da940..a5f58bcc3c25 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -898,10 +898,11 @@ uno::Reference< drawing::XShape >
const double fAngleSubdivisionRadian = F_PI/10.0;
- drawing::PolyPolygonBezierCoords aCoords = getRingBezierCoords(
- fUnitCircleInnerRadius, fUnitCircleOuterRadius
- , fUnitCircleStartAngleDegree*F_PI/180.0, fUnitCircleWidthAngleDegree*F_PI/180.0
- , aTransformationFromUnitCircle, fAngleSubdivisionRadian );
+ drawing::PolyPolygonBezierCoords aCoords
+ = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius,
+ basegfx::deg2rad(fUnitCircleStartAngleDegree),
+ basegfx::deg2rad(fUnitCircleWidthAngleDegree),
+ aTransformationFromUnitCircle, fAngleSubdivisionRadian);
xProp->setPropertyValue( "PolyPolygonBezier", uno::Any( aCoords ) );
}
@@ -949,10 +950,11 @@ uno::Reference< drawing::XShape >
const double fAngleSubdivisionRadian = F_PI/32.0;
- drawing::PolyPolygonBezierCoords aCoords = getRingBezierCoords(
- fUnitCircleInnerRadius, fUnitCircleOuterRadius
- , fUnitCircleStartAngleDegree*F_PI/180.0, fUnitCircleWidthAngleDegree*F_PI/180.0
- , aTransformationFromUnitCircle, fAngleSubdivisionRadian );
+ drawing::PolyPolygonBezierCoords aCoords
+ = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius,
+ basegfx::deg2rad(fUnitCircleStartAngleDegree),
+ basegfx::deg2rad(fUnitCircleWidthAngleDegree),
+ aTransformationFromUnitCircle, fAngleSubdivisionRadian);
//depth
xProp->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH
@@ -2502,7 +2504,7 @@ uno::Reference< drawing::XShape >
//set position matrix
//the matrix needs to be set at the end behind autogrow and such position influencing properties
::basegfx::B2DHomMatrix aM;
- aM.rotate( -nRotation*F_PI/180.0 );//#i78696#->#i80521#
+ aM.rotate( -basegfx::deg2rad(nRotation) );//#i78696#->#i80521#
aM.translate( nXPos, nYPos );
xShapeProp->setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) );
}
diff --git a/chart2/source/view/main/VPolarTransformation.cxx b/chart2/source/view/main/VPolarTransformation.cxx
index 0692c6130c56..a82bc9961a81 100644
--- a/chart2/source/view/main/VPolarTransformation.cxx
+++ b/chart2/source/view/main/VPolarTransformation.cxx
@@ -51,7 +51,7 @@ Sequence< double > SAL_CALL VPolarTransformation::transform(
std::swap(fScaledLogicAngle,fScaledLogicRadius);
double fAngleDegree = m_aPositionHelper.transformToAngleDegree( fScaledLogicAngle, false );
- double fAnglePi = fAngleDegree*F_PI/180.0;
+ double fAnglePi = basegfx::deg2rad(fAngleDegree);
double fRadius = m_aPositionHelper.transformToRadius( fScaledLogicRadius, false);
double fX=fRadius*cos(fAnglePi);
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
index 7b74b93da35b..43f7a42b3337 100644
--- a/chart2/source/view/main/VTitle.cxx
+++ b/chart2/source/view/main/VTitle.cxx
@@ -62,7 +62,7 @@ void VTitle::init(
double VTitle::getRotationAnglePi() const
{
- return m_fRotationAngleDegree*F_PI/180.0;
+ return basegfx::deg2rad(m_fRotationAngleDegree);
}
awt::Size VTitle::getUnrotatedSize() const //size before rotation
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index a7dc17a11430..46e2659aea62 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -948,8 +948,8 @@ namespace cppcanvas
SAL_INFO("cppcanvas.emf", "EMF+\t RectData: " << dx << "," << dy << " " << dw << "x" << dh);
- startAngle = 2*M_PI*startAngle/360;
- sweepAngle = 2*M_PI*sweepAngle/360;
+ startAngle = basegfx::deg2rad(startAngle);
+ sweepAngle = basegfx::deg2rad(sweepAngle);
B2DPoint mappedCenter (Map (dx + dw/2, dy + dh/2));
B2DSize mappedSize( MapSize (dw/2, dh/2));
@@ -966,7 +966,7 @@ namespace cppcanvas
std::swap (endAngle, startAngle);
SAL_INFO("cppcanvas.emf", "EMF+\t adjusted angles: start " <<
- (360.0*startAngle/M_PI) << ", end: " << (360.0*endAngle/M_PI) <<
+ basegfx::rad2deg(startAngle) << ", end: " << basegfx::rad2deg(endAngle) <<
" startAngle: " << startAngle << " sweepAngle: " << sweepAngle);
B2DPolygon polygon = basegfx::utils::createPolygonFromEllipseSegment (mappedCenter, mappedSize.getX (), mappedSize.getY (), startAngle, endAngle);
diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx
index 583f1a1adfba..8aee1dab9427 100644
--- a/drawinglayer/source/attribute/lineattribute.cxx
+++ b/drawinglayer/source/attribute/lineattribute.cxx
@@ -55,7 +55,7 @@ namespace drawinglayer
mfWidth(0.0),
meLineJoin(basegfx::B2DLineJoin::Round),
meLineCap(css::drawing::LineCap_BUTT),
- mfMiterMinimumAngle(15.0 * F_PI180)
+ mfMiterMinimumAngle(basegfx::deg2rad(15.0))
{
}
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 28bd5f2fe714..e296f397e01b 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -253,7 +253,7 @@ namespace drawinglayer
fHalfLineWidth,
aLineJoin,
aLineCap,
- 12.5 * F_PI180 /* default fMaxAllowedAngle*/ ,
+ basegfx::deg2rad(12.5) /* default fMaxAllowedAngle*/ ,
0.4 /* default fMaxPartOfEdge*/ ,
fMiterMinimumAngle));
}
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 80db8e37c861..87c688d64082 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -466,7 +466,7 @@ namespace drawinglayer
{
eJoin = SvtGraphicStroke::joinMiter;
// ATM 15 degrees is assumed
- fMiterLength /= rtl::math::sin(M_PI * (15.0 / 360.0));
+ fMiterLength /= rtl::math::sin(basegfx::deg2rad(15.0));
break;
}
case basegfx::B2DLineJoin::Round :
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 79b48c8bdf9b..ebbcc2f3f5a7 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -966,8 +966,8 @@ namespace emfplushelper
float dx, dy, dw, dh;
ReadRectangle(rMS, dx, dy, dw, dh, bool(flags & 0x4000));
SAL_INFO("drawinglayer", "EMF+\t RectData: " << dx << "," << dy << " " << dw << "x" << dh);
- startAngle = 2 * M_PI*startAngle / 360;
- sweepAngle = 2 * M_PI*sweepAngle / 360;
+ startAngle = basegfx::deg2rad(startAngle);
+ sweepAngle = basegfx::deg2rad(sweepAngle);
::basegfx::B2DPoint mappedCenter(Map(dx + dw / 2, dy + dh / 2));
::basegfx::B2DSize mappedSize(MapSize(dw / 2, dh / 2));
float endAngle = startAngle + sweepAngle;
@@ -991,7 +991,7 @@ namespace emfplushelper
}
SAL_INFO("drawinglayer", "EMF+\t adjusted angles: start " <<
- (360.0*startAngle / M_PI) << ", end: " << (360.0*endAngle / M_PI) <<
+ basegfx::rad2deg(startAngle) << ", end: " << basegfx::rad2deg(endAngle) <<
" startAngle: " << startAngle << " sweepAngle: " << sweepAngle);
::basegfx::B2DPolygon polygon = basegfx::utils::createPolygonFromEllipseSegment(
@@ -1619,7 +1619,7 @@ namespace emfplushelper
", post multiply: " << (flags & 0x2000));
// Skipping flags & 0x2000
// For rotation transformation there is no difference between post and pre multiply
- maWorldTransform.rotate(eAngle * F_PI180);
+ maWorldTransform.rotate(basegfx::deg2rad(eAngle));
mappingChanged();
SAL_INFO("drawinglayer",
diff --git a/filter/source/graphicfilter/ipict/shape.cxx b/filter/source/graphicfilter/ipict/shape.cxx
index 219c48d4aec3..772632041a51 100644
--- a/filter/source/graphicfilter/ipict/shape.cxx
+++ b/filter/source/graphicfilter/ipict/shape.cxx
@@ -164,10 +164,9 @@ namespace PictReaderShape {
tools::Rectangle arc = PictReaderShapePrivate::contractRectangle(drawFrame, orig, pSize);
using namespace basegfx;
- double const PI2 = M_PI/2.0;
// pict angle are CW with 0 at twelve o'clock (with Y-axis inverted)...
- double angl1 = angle1-PI2;
- double angl2 = angle2-PI2;
+ double angl1 = angle1-M_PI_2;
+ double angl2 = angle2-M_PI_2;
long const X[2] = { arc.Left(), arc.Right() };
long const Y[2] = { arc.Top(), arc.Bottom() };
B2DPoint center(0.5*(X[1]+X[0]), 0.5*(Y[1]+Y[0]));
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index ff3df05d0cd1..9084e1b42638 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4580,8 +4580,10 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
fNumber = ( aStartPt.Y() >= cent.Y() ) ? 90.0: 270.0;
else
{
- fNumber = atan2( double( aStartPt.X() - cent.X() ),double( aStartPt.Y() - cent.Y() ) )+ F_PI; // 0..2PI
- fNumber /= F_PI180; // 0..360.0
+ fNumber
+ = basegfx::rad2deg(atan2(double(aStartPt.X() - cent.X()),
+ double(aStartPt.Y() - cent.Y()))
+ + F_PI); // 0..360.0
}
nEndAngle = NormAngle36000( - static_cast<sal_Int32>(fNumber) * 100 );
seqAdjustmentValues[ 0 ].Value <<= fNumber;
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
index 1ade3bb3a3d6..da453a1a1b3d 100644
--- a/include/basegfx/numeric/ftools.hxx
+++ b/include/basegfx/numeric/ftools.hxx
@@ -125,7 +125,7 @@ namespace basegfx
/** Convert value from degrees to radians
*/
- inline double deg2rad( double v )
+ constexpr double deg2rad( double v )
{
// divide first, to get exact values for v being a multiple of
// 90 degrees
@@ -134,7 +134,7 @@ namespace basegfx
/** Convert value radians to degrees
*/
- inline double rad2deg( double v )
+ constexpr double rad2deg( double v )
{
// divide first, to get exact values for v being a multiple of
// pi/2
diff --git a/include/basegfx/polygon/b2dlinegeometry.hxx b/include/basegfx/polygon/b2dlinegeometry.hxx
index 441e65ffc079..29be9934ede0 100644
--- a/include/basegfx/polygon/b2dlinegeometry.hxx
+++ b/include/basegfx/polygon/b2dlinegeometry.hxx
@@ -134,9 +134,9 @@ namespace basegfx
double fHalfLineWidth,
B2DLineJoin eJoin,
css::drawing::LineCap eCap,
- double fMaxAllowedAngle = (12.5 * F_PI180),
+ double fMaxAllowedAngle = basegfx::deg2rad(12.5),
double fMaxPartOfEdge = 0.4,
- double fMiterMinimumAngle = (15.0 * F_PI180));
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
} // end of namespace utils
} // end of namespace basegfx
diff --git a/include/drawinglayer/attribute/lineattribute.hxx b/include/drawinglayer/attribute/lineattribute.hxx
index 487dbcccf66b..4f01c1f574cb 100644
--- a/include/drawinglayer/attribute/lineattribute.hxx
+++ b/include/drawinglayer/attribute/lineattribute.hxx
@@ -58,7 +58,7 @@ namespace drawinglayer
double fWidth = 0.0,
basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLineJoin::Round,
css::drawing::LineCap aLineCap = css::drawing::LineCap_BUTT,
- double fMiterMinimumAngle = 15.0 * F_PI180);
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
LineAttribute();
LineAttribute(const LineAttribute&);
LineAttribute& operator=(const LineAttribute&);
diff --git a/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
index ed0732e48d70..8d1e0b365477 100644
--- a/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
+++ b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
@@ -73,8 +73,8 @@ namespace drawinglayer
double fRadius,
basegfx::B2DLineJoin aLineJoin,
css::drawing::LineCap aLineCap,
- double fDegreeStepWidth = 10.0 * F_PI180,
- double fMiterMinimumAngle = 15.0 * F_PI180);
+ double fDegreeStepWidth = basegfx::deg2rad(10.0),
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
/// data read access
double getRadius() const { return mfRadius; }
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 96fd4246a070..71a73b8e0b0f 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -779,7 +779,7 @@ public:
double fLineWidth = 0.0,
basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::Round,
css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
- double fMiterMinimumAngle = 15.0 * F_PI180);
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0));
/** Render the given polygon as a line stroke
@@ -802,7 +802,7 @@ public:
double fTransparency = 0.0,
basegfx::B2DLineJoin eLineJoin = basegfx::B2DLineJoin::NONE,
css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT,
- double fMiterMinimumAngle = 15.0 * F_PI180,
+ double fMiterMinimumAngle = basegfx::deg2rad(15.0),
bool bBypassAACheck = false);
private:
diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx
index a0535671dbc6..3d0b8c413bab 100644
--- a/oox/source/drawingml/chart/converterbase.cxx
+++ b/oox/source/drawingml/chart/converterbase.cxx
@@ -398,7 +398,7 @@ void LayoutConverter::convertFromModel( const Reference< XShape >& rxShape, doub
// the call to XShape.getSize() may recalc the chart view
awt::Size aShapeSize = rxShape->getSize();
// rotated shapes need special handling...
- double fSin = fabs( sin( fRotationAngle * F_PI180 ) );
+ double fSin = fabs( sin( basegfx::deg2rad(fRotationAngle) ) );
// add part of height to X direction, if title is rotated down
if( fRotationAngle > 180.0 )
aShapePos.X += static_cast< sal_Int32 >( fSin * aShapeSize.Height + 0.5 );
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index d3c006dc447a..ed0678340e4b 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -322,8 +322,8 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
{
const double fAngle = static_cast<double>(idx)*nSpanAngle/nShapes + nStartAngle;
const awt::Point aCurrPos(
- aCenter.Width + nRadius*sin(fAngle*F_PI180) - aChildSize.Width/2,
- aCenter.Height - nRadius*cos(fAngle*F_PI180) - aChildSize.Height/2);
+ aCenter.Width + nRadius*sin(basegfx::deg2rad(fAngle)) - aChildSize.Width/2,
+ aCenter.Height - nRadius*cos(basegfx::deg2rad(fAngle)) - aChildSize.Height/2);
aCurrShape->setPosition(aCurrPos);
aCurrShape->setSize(aChildSize);
diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx
index 49f1d915a11c..ff9ded567784 100644
--- a/oox/source/drawingml/effectproperties.cxx
+++ b/oox/source/drawingml/effectproperties.cxx
@@ -58,7 +58,7 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
attribIt->second >>= nAttrDist;
// Negative X or Y dist indicates left or up, respectively
- double nAngle = ( static_cast<double>(nAttrDir) / PER_DEGREE ) * F_PI180;
+ double nAngle = basegfx::deg2rad(static_cast<double>(nAttrDir) / PER_DEGREE);
sal_Int32 nDist = convertEmuToHmm( nAttrDist );
sal_Int32 nXDist = cos(nAngle) * nDist;
sal_Int32 nYDist = sin(nAngle) * nDist;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 70028b34fe87..5b75b94cdfba 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -653,7 +653,7 @@ Reference< XShape > const & Shape::createAndInsert(
{
// rotate diagram's shape around object's center before sizing
aTransformation.translate(-0.5, -0.5);
- aTransformation.rotate(F_PI180 * (mnDiagramRotation / 60000.0));
+ aTransformation.rotate(basegfx::deg2rad(mnDiagramRotation / 60000.0));
aTransformation.translate(0.5, 0.5);
}
@@ -702,7 +702,7 @@ Reference< XShape > const & Shape::createAndInsert(
}
}
// rotate around object's center
- aTransformation.rotate( F_PI180 * ( static_cast<double>(mnRotation) / 60000.0 ) );
+ aTransformation.rotate(basegfx::deg2rad(static_cast<double>(mnRotation) / 60000.0));
}
// move object back from center
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index b5d681dd1a13..e0fc6dbae783 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3298,7 +3298,7 @@ sal_Int32 lcl_CalculateDist(const double dX, const double dY)
sal_Int32 lcl_CalculateDir(const double dX, const double dY)
{
- return (static_cast< sal_Int32 >(atan2(dY,dX) * 180 * 60000 / M_PI) + 21600000) % 21600000;
+ return (static_cast< sal_Int32 >(basegfx::rad2deg(atan2(dY,dX)) * 60000) + 21600000) % 21600000;
}
void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index be9992d470ac..e8bd90f02c21 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -669,7 +669,7 @@ bool Converter::convertAngle(sal_Int16& rAngle, OUString const& rString)
}
else if (-1 != rString.indexOf("rad"))
{
- nValue = (fValue * 180.0 / M_PI) * 10.0;
+ nValue = basegfx::rad2deg(fValue) * 10.0;
}
else // no explicit unit
{
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 256fc8c1417d..873d980c53a7 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -155,7 +155,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
while ( !bDoneHorMove && !bHorMoveError && nHorIter++ < nHorMaxIter )
{
double fHorAngle = fHorStepAngle * static_cast<double>( nHorIter );
- double fHorTangent = ::rtl::math::tan( fHorAngle * F_PI / 180 );
+ double fHorTangent = ::rtl::math::tan(basegfx::deg2rad(fHorAngle));
sal_uInt16 nIdx = 0;
while( nIdx++ < 2 && !bDoneHorMove )
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 90b2ae7c5526..291aa746a75f 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1783,12 +1783,12 @@ void ScInterpreter::ScFalse()
void ScInterpreter::ScDeg()
{
- PushDouble((GetDouble() / F_PI) * 180.0);
+ PushDouble(basegfx::rad2deg(GetDouble()));
}
void ScInterpreter::ScRad()
{
- PushDouble(GetDouble() * (F_PI / 180));
+ PushDouble(basegfx::deg2rad(GetDouble()));
}
void ScInterpreter::ScSin()
diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx
index 05bd61f61f27..899663dedb16 100644
--- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx
+++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx
@@ -649,7 +649,7 @@ void ActivityImpl::updateShapeAttributes(
if( !::basegfx::fTools::equalZero( mfRotationAngle ))
{
maShapeAttrLayer.get()->setRotationAngle( mfRotationAngle );
- double const fRotate = (mfRotationAngle * M_PI / 180.0);
+ double const fRotate = basegfx::deg2rad(mfRotationAngle);
basegfx::B2DHomMatrix aTransform;
// position:
aTransform.rotate( fRotate );
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index 77e4160b4644..b0f1491fafac 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -87,7 +87,7 @@ namespace slideshow
pAttr->getShearYAngle() :
0.0 );
const double nRotation( pAttr->isRotationAngleValid() ?
- pAttr->getRotationAngle()*M_PI/180.0 :
+ basegfx::deg2rad(pAttr->getRotationAngle()) :
0.0 );
// scale, shear and rotation pivot point is the shape
@@ -492,7 +492,7 @@ namespace slideshow
pAttr->getShearYAngle() :
0.0 );
const double nRotation( pAttr->isRotationAngleValid() ?
- pAttr->getRotationAngle()*M_PI/180.0 :
+ basegfx::deg2rad(pAttr->getRotationAngle()) :
0.0 );
// scale, shear and rotation pivot point is the
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx
index b707cc26116a..dbcf95a84f3f 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -604,11 +604,9 @@ namespace svgio
// but it seems to be degrees. Convert here to radians
if(!maRotate.empty())
{
- const double fFactor(F_PI / 180.0);
-
- for(size_t a(0); a < maRotate.size(); a++)
+ for (double& f : maRotate)
{
- maRotate[a] *= fFactor;
+ f = basegfx::deg2rad(f);
}
}
diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx
index 76f61f489d95..8fa844ad5b46 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -595,7 +595,7 @@ namespace svgio
// convert to radians
if(deg == aType)
{
- fAngle *= F_PI / 180.0;
+ fAngle = basegfx::deg2rad(fAngle);
}
else if(grad == aType)
{
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);
}
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 6a18eb351e8d..5755a37472bc 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1292,7 +1292,7 @@ bool SwNoTextFrame::IsTransparent() const
// we can be more specific - rotations of multiples of
// 90 degrees will leave no gaps. Go from [0.0 .. F_2PI]
// to [0 .. 360] and check modulo 90
- const long nRot(static_cast<long>(getLocalFrameRotation() / F_PI180));
+ const long nRot(static_cast<long>(basegfx::rad2deg(getLocalFrameRotation())));
const bool bMultipleOf90(0 == (nRot % 90));
if(!bMultipleOf90)
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 7a59d2fe7c9b..1de00b60633d 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1525,7 +1525,7 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
basegfx::B2DHomMatrix aTransformation;
aTransformation.identity();
aTransformation.scale(nWidth, nHeight);
- aTransformation.rotate(F_PI180 * -1 * nAngle);
+ aTransformation.rotate(-basegfx::deg2rad(nAngle));
drawing::HomogenMatrix3 aMatrix;
aMatrix.Line1.Column1 = aTransformation.get(0, 0);
aMatrix.Line1.Column2 = aTransformation.get(0, 1);
diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.cxx b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
index 38bffa2218f9..eaafd60febc8 100644
--- a/sw/source/uibase/docvw/ShadowOverlayObject.cxx
+++ b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
@@ -84,7 +84,7 @@ void ShadowPrimitive::create2DDecomposition(
0.0,
0.5,
0.5,
- 1800.0 * F_PI1800,
+ F_PI,
basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
2);
@@ -103,7 +103,7 @@ void ShadowPrimitive::create2DDecomposition(
0.0,
0.5,
0.5,
- 1800.0 * F_PI1800,
+ F_PI,
basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
4);
@@ -122,7 +122,7 @@ void ShadowPrimitive::create2DDecomposition(
0.0,
0.5,
0.5,
- 1800.0 * F_PI1800,
+ F_PI,
basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
4);
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 5b00e6bc56a3..1c5717e8ec86 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1302,14 +1302,14 @@ void Polygon::ImplReduceEdges( tools::Polygon& rPoly, const double& rArea, sal_u
if( fabs( fTurnPrev ) < ( 1.0 + SMALL_DVALUE ) && fabs( fTurnPrev ) > ( 1.0 - SMALL_DVALUE ) )
fGradPrev = 0.0;
else
- fGradPrev = acos( fTurnPrev ) / ( aVec1.IsNegative( aVec2 ) ? -F_PI180 : F_PI180 );
+ fGradPrev = basegfx::rad2deg(acos(fTurnPrev)) * (aVec1.IsNegative(aVec2) ? -1 : 1);
- fGradB = acos( fTurnB ) / ( aVec2.IsNegative( aVec3 ) ? -F_PI180 : F_PI180 );
+ fGradB = basegfx::rad2deg(acos(fTurnB)) * (aVec2.IsNegative(aVec3) ? -1 : 1);
if( fabs( fTurnNext ) < ( 1.0 + SMALL_DVALUE ) && fabs( fTurnNext ) > ( 1.0 - SMALL_DVALUE ) )
fGradNext = 0.0;
else
- fGradNext = acos( fTurnNext ) / ( aVec3.IsNegative( aVec4 ) ? -F_PI180 : F_PI180 );
+ fGradNext = basegfx::rad2deg(acos(fTurnNext)) * (aVec3.IsNegative(aVec4) ? -1 : 1);
if( ( fGradPrev > 0.0 && fGradB < 0.0 && fGradNext > 0.0 ) ||
( fGradPrev < 0.0 && fGradB > 0.0 && fGradNext < 0.0 ) )
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx
index dc86727eae4c..c8a029474ae1 100644
--- a/vcl/backendtest/VisualBackendTest.cxx
+++ b/vcl/backendtest/VisualBackendTest.cxx
@@ -417,8 +417,8 @@ public:
basegfx::B2DPolygon polygon;
for (double a=0.0; a<360.0; a+=0.5)
{
- double x = std::sin(a*M_PI / 180.0) * (b+1) * 20;
- double y = std::cos(a*M_PI / 180.0) * (b+1) * 20;
+ double x = std::sin(basegfx::deg2rad(a)) * (b+1) * 20;
+ double y = std::cos(basegfx::deg2rad(a)) * (b+1) * 20;
polygon.append(basegfx::B2DPoint(x + 200 + 500 * fTime, y + 200 + 500 * fTime));
}
polygon.setClosed(true);
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 0b495e43eff2..f4a7dd71dcbb 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -721,7 +721,7 @@ void SvpSalGraphics::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
aPoly.setClosed(false);
drawPolyLine(aPoly, 0.0, basegfx::B2DVector(1.0, 1.0), basegfx::B2DLineJoin::Miter,
- css::drawing::LineCap_BUTT, 15.0 * F_PI180 /*default*/);
+ css::drawing::LineCap_BUTT, basegfx::deg2rad(15.0) /*default*/);
}
void SvpSalGraphics::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry)
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 281153ceb376..5efecae3a34e 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1550,7 +1550,7 @@ void OpenGLSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pP
aPoly.setClosed(false);
drawPolyLine(aPoly, 0.0, basegfx::B2DVector(1.0, 1.0), basegfx::B2DLineJoin::Miter,
- css::drawing::LineCap_BUTT, 15.0 * F_PI180 /*default*/);
+ css::drawing::LineCap_BUTT, basegfx::deg2rad(15.0) /*default*/);
}
void OpenGLSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry )
diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
index f64126ac978a..3c12c5364168 100644
--- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
+++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
@@ -40,8 +40,8 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& rBitmapEx)
long nGrey11, nGrey12, nGrey13;
long nGrey21, nGrey22, nGrey23;
long nGrey31, nGrey32, nGrey33;
- double fAzim = mnAzimuthAngle100 * 0.01 * F_PI180;
- double fElev = mnElevationAngle100 * 0.01 * F_PI180;
+ double fAzim = basegfx::deg2rad(mnAzimuthAngle100 * 0.01);
+ double fElev = basegfx::deg2rad(mnElevationAngle100 * 0.01);
long* pHMap = new long[nWidth + 2];
long* pVMap = new long[nHeight + 2];
long nX, nY, nNx, nNy, nDotL;
diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx
index eb126cc330da..8c856a83cd7c 100644
--- a/vcl/source/outdev/line.cxx
+++ b/vcl/source/outdev/line.cxx
@@ -143,7 +143,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
aB2DLineWidth,
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180, // not used with B2DLineJoin::NONE, but the correct default
+ basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
this))
{
return;
@@ -252,7 +252,7 @@ void OutputDevice::drawLine( basegfx::B2DPolyPolygon aLinePolyPolygon, const Lin
basegfx::B2DVector(1.0,1.0),
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180, // not used with B2DLineJoin::NONE, but the correct default
+ basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
this);
}
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index d12fd102364f..bef902a2d273 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -99,7 +99,7 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly )
aB2DLineWidth,
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180, // not used with B2DLineJoin::NONE, but the correct default
+ basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
this);
}
}
@@ -210,7 +210,7 @@ void OutputDevice::DrawPolygon( const tools::Polygon& rPoly )
aB2DLineWidth,
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180, // not used with B2DLineJoin::NONE, but the correct default
+ basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
this);
}
@@ -315,7 +315,7 @@ void OutputDevice::ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyP
aB2DLineWidth,
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180, // not used with B2DLineJoin::NONE, but the correct default
+ basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
this);
}
}
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index d13014426b68..bd5ca14b57f5 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -79,7 +79,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly )
aB2DLineWidth,
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180 /*default fMiterMinimumAngle, not used*/,
+ basegfx::deg2rad(15.0) /*default fMiterMinimumAngle, not used*/,
this))
{
return;
@@ -129,7 +129,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly, const LineInfo& rL
static_cast< double >(rLineInfo.GetWidth()),
rLineInfo.GetLineJoin(),
rLineInfo.GetLineCap(),
- 15.0 * F_PI180 /* default fMiterMinimumAngle, value not available in LineInfo */);
+ basegfx::deg2rad(15.0) /* default fMiterMinimumAngle, value not available in LineInfo */);
return;
}
@@ -222,7 +222,9 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
// to avoid optical gaps
for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++)
{
- (void)DrawPolyLineDirect( aAreaPolyPolygon.getB2DPolygon(a), 0.0, 0.0, basegfx::B2DLineJoin::NONE, css::drawing::LineCap_BUTT, 15.0 * F_PI180 /*default, not used*/, bTryAA);
+ (void)DrawPolyLineDirect(aAreaPolyPolygon.getB2DPolygon(a), 0.0, 0.0,
+ basegfx::B2DLineJoin::NONE, css::drawing::LineCap_BUTT,
+ basegfx::deg2rad(15.0) /*default, not used*/, bTryAA);
}
}
else
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index cbe143a46da0..42874c7eba4e 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -265,7 +265,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly,
aHairlineWidth,
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180, // not used with B2DLineJoin::NONE, but the correct default
+ basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
this );
}
}
@@ -368,7 +368,7 @@ bool OutputDevice::DrawTransparentNatively ( const tools::PolyPolygon& rPolyPoly
aLineWidths,
basegfx::B2DLineJoin::NONE,
css::drawing::LineCap_BUTT,
- 15.0 * F_PI180, // not used with B2DLineJoin::NONE, but the correct default
+ basegfx::deg2rad(15.0), // not used with B2DLineJoin::NONE, but the correct default
this );
}
// prepare to restore the fill color
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 118ca5f77fca..ef882d36ea02 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -251,7 +251,7 @@ PointerStyle ImplWheelWindow::ImplGetMousePointer( long nDistX, long nDistY )
}
else
{
- double fAngle = atan2( static_cast<double>(-nDistY), nDistX ) / F_PI180;
+ double fAngle = basegfx::rad2deg(atan2(static_cast<double>(-nDistY), nDistX));
if( fAngle < 0.0 )
fAngle += 360.;
diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index 00f99091e92d..09a99b4f003a 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -285,9 +285,9 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR
aGradient);
LineInfo aLineInfo(LineStyle::Solid, 200);
- double sind = sin(DELTA * M_PI / 180.0);
- double cosd = cos(DELTA * M_PI / 180.0);
- double factor = 1 + (DELTA / 1000.0);
+ const double sind = sin(basegfx::deg2rad(DELTA));
+ const double cosd = cos(basegfx::deg2rad(DELTA));
+ const double factor = 1 + (DELTA / 1000.0);
int n = 0;
Color aLineColor(0, 0, 0);
Color aApproachColor(0, 0, 200);
More information about the Libreoffice-commits
mailing list