basegfx/source/curve/b2dcubicbezier.cxx | 6 basegfx/source/matrix/b2dhommatrixtools.cxx | 4 basegfx/source/matrix/b3dhommatrix.cxx | 4 basegfx/source/polygon/b2dlinegeometry.cxx | 34 +-- basegfx/source/polygon/b2dpolygontools.cxx | 24 +- basegfx/source/polygon/b2dtrapezoid.cxx | 2 basegfx/source/polygon/b3dpolygontools.cxx | 6 basegfx/source/polygon/b3dpolypolygontools.cxx | 16 - basegfx/test/B2DHomMatrixTest.cxx | 14 - basic/source/runtime/props.cxx | 2 canvas/source/vcl/canvashelper.cxx | 2 chart2/source/controller/main/DragMethod_RotateDiagram.cxx | 4 chart2/source/tools/ThreeDHelper.cxx | 132 ++++++------ chart2/source/view/axes/Tickmarks.cxx | 4 chart2/source/view/charttypes/BubbleChart.cxx | 4 chart2/source/view/main/LabelPositionHelper.cxx | 40 +-- chart2/source/view/main/ShapeFactory.cxx | 8 chart2/source/view/main/VTitle.cxx | 2 cppcanvas/source/mtfrenderer/implrenderer.cxx | 2 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx | 4 drawinglayer/source/primitive2d/textlayoutdevice.cxx | 2 drawinglayer/source/primitive2d/textprimitive2d.cxx | 2 drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx | 4 drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx | 26 +- drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx | 2 drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx | 2 drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx | 2 drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx | 2 drawinglayer/source/processor2d/vclprocessor2d.cxx | 2 drawinglayer/source/texture/texture3d.cxx | 4 include/basegfx/numeric/ftools.hxx | 12 - include/basegfx/polygon/b2dlinegeometry.hxx | 4 include/basegfx/polygon/b2dpolygontools.hxx | 2 include/basegfx/polygon/b3dpolypolygontools.hxx | 16 - sc/source/core/opencl/opinlinefun_statistical.cxx | 4 sc/source/core/tool/interpr1.cxx | 4 sc/source/core/tool/interpr3.cxx | 14 - sc/source/filter/excel/xeformula.cxx | 2 svgio/source/svgreader/svgtools.cxx | 2 svx/source/customshapes/EnhancedCustomShape2d.cxx | 24 +- svx/source/dialog/dlgctl3d.cxx | 22 +- svx/source/dialog/frmsel.cxx | 2 svx/source/engine3d/view3d.cxx | 2 svx/source/sdr/contact/viewcontactofe3dlathe.cxx | 4 svx/source/sdr/contact/viewcontactofe3dsphere.cxx | 4 svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 2 svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx | 6 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx | 12 - svx/source/svdraw/svdhdl.cxx | 2 svx/source/svdraw/svdocapt.cxx | 2 svx/source/svdraw/svdocirc.cxx | 4 svx/source/svdraw/svdopath.cxx | 2 sw/source/core/bastyp/calc.cxx | 2 sw/source/core/doc/notxtfrm.cxx | 4 sw/source/uibase/docvw/ShadowOverlayObject.cxx | 6 tools/source/generic/poly.cxx | 10 vcl/source/bitmap/BitmapEx.cxx | 10 vcl/source/filter/ipict/shape.cxx | 14 - vcl/source/outdev/bitmapex.cxx | 4 vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 2 vcl/workben/vcldemo.cxx | 2 xmloff/source/text/txtparae.cxx | 4 62 files changed, 278 insertions(+), 290 deletions(-)
New commits: commit 1cc6fca4927b9684b1f5acedee7b60c0c7518e25 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Nov 18 23:42:32 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Nov 19 10:00:02 2021 +0100 Drop F_2PI Change-Id: Ie98606607b2ce262e4eed76bb8cd86fbfe846f76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125506 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index f621b8f879ad..50f4e36ab30b 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -30,7 +30,7 @@ namespace basegfx::utils { // determine quadrant const sal_Int32 nQuad( - (4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 ); + (4 + fround( M_2_PI*fmod( fRadiant, 2 * M_PI ) )) % 4 ); switch( nQuad ) { case 0: // -2pi,0,2pi diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 03d73a8d3028..6dda8f9e7e1f 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -771,12 +771,12 @@ namespace basegfx // atan2 results are [-PI .. PI], consolidate to [0.0 .. 2PI] if(fAngleStart < 0.0) { - fAngleStart += F_2PI; + fAngleStart += 2 * M_PI; } if(fAngleEnd < 0.0) { - fAngleEnd += F_2PI; + fAngleEnd += 2 * M_PI; } const B2DPolygon aBow(utils::createPolygonFromEllipseSegment(rPoint, fHalfLineWidth, fHalfLineWidth, fAngleStart, fAngleEnd)); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index ce62a95c020f..d497716e9c31 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -1822,14 +1822,14 @@ namespace basegfx::utils { B2DPolygon aRetval; - // truncate fStart, fEnd to a range of [0.0 .. F_2PI[ where F_2PI + // truncate fStart, fEnd to a range of [0.0 .. 2PI[ where 2PI // falls back to 0.0 to ensure a unique definition if(fTools::less(fStart, 0.0)) { fStart = 0.0; } - if(fTools::moreOrEqual(fStart, F_2PI)) + if(fTools::moreOrEqual(fStart, 2 * M_PI)) { fStart = 0.0; } @@ -1839,7 +1839,7 @@ namespace basegfx::utils fEnd = 0.0; } - if(fTools::moreOrEqual(fEnd, F_2PI)) + if(fTools::moreOrEqual(fEnd, 2 * M_PI)) { fEnd = 0.0; } diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index 708417122abf..a1f65bef2f48 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -401,7 +401,7 @@ namespace basegfx::utils // transitions which value to choose const B3DRange aPlaneRange(getRange(rCandidate)); const B3DPoint aPlaneCenter(aPlaneRange.getCenter() - rCenter); - const double fXCenter(fOne - ((atan2(aPlaneCenter.getZ(), aPlaneCenter.getX()) + M_PI) / F_2PI)); + const double fXCenter(fOne - ((atan2(aPlaneCenter.getZ(), aPlaneCenter.getX()) + M_PI) / (2 * M_PI))); for(a = 0; a < nPointCount; a++) { @@ -438,7 +438,7 @@ namespace basegfx::utils } else { - double fX(fOne - ((atan2(aVector.getZ(), aVector.getX()) + M_PI) / F_2PI)); + double fX(fOne - ((atan2(aVector.getZ(), aVector.getX()) + M_PI) / (2 * M_PI))); // correct cartesian point coordinate dependent from center value if(fX > fXCenter + 0.5) diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index 2c7b3c1fc5a3..62ddd3ae771f 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -200,7 +200,7 @@ namespace basegfx::utils } // helper for getting the 3D Point from given cartesian coordinates. fHor is defined from - // [M_PI_2 .. -M_PI_2], fVer from [0.0 .. F_2PI] + // [M_PI_2 .. -M_PI_2], fVer from [0.0 .. 2PI] static B3DPoint getPointFromCartesian(double fHor, double fVer) { const double fCosVer(cos(fVer)); @@ -217,7 +217,7 @@ namespace basegfx::utils if(!nHorSeg) { - nHorSeg = fround(fabs(fHorStop - fHorStart) / (F_2PI / 24.0)); + nHorSeg = fround(fabs(fHorStop - fHorStart) / (M_PI / 12.0)); } // min/max limitations @@ -225,7 +225,7 @@ namespace basegfx::utils if(!nVerSeg) { - nVerSeg = fround(fabs(fVerStop - fVerStart) / (F_2PI / 24.0)); + nVerSeg = fround(fabs(fVerStop - fVerStart) / (M_PI / 12.0)); } // min/max limitations @@ -234,7 +234,7 @@ namespace basegfx::utils // create constants const double fVerDiffPerStep((fVerStop - fVerStart) / static_cast<double>(nVerSeg)); const double fHorDiffPerStep((fHorStop - fHorStart) / static_cast<double>(nHorSeg)); - bool bHorClosed(fTools::equal(fHorStop - fHorStart, F_2PI)); + bool bHorClosed(fTools::equal(fHorStop - fHorStart, 2 * M_PI)); bool bVerFromTop(fTools::equal(fVerStart, M_PI_2)); bool bVerToBottom(fTools::equal(fVerStop, -M_PI_2)); @@ -316,7 +316,7 @@ namespace basegfx::utils if(!nHorSeg) { - nHorSeg = fround(fabs(fHorStop - fHorStart) / (F_2PI / 24.0)); + nHorSeg = fround(fabs(fHorStop - fHorStart) / (M_PI / 12.0)); } // min/max limitations @@ -324,7 +324,7 @@ namespace basegfx::utils if(!nVerSeg) { - nVerSeg = fround(fabs(fVerStop - fVerStart) / (F_2PI / 24.0)); + nVerSeg = fround(fabs(fVerStop - fVerStart) / (M_PI / 12.0)); } // min/max limitations diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index 50aae077d2ba..d8d3cc9c8b3e 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -69,7 +69,7 @@ namespace drawinglayer::primitive3d basegfx::B3DPoint aLastLeft(0.0, 1.0, 0.0); basegfx::B3DPoint aLastRight(1.0, 1.0, 0.0); basegfx::B3DHomMatrix aRot; - aRot.rotate(F_2PI / static_cast<double>(m_nLineTubeSegments), 0.0, 0.0); + aRot.rotate(2 * M_PI / static_cast<double>(m_nLineTubeSegments), 0.0, 0.0); m_aLineTubeList.resize(m_nLineTubeSegments); for(sal_uInt32 a = 0; a < m_nLineTubeSegments; ++a) @@ -148,7 +148,7 @@ namespace drawinglayer::primitive3d const basegfx::B3DPoint aNull(0.0, 0.0, 0.0); basegfx::B3DPoint aLast(0.0, 1.0, 0.0); basegfx::B3DHomMatrix aRot; - aRot.rotate(F_2PI / static_cast<double>(m_nLineCapSegments), 0.0, 0.0); + aRot.rotate(2 * M_PI / static_cast<double>(m_nLineCapSegments), 0.0, 0.0); m_aLineCapList.resize(m_nLineCapSegments); for(sal_uInt32 a = 0; a < m_nLineCapSegments; ++a) @@ -235,7 +235,7 @@ namespace drawinglayer::primitive3d nVerSeg, true, M_PI_2, 0.0, - 0.0, F_2PI)); + 0.0, 2 * M_PI)); const sal_uInt32 nCount(aSphere.count()); if (nCount) @@ -296,7 +296,7 @@ namespace drawinglayer::primitive3d if(basegfx::B2DLineJoin::Round == aLineJoin) { // calculate new horizontal segments - const sal_uInt32 nHorSeg(basegfx::fround((fAngle / F_2PI) * static_cast<double>(nSegments))); + const sal_uInt32 nHorSeg(basegfx::fround((fAngle / (2 * M_PI)) * static_cast<double>(nSegments))); if(nHorSeg) { diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx index afe030ac77b9..2993b1dd27c3 100644 --- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx @@ -360,7 +360,7 @@ namespace drawinglayer::primitive3d else { const bool bBackScale(!basegfx::fTools::equal(fBackScale, 1.0)); - const bool bClosedRotation(!bBackScale && basegfx::fTools::equal(fRotation, F_2PI)); + const bool bClosedRotation(!bBackScale && basegfx::fTools::equal(fRotation, 2 * M_PI)); basegfx::B2DPolyPolygon aFront(rSource); basegfx::B2DPolyPolygon aBack(rSource); basegfx::B3DHomMatrix aTransformBack; diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index e490631c55f3..2115ebc3abe7 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -43,7 +43,7 @@ namespace drawinglayer::primitive3d if(!rSliceVector.empty()) { const bool bBackScale(!basegfx::fTools::equal(getBackScale(), 1.0)); - const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), F_2PI)); + const bool bClosedRotation(!bBackScale && getHorizontalSegments() && basegfx::fTools::equal(getRotation(), 2 * M_PI)); sal_uInt32 a; // decide what to create diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index 1e0dd7454124..c3127261f502 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -83,7 +83,7 @@ namespace drawinglayer::primitive3d // different from forced to sphere texture coordinates, // create a old version from it by rotating to old state before applying // the texture coordinates to emulate old behaviour - fRelativeAngle = F_2PI * (static_cast<double>((getHorizontalSegments() >> 1) - 1) / static_cast<double>(getHorizontalSegments())); + fRelativeAngle = 2 * M_PI * (static_cast<double>((getHorizontalSegments() >> 1) - 1) / static_cast<double>(getHorizontalSegments())); basegfx::B3DHomMatrix aRot; aRot.rotate(0.0, fRelativeAngle, 0.0); aFill.transform(aRot); diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx index 7045695bf5fb..63e7a0d460ce 100644 --- a/include/basegfx/numeric/ftools.hxx +++ b/include/basegfx/numeric/ftools.hxx @@ -33,9 +33,6 @@ #ifndef F_PI18000 #define F_PI18000 (M_PI/18000.0) #endif -#ifndef F_2PI -#define F_2PI (2.0*M_PI) -#endif // fTools defines diff --git a/include/basegfx/polygon/b3dpolypolygontools.hxx b/include/basegfx/polygon/b3dpolypolygontools.hxx index 4480f3266704..8346ba5d8fdc 100644 --- a/include/basegfx/polygon/b3dpolypolygontools.hxx +++ b/include/basegfx/polygon/b3dpolypolygontools.hxx @@ -62,7 +62,7 @@ namespace basegfx::utils BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSpherePolyPolygon( sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, double fVerStart = M_PI_2, double fVerStop = -M_PI_2, - double fHorStart = 0.0, double fHorStop = F_2PI); + double fHorStart = 0.0, double fHorStop = 2 * M_PI); /** Create a 3D line polyPolygon from a B3DRange which defines a sphere with the given count of hor and ver segments. If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees. @@ -72,7 +72,7 @@ namespace basegfx::utils const B3DRange& rRange, sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, double fVerStart = M_PI_2, double fVerStop = -M_PI_2, - double fHorStart = 0.0, double fHorStop = F_2PI); + double fHorStart = 0.0, double fHorStop = 2 * M_PI); /** same as createUnitSpherePolyPolygon, but creates filled polygons (closed and oriented) There is one extra, the bool bNormals defines if normals will be set, default is false @@ -81,7 +81,7 @@ namespace basegfx::utils sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, bool bNormals = false, double fVerStart = M_PI_2, double fVerStop = -M_PI_2, - double fHorStart = 0.0, double fHorStop = F_2PI); + double fHorStart = 0.0, double fHorStop = 2 * M_PI); /** same as createSpherePolyPolygonFromB3DRange, but creates filled polygons (closed and oriented) There is one extra, the bool bNormals defines if normals will be set, default is false @@ -91,7 +91,7 @@ namespace basegfx::utils sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, bool bNormals = false, double fVerStart = M_PI_2, double fVerStop = -M_PI_2, - double fHorStart = 0.0, double fHorStop = F_2PI); + double fHorStart = 0.0, double fHorStop = 2 * M_PI); /** Create/replace normals for given 3d geometry with default normals from given center to outside. rCandidate: the 3d geometry to change diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 2fb4df76bd1e..1f05a3782a7c 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -2008,7 +2008,7 @@ static double lcl_getNormalizedCircleAngleRad(const double fWR, const double fHR { fRet = atan2(fY, fX); if (fRet < 0.0) - fRet += F_2PI; + fRet += 2 * M_PI; } return fRet; } @@ -2494,7 +2494,7 @@ void EnhancedCustomShape2d::CreateSubPath( } else // right, down { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*M_PI, F_2PI); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*M_PI, 2*M_PI); } } } @@ -2505,7 +2505,7 @@ void EnhancedCustomShape2d::CreateSubPath( { if (aEnd.getY()<aStart.getY()) // up, left { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*M_PI, F_2PI); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*M_PI, 2*M_PI); aArc.flip(); } else // down, left diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index 504e65e6c7a6..3f55e04425f4 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -314,7 +314,7 @@ void Svx3DLightControl::Construct2() a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, 0.0)); a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, -RADIUS_LAMP_PREVIEW_SIZE)); a2DHalfCircle.append(basegfx::utils::createPolygonFromEllipseSegment( - basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE, RADIUS_LAMP_PREVIEW_SIZE, F_2PI - M_PI_2, M_PI_2)); + basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE, RADIUS_LAMP_PREVIEW_SIZE, 2 * M_PI - M_PI_2, M_PI_2)); basegfx::B3DPolygon a3DHalfCircle(basegfx::utils::createB3DPolygonFromB2DPolygon(a2DHalfCircle)); // create object for it @@ -600,12 +600,12 @@ bool Svx3DLightControl::MouseMove(const MouseEvent& rMEvt) // cut horizontal while(fNewRotY < 0.0) { - fNewRotY += F_2PI; + fNewRotY += 2 * M_PI; } - while(fNewRotY >= F_2PI) + while(fNewRotY >= 2 * M_PI) { - fNewRotY -= F_2PI; + fNewRotY -= 2 * M_PI; } // cut vertical diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 32ad5764db7e..d96d640a70cc 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -105,7 +105,7 @@ namespace drawinglayer::primitive2d if(getTextAutoAngle() && fTestAngle < -M_PI) { - fTestAngle += F_2PI; + fTestAngle += 2 * M_PI; } } diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 54889a9dde28..85d4a721a066 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -710,7 +710,7 @@ void handleNegativeScale(basegfx::B2DTuple & scale, double * rotate) { { scale.setX(fabs(scale.getX())); scale.setY(fabs(scale.getY())); - *rotate = fmod(*rotate + M_PI, F_2PI); + *rotate = fmod(*rotate + M_PI, 2 * M_PI); } } diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 17cf7f4a431e..efeefc79dcea 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2907,7 +2907,7 @@ void SdrPathObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const b { aScale.setX(fabs(aScale.getX())); aScale.setY(fabs(aScale.getY())); - fRotate = fmod(fRotate + M_PI, F_2PI); + fRotate = fmod(fRotate + M_PI, 2 * M_PI); } // copy poly diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 8886ce464ca3..958033d0d6a3 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -641,7 +641,7 @@ double SwNoTextFrame::getLocalFrameRotation() const const SwRotationGrf& rSwRotationGrf(rSwAttrSet.GetRotationGrf()); const double fRotate = -toRadians(rSwRotationGrf.GetValue()); - return basegfx::normalizeToRange(fRotate, F_2PI); + return basegfx::normalizeToRange(fRotate, 2 * M_PI); } } @@ -1440,7 +1440,7 @@ bool SwNoTextFrame::IsTransparent() const if(isTransformableSwFrame()) { // we can be more specific - rotations of multiples of - // 90 degrees will leave no gaps. Go from [0.0 .. F_2PI] + // 90 degrees will leave no gaps. Go from [0.0 .. 2PI] // to [0 .. 360] and check modulo 90 const tools::Long nRot(static_cast<tools::Long>(basegfx::rad2deg(getLocalFrameRotation()))); const bool bMultipleOf90(0 == (nRot % 90)); diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 8be16bbd5ebd..6a9aff2be250 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -272,10 +272,10 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, c sal_uInt16 nEnd; // #i73608# If startPoint is equal to endPoint, then draw full circle instead of nothing (as Metafiles spec) if( fDiff <= 0. ) - fDiff += F_2PI; + fDiff += 2 * M_PI; // Proportionally shrink number of points( fDiff / (2PI) ); - nPoints = std::max( static_cast<sal_uInt16>( ( fDiff / F_2PI ) * nPoints ), sal_uInt16(16) ); + nPoints = std::max( static_cast<sal_uInt16>( ( fDiff / (2 * M_PI) ) * nPoints ), sal_uInt16(16) ); fStep = fDiff / ( nPoints - 1 ); if( PolyStyle::Pie == eStyle ) diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index d2c52c47a746..5a0502babba2 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -727,10 +727,10 @@ namespace return true; } - fRotate = fmod( fRotate, F_2PI ); + fRotate = fmod( fRotate, 2 * M_PI ); if (fRotate < 0) { - fRotate += F_2PI; + fRotate += 2 * M_PI; } if (!rtl::math::approxEqual(fRotate, 0) && !rtl::math::approxEqual(fRotate, M_PI_2) diff --git a/vcl/source/filter/ipict/shape.cxx b/vcl/source/filter/ipict/shape.cxx index 79643123639c..88a62cfd2ff2 100644 --- a/vcl/source/filter/ipict/shape.cxx +++ b/vcl/source/filter/ipict/shape.cxx @@ -171,17 +171,17 @@ namespace PictReaderShape { tools::Long const Y[2] = { arc.Top(), arc.Bottom() }; B2DPoint center(0.5*(X[1]+X[0]), 0.5*(Y[1]+Y[0])); - // We must have angl1 between 0 and F_2PI - while (angl1 < 0.0) { angl1 += F_2PI; angl2 += F_2PI; } - while (angl1 >= F_2PI) { angl1 -= F_2PI; angl2 -= F_2PI; } + // We must have angl1 between 0 and 2PI + while (angl1 < 0.0) { angl1 += 2 * M_PI; angl2 += 2 * M_PI; } + while (angl1 >= 2 * M_PI) { angl1 -= 2 * M_PI; angl2 -= 2 * M_PI; } // if this happen, we want a complete circle // so we set angl2 slightly less than angl1 - if (angl2 >= angl1+F_2PI) angl2 = angl1-0.001; + if (angl2 >= angl1 + 2 * M_PI) angl2 = angl1-0.001; - // We must have angl2 between 0 and F_2PI - while (angl2 < 0.0) angl2 += F_2PI; - while (angl2 >= F_2PI) angl2 -= F_2PI; + // We must have angl2 between 0 and 2PI + while (angl2 < 0.0) angl2 += 2 * M_PI; + while (angl2 >= 2 * M_PI) angl2 -= 2 * M_PI; B2DPolygon poly = basegfx::utils::createPolygonFromEllipseSegment(center, 0.5*(X[1]-X[0]), 0.5*(Y[1]-Y[0]), angl1, angl2); if (drawFrame) diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx index cfa0512e9e4b..44170e633bfe 100644 --- a/vcl/source/outdev/bitmapex.cxx +++ b/vcl/source/outdev/bitmapex.cxx @@ -660,10 +660,10 @@ void OutputDevice::DrawTransformedBitmapEx( else { // Just rotation, can do that directly. - fFullRotate = fmod(fFullRotate * -1, F_2PI); + fFullRotate = fmod(fFullRotate * -1, 2 * M_PI); if (fFullRotate < 0) { - fFullRotate += F_2PI; + fFullRotate += 2 * M_PI; } Degree10 nAngle10(basegfx::fround(basegfx::rad2deg(fFullRotate) * 10)); aTransformed.Rotate(nAngle10, COL_TRANSPARENT); diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 74e3d6f55c37..7a31f981a371 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -420,7 +420,7 @@ FreetypeFont::FreetypeFont(FreetypeFontInstance& rFontInstance, const std::share if( rFSD.mnOrientation ) { - const double dRad = rFSD.mnOrientation.get() * ( F_2PI / 3600.0 ); + const double dRad = rFSD.mnOrientation.get() * ( 2 * M_PI / 3600.0 ); mnCos = static_cast<tools::Long>( 0x10000 * cos( dRad ) + 0.5 ); mnSin = static_cast<tools::Long>( 0x10000 * sin( dRad ) + 0.5 ); } diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 372a96d3126f..a89857c099a7 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1260,7 +1260,7 @@ public: break; default: aTransform.translate(-aSize.Width()/2, -aSize.Height()/2); - aTransform.rotate(2 * F_2PI * i / nToRender); + aTransform.rotate(2 * 2 * M_PI * i / nToRender); aTransform.translate(aSize.Width()/2, aSize.Height()/2); break; } diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 322a5e2128e3..b3a26d955ee2 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -3087,7 +3087,7 @@ void XMLTextParagraphExport::_exportTextGraphic( // add rotation itself // tdf#115529 but correct value modulo 2PI to have it positive and in the range of [0.0 .. 2PI[ - aSdXMLImExTransform2D.AddRotate(basegfx::normalizeToRange(fRotate, F_2PI)); + aSdXMLImExTransform2D.AddRotate(basegfx::normalizeToRange(fRotate, 2 * M_PI)); // back-transform after rotation aSdXMLImExTransform2D.AddTranslate(aCenter); commit 37429f2690a96491ad0e4fa2a04f2fa88a66da87 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Nov 18 17:43:46 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Nov 19 09:59:43 2021 +0100 Use M_PI* instead of F_PI* Change-Id: Ie2b7a1c74fc516781a17a20157b8217bc41e383d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125504 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 046f0cf30e17..a04c17568b38 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -66,7 +66,7 @@ namespace basegfx const double fCurrentAngle(aLeft.angle(aRight)); - if(fabs(fCurrentAngle) > (F_PI - fAngleBound)) + if(fabs(fCurrentAngle) > (M_PI - fAngleBound)) { // end recursion nMaxRecursionDepth = 0; @@ -203,7 +203,7 @@ namespace basegfx const B2DVector aLeftLeft(bLeftEqualZero ? aS2L - aS1L : aS1L - rfPA); // #i72104# const B2DVector aRightLeft(aS2L - aS3C); const double fCurrentAngleLeft(aLeftLeft.angle(aRightLeft)); - bAngleIsSmallerLeft = (fabs(fCurrentAngleLeft) > (F_PI - rfAngleBound)); + bAngleIsSmallerLeft = (fabs(fCurrentAngleLeft) > (M_PI - rfAngleBound)); } // test right @@ -213,7 +213,7 @@ namespace basegfx const B2DVector aLeftRight(aS2R - aS3C); const B2DVector aRightRight(bRightEqualZero ? aS2R - aS1R : aS1R - rfPB); // #i72104# const double fCurrentAngleRight(aLeftRight.angle(aRightRight)); - bAngleIsSmallerRight = (fabs(fCurrentAngleRight) > (F_PI - rfAngleBound)); + bAngleIsSmallerRight = (fabs(fCurrentAngleRight) > (M_PI - rfAngleBound)); } if(bAngleIsSmallerLeft && bAngleIsSmallerRight) diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index 72256688c0b2..f621b8f879ad 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -26,7 +26,7 @@ namespace basegfx::utils { void createSinCosOrthogonal(double& o_rSin, double& o_rCos, double fRadiant) { - if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) ) + if( fTools::equalZero( fmod( fRadiant, M_PI_2 ) ) ) { // determine quadrant const sal_Int32 nQuad( diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index 1382ff3c4a0f..3605767d681d 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -507,13 +507,13 @@ namespace basegfx if( ::basegfx::fTools::equal( aCol0.getZ(), 1.0 ) || aCol0.getZ() > 1.0 ) { - fy = -F_PI/2.0; + fy = -M_PI/2.0; cy = 0.0; } else if( ::basegfx::fTools::equal( aCol0.getZ(), -1.0 ) || aCol0.getZ() < -1.0 ) { - fy = F_PI/2.0; + fy = M_PI/2.0; cy = 0.0; } else diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 4bba7cb009f9..03d73a8d3028 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -103,7 +103,7 @@ namespace basegfx::utils // 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()) + F_PI2); + const double fRotation(atan2(aTargetDirection.getY(), aTargetDirection.getX()) + M_PI_2); // rotate around docking position aArrowTransform.rotate(fRotation); @@ -389,7 +389,7 @@ namespace basegfx utils::createScaleShearXRotateTranslateB2DHomMatrix( fHalfLineWidth, fHalfLineWidth, 0.0, - atan2(aTangentA.getY(), aTangentA.getX()) + F_PI2, + atan2(aTangentA.getY(), aTangentA.getX()) + M_PI_2, rEdge.getStartPoint().getX(), rEdge.getStartPoint().getY())); aBezierPolygon.append(aStartPolygon); } @@ -452,7 +452,7 @@ namespace basegfx utils::createScaleShearXRotateTranslateB2DHomMatrix( fHalfLineWidth, fHalfLineWidth, 0.0, - atan2(aTangentB.getY(), aTangentB.getX()) - F_PI2, + atan2(aTangentB.getY(), aTangentB.getX()) - M_PI_2, rEdge.getEndPoint().getX(), rEdge.getEndPoint().getY())); aBezierPolygon.append(aEndPolygon); } @@ -604,7 +604,7 @@ namespace basegfx utils::createScaleShearXRotateTranslateB2DHomMatrix( fHalfLineWidth, fHalfLineWidth, 0.0, - fAngle + F_PI2, + fAngle + M_PI_2, rEdge.getStartPoint().getX(), rEdge.getStartPoint().getY())); } else @@ -642,7 +642,7 @@ namespace basegfx utils::createScaleShearXRotateTranslateB2DHomMatrix( fHalfLineWidth, fHalfLineWidth, 0.0, - fAngle - F_PI2, + fAngle - M_PI_2, rEdge.getEndPoint().getX(), rEdge.getEndPoint().getY())); aEdgePolygon.append(aEndPolygon); } @@ -710,7 +710,7 @@ namespace basegfx { const double fAngle(fabs(rPerpendPrev.angle(rPerpendEdge))); - if((F_PI - fAngle) < fMiterMinimumAngle) + if((M_PI - fAngle) < fMiterMinimumAngle) { // fallback to bevel eJoin = B2DLineJoin::Bevel; @@ -851,13 +851,13 @@ namespace basegfx double fMiterMinimumAngle, basegfx::triangulator::B2DTriangleVector* pTriangles) { - if(fMaxAllowedAngle > F_PI2) + if(fMaxAllowedAngle > M_PI_2) { - fMaxAllowedAngle = F_PI2; + fMaxAllowedAngle = M_PI_2; } - else if(fMaxAllowedAngle < 0.01 * F_PI2) + else if(fMaxAllowedAngle < 0.01 * M_PI_2) { - fMaxAllowedAngle = 0.01 * F_PI2; + fMaxAllowedAngle = 0.01 * M_PI_2; } if(fMaxPartOfEdge > 1.0) @@ -869,13 +869,13 @@ namespace basegfx fMaxPartOfEdge = 0.01; } - if(fMiterMinimumAngle > F_PI) + if(fMiterMinimumAngle > M_PI) { - fMiterMinimumAngle = F_PI; + fMiterMinimumAngle = M_PI; } - else if(fMiterMinimumAngle < 0.01 * F_PI) + else if(fMiterMinimumAngle < 0.01 * M_PI) { - fMiterMinimumAngle = 0.01 * F_PI; + fMiterMinimumAngle = 0.01 * M_PI; } B2DPolygon aCandidate(rCandidate); @@ -935,7 +935,7 @@ namespace basegfx { const double fAngle(fabs(aTangentPrev.angle(aTangentEdge))); - if(fTools::equal(fAngle, F_PI)) + if(fTools::equal(fAngle, M_PI)) { // for half-circle production, fallback to positive // orientation diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index d4644a6f0606..ce62a95c020f 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -1572,8 +1572,8 @@ namespace basegfx::utils // and alternatives read document "ApproxCircleInfo.odt", attachment of bug tdf#121425. static double impDistanceBezierPointToControl(double fAngle) { - SAL_WARN_IF(fAngle < 0 || fAngle > F_PI2,"basegfx","angle not suitable for approximate circle"); - if (0 <= fAngle && fAngle <= F_PI2) + SAL_WARN_IF(fAngle < 0 || fAngle > M_PI_2,"basegfx","angle not suitable for approximate circle"); + if (0 <= fAngle && fAngle <= M_PI_2) { return 4.0/3.0 * ( tan(fAngle/4.0)); } @@ -1624,7 +1624,7 @@ namespace basegfx::utils B2DPolygon aRetval; const double fBowX((rRect.getWidth() / 2.0) * fRadiusX); const double fBowY((rRect.getHeight() / 2.0) * fRadiusY); - const double fKappa(impDistanceBezierPointToControl(F_PI2)); + const double fKappa(impDistanceBezierPointToControl(M_PI_2)); // create start point at bottom center if(!rtl::math::approxEqual(fOne, fRadiusX)) @@ -1723,8 +1723,8 @@ namespace basegfx::utils static B2DPolygon impCreateUnitCircle(sal_uInt32 nStartQuadrant) { B2DPolygon aUnitCircle; - const double fSegmentKappa = impDistanceBezierPointToControl(F_PI2 / STEPSPERQUARTER); - const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(F_PI2 / STEPSPERQUARTER)); + const double fSegmentKappa = impDistanceBezierPointToControl(M_PI_2 / STEPSPERQUARTER); + const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(M_PI_2 / STEPSPERQUARTER)); B2DPoint aPoint(1.0, 0.0); B2DPoint aForward(1.0, fSegmentKappa); @@ -1732,7 +1732,7 @@ namespace basegfx::utils if(nStartQuadrant != 0) { - const B2DHomMatrix aQuadrantMatrix(createRotateB2DHomMatrix(F_PI2 * (nStartQuadrant % 4))); + const B2DHomMatrix aQuadrantMatrix(createRotateB2DHomMatrix(M_PI_2 * (nStartQuadrant % 4))); aPoint *= aQuadrantMatrix; aBackward *= aQuadrantMatrix; aForward *= aQuadrantMatrix; @@ -1758,8 +1758,8 @@ namespace basegfx::utils { static auto const singleton = [] { B2DPolygon aUnitHalfCircle; - const double fSegmentKappa(impDistanceBezierPointToControl(F_PI2 / STEPSPERQUARTER)); - const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(F_PI2 / STEPSPERQUARTER)); + const double fSegmentKappa(impDistanceBezierPointToControl(M_PI_2 / STEPSPERQUARTER)); + const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(M_PI_2 / STEPSPERQUARTER)); B2DPoint aPoint(1.0, 0.0); B2DPoint aForward(1.0, fSegmentKappa); B2DPoint aBackward(1.0, -fSegmentKappa); @@ -1852,7 +1852,7 @@ namespace basegfx::utils else { const sal_uInt32 nSegments(STEPSPERQUARTER * 4); - const double fAnglePerSegment(F_PI2 / STEPSPERQUARTER); + const double fAnglePerSegment(M_PI_2 / STEPSPERQUARTER); const sal_uInt32 nStartSegment(sal_uInt32(fStart / fAnglePerSegment) % nSegments); const sal_uInt32 nEndSegment(sal_uInt32(fEnd / fAnglePerSegment) % nSegments); const double fSegmentKappa(impDistanceBezierPointToControl(fAnglePerSegment)); diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index 12dbd66fdf9e..0bfb8fb5705f 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -91,7 +91,7 @@ namespace basegfx::trapezoidhelper // get radiant; has to be in the range ]0.0 .. pi[, thus scale to full // sal_uInt32 range for maximum precision - const double fRadiant(atan2(getDeltaY(), getDeltaX()) * (SAL_MAX_UINT32 / F_PI)); + const double fRadiant(atan2(getDeltaY(), getDeltaX()) * (SAL_MAX_UINT32 / M_PI)); // convert to sal_uInt32 value const_cast< TrDeEdgeEntry* >(this)->mnSortValue = sal_uInt32(fRadiant); diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index 377b05802986..708417122abf 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -401,12 +401,12 @@ namespace basegfx::utils // transitions which value to choose const B3DRange aPlaneRange(getRange(rCandidate)); const B3DPoint aPlaneCenter(aPlaneRange.getCenter() - rCenter); - const double fXCenter(fOne - ((atan2(aPlaneCenter.getZ(), aPlaneCenter.getX()) + F_PI) / F_2PI)); + const double fXCenter(fOne - ((atan2(aPlaneCenter.getZ(), aPlaneCenter.getX()) + M_PI) / F_2PI)); for(a = 0; a < nPointCount; a++) { const B3DVector aVector(aRetval.getB3DPoint(a) - rCenter); - const double fY(fOne - ((atan2(aVector.getY(), aVector.getXZLength()) + F_PI2) / F_PI)); + const double fY(fOne - ((atan2(aVector.getY(), aVector.getXZLength()) + M_PI_2) / M_PI)); B2DPoint aTexCoor(aRetval.getTextureCoordinate(a)); if(fTools::equalZero(fY)) @@ -438,7 +438,7 @@ namespace basegfx::utils } else { - double fX(fOne - ((atan2(aVector.getZ(), aVector.getX()) + F_PI) / F_2PI)); + double fX(fOne - ((atan2(aVector.getZ(), aVector.getX()) + M_PI) / F_2PI)); // correct cartesian point coordinate dependent from center value if(fX > fXCenter + 0.5) diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx index ad2dd5bb7979..2c7b3c1fc5a3 100644 --- a/basegfx/source/polygon/b3dpolypolygontools.cxx +++ b/basegfx/source/polygon/b3dpolypolygontools.cxx @@ -200,7 +200,7 @@ namespace basegfx::utils } // helper for getting the 3D Point from given cartesian coordinates. fHor is defined from - // [F_PI2 .. -F_PI2], fVer from [0.0 .. F_2PI] + // [M_PI_2 .. -M_PI_2], fVer from [0.0 .. F_2PI] static B3DPoint getPointFromCartesian(double fHor, double fVer) { const double fCosVer(cos(fVer)); @@ -235,8 +235,8 @@ namespace basegfx::utils const double fVerDiffPerStep((fVerStop - fVerStart) / static_cast<double>(nVerSeg)); const double fHorDiffPerStep((fHorStop - fHorStart) / static_cast<double>(nHorSeg)); bool bHorClosed(fTools::equal(fHorStop - fHorStart, F_2PI)); - bool bVerFromTop(fTools::equal(fVerStart, F_PI2)); - bool bVerToBottom(fTools::equal(fVerStop, -F_PI2)); + bool bVerFromTop(fTools::equal(fVerStart, M_PI_2)); + bool bVerToBottom(fTools::equal(fVerStop, -M_PI_2)); // create horizontal rings const sal_uInt32 nLoopVerInit(bVerFromTop ? 1 : 0); diff --git a/basegfx/test/B2DHomMatrixTest.cxx b/basegfx/test/B2DHomMatrixTest.cxx index 04201ca19c0c..bd6b1f8c8029 100644 --- a/basegfx/test/B2DHomMatrixTest.cxx +++ b/basegfx/test/B2DHomMatrixTest.cxx @@ -159,7 +159,7 @@ public: void rotate() { B2DHomMatrix mat; - mat.rotate(F_PI2); + mat.rotate(M_PI_2); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate pi/2 yields exact matrix", 0.0, mat.get(0, 0), 1E-12); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate pi/2 yields exact matrix", -1.0, mat.get(0, 1), @@ -172,7 +172,7 @@ public: 1E-12); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate pi/2 yields exact matrix", 0.0, mat.get(1, 2), 1E-12); - mat.rotate(F_PI2); + mat.rotate(M_PI_2); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate pi yields exact matrix", -1.0, mat.get(0, 0), 1E-12); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate pi yields exact matrix", 0.0, mat.get(0, 1), @@ -185,7 +185,7 @@ public: 1E-12); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate pi yields exact matrix", 0.0, mat.get(1, 2), 1E-12); - mat.rotate(F_PI2); + mat.rotate(M_PI_2); 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("rotate 3/2 pi yields exact matrix", 1.0, @@ -198,7 +198,7 @@ public: 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(F_PI2); + mat.rotate(M_PI_2); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate 2 pi yields exact matrix", 1.0, mat.get(0, 0), 1E-12); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rotate 2 pi yields exact matrix", 0.0, mat.get(0, 1), @@ -334,7 +334,7 @@ public: // are just the two rightmost values and uncritical static const double fSX(10.0); static const double fSY(12.0); - static const double fR(F_PI4); + static const double fR(M_PI_4); static const double fS(deg2rad(15.0)); // check all possible scaling combinations @@ -429,7 +429,7 @@ public: // cover special case of 180 degree rotation B2DHomMatrix aTest - = utils::createScaleShearXRotateTranslateB2DHomMatrix(6425, 3938, 0, F_PI, 10482, 4921); + = utils::createScaleShearXRotateTranslateB2DHomMatrix(6425, 3938, 0, M_PI, 10482, 4921); // decompose that matrix B2DTuple aDScale; B2DTuple aDTrans; @@ -442,7 +442,7 @@ public: 1E-12); CPPUNIT_ASSERT_EQUAL_MESSAGE("decompose: error test J1", 10482.0, aDTrans.getX()); CPPUNIT_ASSERT_EQUAL_MESSAGE("decompose: error test J1", 4921.0, aDTrans.getY()); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", F_PI, fDRot, 1E-12); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", M_PI, fDRot, 1E-12); } void testCreate_abcdef() diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx index 838f6e569772..f3d84a0127b5 100644 --- a/basic/source/runtime/props.cxx +++ b/basic/source/runtime/props.cxx @@ -65,7 +65,7 @@ void SbRtl_Null(StarBASIC *, SbxArray & rPar, bool) rPar.Get(0)->PutNull(); } -void SbRtl_PI(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutDouble(F_PI); } +void SbRtl_PI(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutDouble(M_PI); } void SbRtl_True(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutBool(true); } diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 80a0dc2a8fa6..1a2f7209562f 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -376,7 +376,7 @@ namespace vclcanvas double fMiterMinimumAngle; if (strokeAttributes.MiterLimit <= 1.0) { - fMiterMinimumAngle = F_PI2; + fMiterMinimumAngle = M_PI_2; } else { diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx index 7a9dbe91a476..b8a0b7d13fb5 100644 --- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx +++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx @@ -114,9 +114,9 @@ void DragMethod_RotateDiagram::MoveSdrDrag(const Point& rPnt) Hide(); //calculate new angle - double fX = F_PI2 * static_cast<double>(rPnt.Y() - m_aStartPos.Y()) + double fX = M_PI_2 * 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()) + double fY = M_PI * static_cast<double>(rPnt.X() - m_aStartPos.X()) / (m_aReferenceRect.GetWidth() > 0 ? static_cast<double>(m_aReferenceRect.GetWidth()) : 1.0); if( m_eRotationDirection != ROTATIONDIRECTION_Y ) diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index 8c48d359c7b4..0903459606bb 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -365,10 +365,10 @@ namespace double lcl_shiftAngleToIntervalMinusPiToPi( double fAngleRad ) { //valid range: ]-Pi,Pi] - while( fAngleRad<=-F_PI ) - fAngleRad+=(2*F_PI); - while( fAngleRad>F_PI ) - fAngleRad-=(2*F_PI); + while( fAngleRad<=-M_PI ) + fAngleRad+=(2*M_PI); + while( fAngleRad>M_PI ) + fAngleRad-=(2*M_PI); return fAngleRad; } @@ -417,25 +417,25 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad( //element 23 double f23 = cos(R)*sin(E); if(f23>0) - x = F_PI2; + x = M_PI_2; else - x = -F_PI2; + x = -M_PI_2; y = R; } else if( ( nRotationDeg == 90 || nRotationDeg == 270 ) && ( nElevationDeg == 90 || nElevationDeg == 270 ) ) { //cR==0 && cE==0 - z = F_PI2; + z = M_PI_2; if( sin(R)>0 ) - x = F_PI2; + x = M_PI_2; else - x = -F_PI2; + x = -M_PI_2; if( (sin(R)*sin(E))>0 ) y = 0.0; else - y = F_PI; + y = M_PI; } else if( (nRotationDeg == 0 || nRotationDeg == 180 ) && ( nElevationDeg == 0 || nElevationDeg == 180 ) ) @@ -452,14 +452,14 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad( z = 0.0; if( (sin(R)/cos(E))>0 ) - y = F_PI2; + y = M_PI_2; else - y = -F_PI2; + y = -M_PI_2; if( (cos(E))>0 ) x = 0; else - x = F_PI; + x = M_PI; } else if ( nElevationDeg == 0 || nElevationDeg == 180 ) { @@ -474,19 +474,19 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad( else if ( nElevationDeg == 90 || nElevationDeg == 270 ) { //sR!=0 cR!=0 cE==0 - //element 12 + 22 --> y=0 or F_PI and x=+-F_PI/2 + //element 12 + 22 --> y=0 or M_PI and x=+-M_PI/2 //-->element 13/23: z = atan(sin(R)/(cos(R)*sin(E))); //use element 13 for sign for x if( (sin(R)*sin(z))>0.0 ) - x = F_PI2; + x = M_PI_2; else - x = -F_PI2; + x = -M_PI_2; //use element 21 for y if( (sin(R)*sin(E)*sin(z))>0.0) y = 0.0; else - y = F_PI; + y = M_PI; } else if ( nRotationDeg == 0 || nRotationDeg == 180 ) { @@ -501,10 +501,10 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad( else if (nRotationDeg == 90 || nRotationDeg == 270) { //sE!=0 cE!=0 cR==0 - //z = +- F_PI/2; - //x = +- F_PI/2; - z = F_PI2; - x = F_PI2; + //z = +- M_PI/2; + //x = +- M_PI/2; + z = M_PI_2; + x = M_PI_2; double sR = sin(R); if( sR<0.0 ) x *= -1.0; //different signs for x and z @@ -555,7 +555,7 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad( if( (f22a*f22b)<0.0 ) { y *= -1; - x=(F_PI-x); + x=(M_PI-x); } } else @@ -567,7 +567,7 @@ void ThreeDHelper::convertElevationRotationDegToXYZAngleRad( if( (f22a*f22b)<0.0 ) { y *= -1; - x=(F_PI-x); + x=(M_PI-x); } } } @@ -607,14 +607,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( if( f11 > 0 ) R = 0.0; else - R = F_PI; + R = M_PI; //element 23 double f23 = cos(z)*sin(x) / cos(R); if( f23 > 0 ) - E = F_PI2; + E = M_PI_2; else - E = -F_PI2; + E = -M_PI_2; } else if( lcl_isCosZero(z) ) { @@ -624,16 +624,16 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( double f13 = sin(x)*sin(z); //element 13+11 if( f13 > 0 ) - R = F_PI2; + R = M_PI_2; else - R = -F_PI2; + R = -M_PI_2; //element 21 double f21 = cos(y)*sin(z) / sin(R); if( f21 > 0 ) - E = F_PI2; + E = M_PI_2; else - E = -F_PI2; + E = -M_PI_2; } else { @@ -643,14 +643,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( R = atan( f13/f11 ); if(f11<0) - R+=F_PI; + R+=M_PI; //element 23 double f23 = cos(z)*sin(x); if( f23/cos(R) > 0 ) - E = F_PI2; + E = M_PI_2; else - E = -F_PI2; + E = -M_PI_2; } } else if( lcl_isSinZero(x) ) @@ -660,13 +660,13 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( if( f11 > 0 ) R = 0.0; else - R = F_PI; + R = M_PI; double f22 = cos(x)*cos(z); if( f22 > 0 ) E = 0.0; else - E = F_PI; + E = M_PI; } else if( lcl_isSinZero(z) ) { @@ -675,14 +675,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( if( f11 > 0 ) R = 0.0; else - R = F_PI; + R = M_PI; //element 22 && 23 double f22 = cos(x)*cos(z); double f23 = cos(z)*sin(x); E = atan( f23/(f22*cos(R)) ); if( (f22*cos(E))<0 ) - E+=F_PI; + E+=M_PI; } else if( lcl_isCosZero(z) ) { @@ -690,16 +690,16 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( double f13 = sin(x)*sin(z); //element 13+11 if( f13 > 0 ) - R = F_PI2; + R = M_PI_2; else - R = -F_PI2; + R = -M_PI_2; //element 21+22 double f21 = cos(y)*sin(z); if( f21/sin(R) > 0 ) - E = F_PI2; + E = M_PI_2; else - E = -F_PI2; + E = -M_PI_2; } else { @@ -707,7 +707,7 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( double f13 = sin(x)*sin(z); R = atan( f13/f11 ); if( (f11*cos(R))<0.0 ) - R+=F_PI; + R+=M_PI; double f22 = cos(x)*cos(z); if( !lcl_isCosZero(R) ) @@ -715,7 +715,7 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( else E = atan( cos(y)*sin(z) /( f22*sin(R) ) ); if( (f22*cos(E))<0 ) - E+=F_PI; + E+=M_PI; } } else if( lcl_isCosZero(y) ) @@ -724,15 +724,15 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( double f13 = sin(x)*sin(z)+cos(x)*cos(z)*sin(y); if( f13 >= 0 ) - R = F_PI2; + R = M_PI_2; else - R = -F_PI2; + R = -M_PI_2; double f22 = cos(x)*cos(z)+sin(x)*sin(y)*sin(z); if( f22 >= 0 ) E = 0.0; else - E = F_PI; + E = M_PI; } else if( lcl_isSinZero(x) ) { @@ -744,13 +744,13 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( R = atan( f13/f11 ); //R = asin(f13); if( f11<0 ) - R+=F_PI; + R+=M_PI; double f22 = cos(x)*cos(z); if( f22>0 ) E = 0.0; else - E = F_PI; + E = M_PI; } else if( lcl_isCosZero(z) ) { @@ -772,14 +772,14 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( R = atan( f13/f11 ); if( f11<0 ) - R+=F_PI; + R+=M_PI; double f21 = cos(y)*sin(z); double f22 = cos(x)*cos(z); E = atan(f21/(f22*sin(R)) ); if( (f22*cos(E))<0.0 ) - E+=F_PI; + E+=M_PI; } } else if( lcl_isCosZero(x) ) @@ -789,23 +789,23 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( if( lcl_isSinZero(z) ) { //cosY!=0 sinY!=0 cosX=0 sinZ=0 - R=0;//13 -> R=0 or F_PI + R=0;//13 -> R=0 or M_PI if( f11<0.0 ) - R=F_PI; - E=F_PI2;//22 -> E=+-F_PI/2 + R=M_PI; + E=M_PI_2;//22 -> E=+-M_PI/2 //use element 11 and 23 for sign double f23 = cos(z)*sin(x); if( (f11*f23*sin(E))<0.0 ) - E=-F_PI2; + E=-M_PI_2; } 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_PI2; + R=M_PI_2; else - R=-F_PI2; + R=-M_PI_2; //element 22: E=acos( sin(x)*sin(y)*sin(z)); //use element 21 for sign: @@ -819,7 +819,7 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( R = atan( sin(x)*sin(z)/(cos(y)*cos(z)) ); //use 13 for 'sign' if( (sin(x)*sin(z))<0.0 ) - R += F_PI; + R += M_PI; //element 22 E = acos(sin(x)*sin(y)*sin(z) ); //use 21 for sign @@ -848,12 +848,12 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( R=atan(-cos(y)/(cos(x)*sin(y))); //use element 13 for 'sign' if( (sin(x)*sin(z)*sin(R))<0.0 ) - R+=F_PI; + R+=M_PI; //element 21/22 E=atan( cos(y)*sin(z)/(sin(R)*sin(x)*sin(y)*sin(z)) ); //use element 23 for 'sign' if( (-cos(x)*sin(y)*sin(z)*cos(R)*sin(E))<0.0 ) - E+=F_PI; + E+=M_PI; } else { @@ -862,13 +862,13 @@ void ThreeDHelper::convertXYZAngleRadToElevationRotationDeg( double f13 = sin(x)*sin(z)+cos(x)*cos(z)*sin(y); R = atan( f13/ f11 ); if(f11<0.0) - R+=F_PI; + R+=M_PI; double f22 = cos(x)*cos(z)+sin(x)*sin(y)*sin(z); double f23 = cos(x)*sin(y)*sin(z)-cos(z)*sin(x); //23/22: E = atan( -1.0*f23/(f22*cos(R)) ); if(f22<0.0) - E+=F_PI; + E+=M_PI; } rnElevationDeg = basegfx::fround(basegfx::rad2deg(E)); @@ -922,11 +922,11 @@ void ThreeDHelper::getRotationAngleFromDiagram( rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getY()); rfZAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(aRotation.getZ()); - if(rfZAngleRad<-F_PI2 || rfZAngleRad>F_PI2) + if(rfZAngleRad<-M_PI_2 || rfZAngleRad>M_PI_2) { - rfZAngleRad-=F_PI; - rfXAngleRad-=F_PI; - rfYAngleRad=(F_PI-rfYAngleRad); + rfZAngleRad-=M_PI; + rfXAngleRad-=M_PI; + rfYAngleRad=(M_PI-rfYAngleRad); rfXAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfXAngleRad); rfYAngleRad = lcl_shiftAngleToIntervalMinusPiToPi(rfYAngleRad); @@ -1247,7 +1247,7 @@ void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet ::basegfx::B3DHomMatrix aSceneRotation; if( bPieOrDonut ) - aSceneRotation.rotate( -F_PI/3.0, 0, 0 ); + aSceneRotation.rotate( -M_PI/3.0, 0, 0 ); xSceneProperties->setPropertyValue( "D3DTransformMatrix", uno::Any( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation ))); } diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx index ba4ad8073eb0..d10583c1b77d 100644 --- a/chart2/source/view/axes/Tickmarks.cxx +++ b/chart2/source/view/axes/Tickmarks.cxx @@ -175,7 +175,7 @@ bool TickFactory2D::isHorizontalAxis() const // for skew axes compare angle with horizontal vector double fInclination = std::abs(B2DVector(m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D).angle(B2DVector(1.0, 0.0))); - return fInclination < F_PI4 || fInclination > (F_PI-F_PI4); + return fInclination < M_PI_4 || fInclination > (M_PI-M_PI_4); } bool TickFactory2D::isVerticalAxis() const { @@ -187,7 +187,7 @@ bool TickFactory2D::isVerticalAxis() const // for skew axes compare angle with vertical vector double fInclination = std::abs(B2DVector(m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D).angle(B2DVector(0.0, -1.0))); - return fInclination < F_PI4 || fInclination > (F_PI-F_PI4); + return fInclination < M_PI_4 || fInclination > (M_PI-M_PI_4); } //static sal_Int32 TickFactory2D::getTickScreenDistance( TickIter& rIter ) diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index d5141be5cb58..aa1431516c54 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -107,8 +107,8 @@ drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize double fMaxSize = m_fMaxLogicBubbleSize; - double fMaxRadius = sqrt( fMaxSize / F_PI ); - double fRadius = sqrt( fLogicSize / F_PI ); + double fMaxRadius = sqrt( fMaxSize / M_PI ); + double fRadius = sqrt( fLogicSize / M_PI ); aRet.DirectionX = m_fBubbleSizeFactorToScreen * fRadius / fMaxRadius; aRet.DirectionY = aRet.DirectionX; diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx index 798c6562e1f6..8f36943ade7a 100644 --- a/chart2/source/view/main/LabelPositionHelper.cxx +++ b/chart2/source/view/main/LabelPositionHelper.cxx @@ -130,7 +130,7 @@ void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = fAnglePi-F_PI2; + double beta = fAnglePi-M_PI_2; rfXCorrection = -aSize.Width *std::sin( beta ) -aSize.Height *std::cos( beta )/2.0; if( bRotateAroundCenter ) @@ -140,7 +140,7 @@ void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = fAnglePi - F_PI; + double beta = fAnglePi - M_PI; rfXCorrection = -aSize.Width *std::cos( beta ) -aSize.Height*std::sin( beta )/2.0; if( bRotateAroundCenter ) @@ -150,7 +150,7 @@ void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection } else { - double beta = 2*F_PI - fAnglePi; + double beta = 2*M_PI - fAnglePi; rfXCorrection = -aSize.Height*std::sin( beta )/2.0; if( bRotateAroundCenter ) rfYCorrection = aSize.Width*std::sin( beta )/2.0; @@ -173,7 +173,7 @@ void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = F_PI - fAnglePi; + double beta = M_PI - fAnglePi; rfXCorrection = aSize.Width *std::cos( beta ) + aSize.Height*std::sin( beta )/2.0; if( bRotateAroundCenter ) @@ -183,7 +183,7 @@ void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = 3*F_PI2 - fAnglePi; + double beta = 3*M_PI_2 - fAnglePi; rfXCorrection = aSize.Width *std::sin( beta ) +aSize.Height*std::cos( beta )/2.0; if( bRotateAroundCenter ) @@ -193,9 +193,9 @@ void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection } else { - rfXCorrection = aSize.Height*std::sin( 2*F_PI - fAnglePi )/2.0; + rfXCorrection = aSize.Height*std::sin( 2*M_PI - fAnglePi )/2.0; if( bRotateAroundCenter ) - rfYCorrection = -aSize.Width*std::sin( 2*F_PI - fAnglePi )/2.0; + rfYCorrection = -aSize.Width*std::sin( 2*M_PI - fAnglePi )/2.0; } } @@ -216,7 +216,7 @@ void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = fAnglePi - F_PI2; + double beta = fAnglePi - M_PI_2; rfXCorrection = aSize.Height*std::cos( beta )/2.0; if( !bRotateAroundCenter ) rfXCorrection -= aSize.Width*std::sin( beta )/2.0; @@ -225,7 +225,7 @@ void lcl_correctRotation_Top( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = fAnglePi - F_PI; + double beta = fAnglePi - M_PI; rfXCorrection = -aSize.Height *std::sin( beta )/2.0; if( !bRotateAroundCenter ) rfXCorrection += aSize.Width *std::cos( beta )/2.0; @@ -258,7 +258,7 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = fAnglePi-F_PI2; + double beta = fAnglePi-M_PI_2; rfXCorrection = -aSize.Height*std::cos( beta )/2.0; if( !bRotateAroundCenter ) rfXCorrection += aSize.Width *std::sin( beta )/2.0; @@ -267,7 +267,7 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = 3*F_PI2 - fAnglePi; + double beta = 3*M_PI_2 - fAnglePi; rfXCorrection = aSize.Height*std::cos( beta )/2.0; if( !bRotateAroundCenter ) rfXCorrection -= aSize.Width *std::sin( beta )/2.0; @@ -276,7 +276,7 @@ void lcl_correctRotation_Bottom( double& rfXCorrection, double& rfYCorrection } else { - double beta = 2*F_PI - fAnglePi; + double beta = 2*M_PI - fAnglePi; rfXCorrection = aSize.Height*std::sin( beta )/2.0; if( !bRotateAroundCenter ) rfXCorrection += aSize.Width*std::cos( beta )/2.0; @@ -298,14 +298,14 @@ void lcl_correctRotation_Left_Top( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = fAnglePi-F_PI2; + double beta = fAnglePi-M_PI_2; rfXCorrection = -aSize.Width*std::sin( beta ); rfYCorrection = -aSize.Height*std::sin( beta ) -aSize.Width*std::cos( beta ); } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = 3*F_PI2 - fAnglePi; + double beta = 3*M_PI_2 - fAnglePi; rfXCorrection = -aSize.Height*std::cos( beta ) -aSize.Width*std::sin( beta ); rfYCorrection = -aSize.Height*std::sin( beta ); @@ -330,14 +330,14 @@ void lcl_correctRotation_Left_Bottom( double& rfXCorrection, double& rfYCorrecti } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = fAnglePi-F_PI2; + double beta = fAnglePi-M_PI_2; rfXCorrection = -aSize.Width*std::sin( beta ) -aSize.Height*std::cos( beta ); rfYCorrection = aSize.Height*std::sin( beta ); } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = 3*F_PI2 - fAnglePi; + double beta = 3*M_PI_2 - fAnglePi; rfXCorrection = -aSize.Width*std::sin( beta ); rfYCorrection = aSize.Width*std::cos( beta ) +aSize.Height*std::sin( beta ); @@ -362,14 +362,14 @@ void lcl_correctRotation_Right_Top( double& rfXCorrection, double& rfYCorrection } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = fAnglePi-F_PI2; + double beta = fAnglePi-M_PI_2; rfXCorrection = aSize.Width*std::sin( beta ) +aSize.Height*std::cos( beta ); rfYCorrection = -aSize.Height*std::sin( beta ); } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = 3*F_PI2 - fAnglePi; + double beta = 3*M_PI_2 - fAnglePi; rfXCorrection = aSize.Width*std::sin( beta ); rfYCorrection = -aSize.Width*std::cos( beta ) -aSize.Height*std::sin( beta ); @@ -394,14 +394,14 @@ void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrect } else if( fAnglePositiveDegree<= 180.0 ) { - double beta = fAnglePi-F_PI2; + double beta = fAnglePi-M_PI_2; rfXCorrection = aSize.Width*std::sin( beta ); rfYCorrection = aSize.Height*std::sin( beta ) +aSize.Width*std::cos( beta ); } else if( fAnglePositiveDegree<= 270.0 ) { - double beta = 3*F_PI2 - fAnglePi; + double beta = 3*M_PI_2 - fAnglePi; rfXCorrection = aSize.Height*std::cos( beta ) +aSize.Width*std::sin( beta ); rfYCorrection = aSize.Height*std::sin( beta ); diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 94ada8d02727..fe9bfe783615 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -426,7 +426,7 @@ uno::Reference<drawing::XShape> //Matrix for position basegfx::B3DHomMatrix aHomMatrix; if (nRotateZAngleHundredthDegree != 0) - aHomMatrix.rotate(0.0, 0.0, -nRotateZAngleHundredthDegree / 18000.00 * F_PI); + aHomMatrix.rotate(0.0, 0.0, -nRotateZAngleHundredthDegree / 18000.00 * M_PI); aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ - (fDepth / 2.0)); @@ -669,7 +669,7 @@ uno::Reference<drawing::XShape> //Matrix for position basegfx::B3DHomMatrix aHomMatrix; if (nRotateZAngleHundredthDegree != 0) - aHomMatrix.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*F_PI); + aHomMatrix.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*M_PI); //stretch the symmetric objects to given depth aHomMatrix.scale(1.0,1.0,rSize.DirectionZ/rSize.DirectionX); aHomMatrix.translate(rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ); @@ -895,7 +895,7 @@ uno::Reference< drawing::XShape > ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) ); aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY); - const double fAngleSubdivisionRadian = F_PI/10.0; + const double fAngleSubdivisionRadian = M_PI/10.0; drawing::PolyPolygonBezierCoords aCoords = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius, @@ -948,7 +948,7 @@ uno::Reference< drawing::XShape > ::basegfx::B2DHomMatrix aTransformationFromUnitCircle( IgnoreZ( HomogenMatrixToB3DHomMatrix(rUnitCircleToScene) ) ); aTransformationFromUnitCircle.translate(rOffset.DirectionX,rOffset.DirectionY); - const double fAngleSubdivisionRadian = F_PI/32.0; + const double fAngleSubdivisionRadian = M_PI/32.0; drawing::PolyPolygonBezierCoords aCoords = getRingBezierCoords(fUnitCircleInnerRadius, fUnitCircleOuterRadius, diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx index 79d5d7a28256..44c2556ad989 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -86,7 +86,7 @@ void VTitle::changePosition( const awt::Point& rPos ) //set position matrix //the matrix needs to be set at the end behind autogrow and such position influencing properties ::basegfx::B2DHomMatrix aM; - aM.rotate( -m_fRotationAngleDegree*F_PI/180.0 );//#i78696#->#i80521# + aM.rotate( -m_fRotationAngleDegree*M_PI/180.0 );//#i78696#->#i80521# aM.translate( m_nXPos, m_nYPos); xShapeProp->setPropertyValue( "Transformation", uno::Any( B2DHomMatrixToHomogenMatrix3(aM) ) ); } diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 3fb31a79ee73..7f367cb9fe40 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -768,7 +768,7 @@ namespace cppcanvas::internal if( nFontAngle != 0 ) { // set to unity transform rotated by font angle - const double nAngle( nFontAngle * (F_PI / 1800.0) ); + const double nAngle( nFontAngle * (M_PI / 1800.0) ); o_rFontRotation = -nAngle; } else diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index b01f8d76222a..49b26cb919b0 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -65,7 +65,7 @@ namespace drawinglayer::primitive2d getDefinitionRange(), getOutputRange(), fDistance, - fAngle - F_PI4); + fAngle - M_PI_4); aHatch.appendTransformations(aMatrices); @@ -78,7 +78,7 @@ namespace drawinglayer::primitive2d getDefinitionRange(), getOutputRange(), fDistance, - fAngle - F_PI2); + fAngle - M_PI_2); aHatch.appendTransformations(aMatrices); diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 38a14e927005..a6e209a577c6 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -395,7 +395,7 @@ vcl::Font getVclFontFromFontAttribute(const attribute::FontAttribute& rFontAttri // handle FontRotation (if defined) if (!basegfx::fTools::equalZero(fFontRotation)) { - sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0 / F_PI))); + sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0 / M_PI))); aRetval.SetOrientation(Degree10(aRotate10th % 3600)); } diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index b86e7acc20e7..4e584f2b6e92 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -101,7 +101,7 @@ void TextSimplePortionPrimitive2D::getTextOutlinesAndTransformation( if (basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0)) { aScale = basegfx::absolute(aScale); - fRotate += F_PI; + fRotate += M_PI; } // for the TextLayouterDevice, it is necessary to have a scaling representing diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index 59098d3cd3ef..a699f71706bb 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -142,7 +142,7 @@ namespace drawinglayer::primitive3d aOutlineRange, aOutlineRange, getHatch().getDistance(), - fAngle - F_PI4); + fAngle - M_PI_4); aHatch.appendTransformations(aMatrices); @@ -155,7 +155,7 @@ namespace drawinglayer::primitive3d aOutlineRange, aOutlineRange, getHatch().getDistance(), - fAngle - F_PI2); + fAngle - M_PI_2); aHatch.appendTransformations(aMatrices); diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index 8065ad73e54f..50aae077d2ba 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -234,7 +234,7 @@ namespace drawinglayer::primitive3d nSegments, nVerSeg, true, - F_PI2, 0.0, + M_PI_2, 0.0, 0.0, F_2PI)); const sal_uInt32 nCount(aSphere.count()); @@ -244,7 +244,7 @@ namespace drawinglayer::primitive3d // forget to transform normals, too basegfx::B3DHomMatrix aSphereTrans; - aSphereTrans.rotate(0.0, 0.0, F_PI2); + aSphereTrans.rotate(0.0, 0.0, M_PI_2); aSphere.transform(aSphereTrans); aSphere.transformNormals(aSphereTrans); @@ -301,7 +301,7 @@ namespace drawinglayer::primitive3d if(nHorSeg) { // create half-sphere - const basegfx::B3DPolyPolygon aSphere(basegfx::utils::createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, true, F_PI2, -F_PI2, 0.0, fAngle)); + const basegfx::B3DPolyPolygon aSphere(basegfx::utils::createUnitSphereFillPolyPolygon(nHorSeg, nVerSeg, true, M_PI_2, -M_PI_2, 0.0, fAngle)); for(sal_uInt32 a(0); a < aSphere.count(); a++) { @@ -331,13 +331,13 @@ namespace drawinglayer::primitive3d } } - const double fInc(F_PI / static_cast<double>(nVerSeg)); + const double fInc(M_PI / static_cast<double>(nVerSeg)); const double fSin(sin(-fAngle)); const double fCos(cos(-fAngle)); const bool bMiter(basegfx::B2DLineJoin::Miter == aLineJoin); const double fMiterSin(bMiter ? sin(-(fAngle/2.0)) : 0.0); const double fMiterCos(bMiter ? cos(-(fAngle/2.0)) : 0.0); - double fPos(-F_PI2); + double fPos(-M_PI_2); basegfx::B3DPoint aPointOnXY, aPointRotY, aNextPointOnXY, aNextPointRotY; basegfx::B3DPoint aCurrMiter, aNextMiter; basegfx::B3DPolygon aNewPolygon, aMiterPolygon; @@ -611,7 +611,7 @@ using namespace com::sun::star; if(!basegfx::fTools::equalZero(fCross)) { // line connect non-parallel, aBack, aForw, use getLineJoin() - const double fAngle(acos(aBack.scalar(aForw) / (fForwLen * aBack.getLength()))); // 0.0 .. F_PI2 + const double fAngle(acos(aBack.scalar(aForw) / (fForwLen * aBack.getLength()))); // 0.0 .. M_PI_2 Primitive3DContainer aNewList( getLineJoinSegments( nSegments, @@ -629,8 +629,8 @@ using namespace com::sun::star; // create trans by rotating unit sphere with angle 90 degrees around Y, then 180-fRot in X. // Also apply usual scaling and translation basegfx::B3DHomMatrix aSphereTrans; - aSphereTrans.rotate(0.0, F_PI2, 0.0); - aSphereTrans.rotate(F_PI - fRotInYZ, 0.0, 0.0); + aSphereTrans.rotate(0.0, M_PI_2, 0.0); + aSphereTrans.rotate(M_PI - fRotInYZ, 0.0, 0.0); aSphereTrans *= aRotVector; aSphereTrans.scale(getRadius(), getRadius(), getRadius()); aSphereTrans.translate(aCurr.getX(), aCurr.getY(), aCurr.getZ()); @@ -655,7 +655,7 @@ using namespace com::sun::star; basegfx::B3DHomMatrix aBackCapTrans; // Mirror (line end) and radius scale - aBackCapTrans.rotate(0.0, F_PI, 0.0); + aBackCapTrans.rotate(0.0, M_PI, 0.0); aBackCapTrans.scale(getRadius(), getRadius(), getRadius()); if(bLineCapSquare && bLast) diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index 10ba09e41b07..919fbcf5ab4a 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -234,7 +234,7 @@ namespace drawinglayer::primitive3d // take each angle which deviates more than 10% from going straight as // special edge. This will detect the two outer edges of pie segments, // but not always the center one (think about a near 180 degree pie) - if(F_PI - fabs(fAngle) > F_PI * 0.1) + if(M_PI - fabs(fAngle) > M_PI * 0.1) { if(nPointCount == nIndexA) { diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index b055ef229ce2..5d3f68d29a4a 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -119,7 +119,7 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( // be expressed as rotation by PI. Use this since the Font rendering will not // apply the negative scales in any form aFontScaling = basegfx::absolute(aFontScaling); - fRotate += F_PI; + fRotate += M_PI; } if (basegfx::fTools::more(aFontScaling.getX(), 0.0) diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 4d5df6e52e60..0a83937991d2 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -285,7 +285,7 @@ namespace drawinglayer::texture aOutlineRange, aOutlineRange, rHatch.getDistance(), - fAngleA + F_PI2) ); + fAngleA + M_PI_2) ); } if(attribute::HatchStyle::Triple == rHatch.getStyle()) @@ -294,7 +294,7 @@ namespace drawinglayer::texture aOutlineRange, aOutlineRange, rHatch.getDistance(), - fAngleA + F_PI4) ); + fAngleA + M_PI_4) ); } } diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx index 102e3b324942..7045695bf5fb 100644 --- a/include/basegfx/numeric/ftools.hxx +++ b/include/basegfx/numeric/ftools.hxx @@ -27,15 +27,6 @@ #include <algorithm> -#ifndef F_PI -#define F_PI M_PI -#endif -#ifndef F_PI2 -#define F_PI2 M_PI_2 -#endif -#ifndef F_PI4 -#define F_PI4 M_PI_4 -#endif #ifndef F_PI1800 #define F_PI1800 (M_PI/1800.0) #endif diff --git a/include/basegfx/polygon/b2dlinegeometry.hxx b/include/basegfx/polygon/b2dlinegeometry.hxx index 0e9f5241b866..e12dd74987f9 100644 --- a/include/basegfx/polygon/b2dlinegeometry.hxx +++ b/include/basegfx/polygon/b2dlinegeometry.hxx @@ -106,7 +106,7 @@ namespace basegfx::utils Allows to hand over the maximum allowed angle between an edge and it's control vectors. The smaller, the more subdivisions will be needed to create the filled geometry. Allowed range is cropped to - [F_PI2 .. 0.01 * F_PI2]. + [M_PI_2 .. 0.01 * M_PI_2]. @param fMaxPartOfEdge Allows to influence from with relative length of a control vector @@ -118,7 +118,7 @@ namespace basegfx::utils The minimum wanted angle between two edges when edge rounding is using miter. When an edge is smaller than this (tighter) the usual fallback to bevel is used. Allowed range is cropped - to [F_PI .. 0.01 * F_PI]. + to [M_PI .. 0.01 * M_PI]. Commit 51b5b93092d6231615de470c62494c24e54828a1 needs revert, we need the triangulation for X11 fat line drawing diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx index 40a4027a507d..a2a3263a573d 100644 --- a/include/basegfx/polygon/b2dpolygontools.hxx +++ b/include/basegfx/polygon/b2dpolygontools.hxx @@ -263,7 +263,7 @@ namespace basegfx::utils */ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius ); - /// create half circle centered on (0,0) from [0 .. F_PI] + /// create half circle centered on (0,0) from [0 .. M_PI] B2DPolygon const & createHalfUnitCircle(); /** create a polygon which describes the unit circle and close it diff --git a/include/basegfx/polygon/b3dpolypolygontools.hxx b/include/basegfx/polygon/b3dpolypolygontools.hxx index cd51ac9e6524..4480f3266704 100644 --- a/include/basegfx/polygon/b3dpolypolygontools.hxx +++ b/include/basegfx/polygon/b3dpolypolygontools.hxx @@ -61,7 +61,7 @@ namespace basegfx::utils */ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSpherePolyPolygon( sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, - double fVerStart = F_PI2, double fVerStop = -F_PI2, + double fVerStart = M_PI_2, double fVerStop = -M_PI_2, double fHorStart = 0.0, double fHorStop = F_2PI); /** Create a 3D line polyPolygon from a B3DRange which defines a sphere with the given count of hor and ver segments. @@ -71,7 +71,7 @@ namespace basegfx::utils BASEGFX_DLLPUBLIC B3DPolyPolygon createSpherePolyPolygonFromB3DRange( const B3DRange& rRange, sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, - double fVerStart = F_PI2, double fVerStop = -F_PI2, + double fVerStart = M_PI_2, double fVerStop = -M_PI_2, double fHorStart = 0.0, double fHorStop = F_2PI); /** same as createUnitSpherePolyPolygon, but creates filled polygons (closed and oriented) @@ -80,7 +80,7 @@ namespace basegfx::utils BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSphereFillPolyPolygon( sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, bool bNormals = false, - double fVerStart = F_PI2, double fVerStop = -F_PI2, + double fVerStart = M_PI_2, double fVerStop = -M_PI_2, double fHorStart = 0.0, double fHorStop = F_2PI); /** same as createSpherePolyPolygonFromB3DRange, but creates filled polygons (closed and oriented) @@ -90,7 +90,7 @@ namespace basegfx::utils const B3DRange& rRange, sal_uInt32 nHorSeg, sal_uInt32 nVerSeg, bool bNormals = false, - double fVerStart = F_PI2, double fVerStop = -F_PI2, + double fVerStart = M_PI_2, double fVerStop = -M_PI_2, double fHorStart = 0.0, double fHorStop = F_2PI); /** Create/replace normals for given 3d geometry with default normals from given center to outside. diff --git a/sc/source/core/opencl/opinlinefun_statistical.cxx b/sc/source/core/opencl/opinlinefun_statistical.cxx index dfed055a9b44..6988ff7f03e8 100644 --- a/sc/source/core/opencl/opinlinefun_statistical.cxx +++ b/sc/source/core/opencl/opinlinefun_statistical.cxx @@ -10,7 +10,7 @@ #ifndef SC_OPENCL_OPINLINFUN_statistical #define SC_OPENCL_OPINLINFUN_statistical std::string MinDecl = "#define Min 2.22507e-308\n"; -std::string F_PIDecl="#define F_PI 3.1415926\n"; +std::string F_PIDecl="#define M_PI 3.1415926\n"; std::string fBigInvDecl ="#define fBigInv 2.22045e-016\n"; std::string fMachEpsDecl ="#define fMachEps 2.22045e-016\n"; std::string fLogDblMaxDecl ="#define fLogDblMax log(1.79769e+308)\n"; @@ -406,7 +406,7 @@ std::string GetChiSqDistPDF = " }\n" " else\n" " {\n" -" fValue = pow(sqrt(fX*2*F_PI),-1.0);\n" +" fValue = pow(sqrt(fX*2*M_PI),-1.0);\n" " fCount = 1.0;\n" " }\n" " while ( fCount < fDF)\n" diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index bd4a37d85742..4e1471c46fbc 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -1725,7 +1725,7 @@ void ScInterpreter::ScBitRshift() void ScInterpreter::ScPi() { - PushDouble(F_PI); + PushDouble(M_PI); } void ScInterpreter::ScRandomImpl( const std::function<double( double fFirst, double fLast )>& RandomFunc, @@ -1869,7 +1869,7 @@ void ScInterpreter::ScArcTan() void ScInterpreter::ScArcCot() { - PushDouble((F_PI2) - atan(GetDouble())); + PushDouble((M_PI_2) - atan(GetDouble())); } void ScInterpreter::ScSinHyp() diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index c2c91f621bfd..8d7ba5ea4952 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -585,7 +585,7 @@ static double lcl_GetLogGammaHelper(double fZ) /** You must ensure non integer arguments for fZ<1 */ double ScInterpreter::GetGamma(double fZ) { - const double fLogPi = log(F_PI); + const double fLogPi = log(M_PI); const double fLogDblMax = log( ::std::numeric_limits<double>::max()); if (fZ > fMaxGammaArgument) @@ -612,7 +612,7 @@ double ScInterpreter::GetGamma(double fZ) } // fZ<-0.5 // Use Euler's reflection formula: gamma(x)= pi/ ( gamma(1-x)*sin(pi*x) ) - double fLogDivisor = lcl_GetLogGammaHelper(1-fZ) + log( std::abs( ::rtl::math::sin( F_PI*fZ))); + double fLogDivisor = lcl_GetLogGammaHelper(1-fZ) + log( std::abs( ::rtl::math::sin( M_PI*fZ))); if (fLogDivisor - fLogPi >= fLogDblMax) // underflow return 0.0; @@ -623,7 +623,7 @@ double ScInterpreter::GetGamma(double fZ) return HUGE_VAL; } - return exp( fLogPi - fLogDivisor) * ((::rtl::math::sin( F_PI*fZ) < 0.0) ? -1.0 : 1.0); + return exp( fLogPi - fLogDivisor) * ((::rtl::math::sin( M_PI*fZ) < 0.0) ? -1.0 : 1.0); } /** You must ensure fZ>0 */ @@ -709,7 +709,7 @@ double ScInterpreter::GetChiSqDistPDF(double fX, double fDF) } else { - fValue = 1/sqrt(fX*2*F_PI); + fValue = 1/sqrt(fX*2*M_PI); fCount = 1.0; } while ( fCount < fDF) @@ -1610,7 +1610,7 @@ void ScInterpreter::ScStdNormDist_MS() if ( bCumulative ) PushDouble( integralPhi( x ) ); else - PushDouble( exp( - pow( x, 2 ) / 2 ) / sqrt( 2 * F_PI ) ); + PushDouble( exp( - pow( x, 2 ) / 2 ) / sqrt( 2 * M_PI ) ); } void ScInterpreter::ScExpDist() @@ -4849,7 +4849,7 @@ void ScTwiddleFactors::Compute() mfWReal.resize(mnN); mfWImag.resize(mnN); - double nW = (mbInverse ? 2 : -2)*F_PI/static_cast<double>(mnN); + double nW = (mbInverse ? 2 : -2)*M_PI/static_cast<double>(mnN); if (mnN == 1) { @@ -5189,7 +5189,7 @@ void ScComplexBluesteinFFT::Compute() { std::vector<double> aRealScalars(mnPoints); std::vector<double> aImagScalars(mnPoints); - double fW = (mbInverse ? 2 : -2)*F_PI/static_cast<double>(mnPoints); + double fW = (mbInverse ? 2 : -2)*M_PI/static_cast<double>(mnPoints); for (SCSIZE nIdx = 0; nIdx < mnPoints; ++nIdx) { double fAngle = 0.5*fW*static_cast<double>(nIdx*nIdx); diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 982143d877c4..e4e3ec402e89 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -1453,7 +1453,7 @@ void XclExpFmlaCompImpl::PrepareFunction( const XclExpFuncData& rFuncData ) AppendIntToken( 1 ); break; case ocArcCot: // simulate ACOT(x) by (PI/2-ATAN(x)) - AppendNumToken( F_PI2 ); + AppendNumToken( M_PI_2 ); break; default:; } diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 5d6534db0721..928dfbe5caa9 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -456,7 +456,7 @@ namespace svgio::svgreader else if (DegreeType::grad == aType) { // looks like 100 grad is 90 degrees - fAngle *= F_PI / 200.0; + fAngle *= M_PI / 200.0; } return true; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index ccd15f479b4f..2fb4df76bd1e 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -831,7 +831,7 @@ double EnhancedCustomShape2d::GetEnumFunc( const ExpressionFunct eFunc ) const double fRet = 0.0; switch( eFunc ) { - case ExpressionFunct::EnumPi : fRet = F_PI; break; + case ExpressionFunct::EnumPi : fRet = M_PI; break; case ExpressionFunct::EnumLeft : fRet = static_cast<double>(nCoordLeft); break; case ExpressionFunct::EnumTop : fRet = static_cast<double>(nCoordTop); break; case ExpressionFunct::EnumRight : fRet = (static_cast<double>(nCoordLeft) + static_cast<double>(nCoordWidth)) * fXRatio; break; @@ -1760,8 +1760,8 @@ bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nIndex if (ftmpX != 0.0 || ftmpY != 0.0) faA = atan2(ftmpY, ftmpX); // range ]-pi..pi], here -pi < faA < -pi/2 // screen 270 deg = mathematic coordinate system -pi/2 - double fha(-F_PI2 - faA); // positive circle angle difference to 270 deg - if (abs(fha) == F_PI2) // should not happen, but ensure no tan(90deg) + double fha(-M_PI_2 - faA); // positive circle angle difference to 270 deg + if (abs(fha) == M_PI_2) // should not happen, but ensure no tan(90deg) fha = 0.12; // dummy value double flFD(2 * std::min(frw, frh) * tan(fha) - fth); if (fss != 0.0) @@ -2477,11 +2477,11 @@ void EnhancedCustomShape2d::CreateSubPath( { if (aEnd.getY()<aStart.getY()) // left, up { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, F_PI2, F_PI); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, M_PI_2, M_PI); } else // left, down { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, F_PI, 1.5*F_PI); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, M_PI, 1.5*M_PI); aArc.flip(); } } @@ -2489,12 +2489,12 @@ void EnhancedCustomShape2d::CreateSubPath( { if (aEnd.getY()<aStart.getY()) // right, up { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 0.0, F_PI2); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 0.0, M_PI_2); aArc.flip(); } else // right, down { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*F_PI, F_2PI); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*M_PI, F_2PI); } } } @@ -2505,23 +2505,23 @@ void EnhancedCustomShape2d::CreateSubPath( { if (aEnd.getY()<aStart.getY()) // up, left { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*F_PI, F_2PI); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 1.5*M_PI, F_2PI); aArc.flip(); } else // down, left { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 0.0, F_PI2); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, 0.0, M_PI_2); } } else // aEnd.getX()>=aStart.getX() { if (aEnd.getY()<aStart.getY()) // up, right { - aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, F_PI, 1.5*F_PI); + aArc = basegfx::utils::createPolygonFromEllipseSegment(aCenter, fRadiusX, fRadiusY, M_PI, 1.5*M_PI); } else // down, right { ... etc. - the rest is truncated