summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-18 17:43:46 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-19 09:59:43 +0100
commit37429f2690a96491ad0e4fa2a04f2fa88a66da87 (patch)
tree9963c1f531f22306edaf2ce8b41d5636f5e191f3 /basegfx
parent0afd2d3bfa9d55249ffd1408681ff04decf2d8fa (diff)
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.kaganski@collabora.com>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/curve/b2dcubicbezier.cxx6
-rw-r--r--basegfx/source/matrix/b2dhommatrixtools.cxx2
-rw-r--r--basegfx/source/matrix/b3dhommatrix.cxx4
-rw-r--r--basegfx/source/polygon/b2dlinegeometry.cxx30
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx18
-rw-r--r--basegfx/source/polygon/b2dtrapezoid.cxx2
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx6
-rw-r--r--basegfx/source/polygon/b3dpolypolygontools.cxx6
-rw-r--r--basegfx/test/B2DHomMatrixTest.cxx14
9 files changed, 44 insertions, 44 deletions
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()