summaryrefslogtreecommitdiff
path: root/basegfx/source/polygon
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/source/polygon
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/source/polygon')
-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
5 files changed, 31 insertions, 31 deletions
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);