Skip to content

Commit 2e5d1ab

Browse files
committed
(q)cos -> std::cos
1 parent 7c5aa05 commit 2e5d1ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+188
-188
lines changed

src/analysis/raster/qgshillshadefilter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ float QgsHillshadeFilter::processNineCellWindow( float *x11, float *x21, float *
4949
{
5050
aspect_rad = M_PI + std::atan2( derX, derY );
5151
}
52-
return qMax( 0.0, 255.0 * ( ( cos( zenith_rad ) * cos( slope_rad ) ) + ( sin( zenith_rad ) * sin( slope_rad ) * cos( azimuth_rad - aspect_rad ) ) ) );
52+
return qMax( 0.0, 255.0 * ( ( std::cos( zenith_rad ) * std::cos( slope_rad ) ) + ( sin( zenith_rad ) * sin( slope_rad ) * std::cos( azimuth_rad - aspect_rad ) ) ) );
5353
}

src/analysis/raster/qgsrastermatrix.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ bool QgsRasterMatrix::oneArgumentOperation( OneArgOperator op )
223223
mData[i] = sin( value );
224224
break;
225225
case opCOS:
226-
mData[i] = cos( value );
226+
mData[i] = std::cos( value );
227227
break;
228228
case opTAN:
229229
mData[i] = tan( value );

src/analysis/raster/qgsrastermatrix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class ANALYSIS_EXPORT QgsRasterMatrix
124124
bool twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix &other );
125125
double calculateTwoArgumentOp( TwoArgOperator op, double arg1, double arg2 ) const;
126126

127-
/*sqrt, sin, cos, tan, asin, acos, atan*/
127+
/*sqrt, sin, std::cos, tan, asin, acos, atan*/
128128
bool oneArgumentOperation( OneArgOperator op );
129129
bool testPowerValidity( double base, double power ) const;
130130
};

src/analysis/raster/qgsrelief.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ bool QgsRelief::processNineCellWindow( float *x1, float *x2, float *x3, float *x
362362
int r3, g3, b3;
363363
if ( angle_diff < 90 )
364364
{
365-
int aspectVal = ( 1 - cos( angle_diff * M_PI / 180 ) ) * 255;
365+
int aspectVal = ( 1 - std::cos( angle_diff * M_PI / 180 ) ) * 255;
366366
r3 = 0.5 * 255 + hillShadeValue315 * 0.5;
367367
g3 = 0.5 * 255 + hillShadeValue315 * 0.5;
368368
b3 = 0.5 * aspectVal + hillShadeValue315 * 0.5;

src/app/dwg/libdxfrw/drw_entities.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -956,9 +956,9 @@ void DRW_Ellipse::toPolyline( DRW_Polyline *pol, int parts ) const
956956
{
957957
double radMajor = sqrt( secPoint.x * secPoint.x + secPoint.y * secPoint.y );
958958
double radMinor = radMajor * ratio;
959-
//calculate sin & cos of included angle
959+
//calculate sin & std::cos of included angle
960960
double incAngle = std::atan2( secPoint.y, secPoint.x );
961-
double cosRot = cos( incAngle );
961+
double cosRot = std::cos( incAngle );
962962
double sinRot = sin( incAngle );
963963

964964
incAngle = M_PIx2 / parts;
@@ -969,7 +969,7 @@ void DRW_Ellipse::toPolyline( DRW_Polyline *pol, int parts ) const
969969

970970
while ( curAngle < endAngle )
971971
{
972-
double cosCurr = cos( curAngle );
972+
double cosCurr = std::cos( curAngle );
973973
double sinCurr = sin( curAngle );
974974
double x = basePoint.x + cosCurr * cosRot * radMajor - sinCurr * sinRot * radMinor;
975975
double y = basePoint.y + cosCurr * sinRot * radMajor + sinCurr * cosRot * radMinor;

src/app/dwg/qgsdwgimporter.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1341,9 +1341,9 @@ void QgsDwgImporter::addArc( const DRW_Arc &data )
13411341

13421342
QgsCircularString c;
13431343
c.setPoints( QgsPointSequence()
1344-
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a0 ) * data.mRadius, data.basePoint.y + sin( a0 ) * data.mRadius )
1345-
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a1 ) * data.mRadius, data.basePoint.y + sin( a1 ) * data.mRadius )
1346-
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + cos( a2 ) * data.mRadius, data.basePoint.y + sin( a2 ) * data.mRadius )
1344+
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a0 ) * data.mRadius, data.basePoint.y + sin( a0 ) * data.mRadius )
1345+
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a1 ) * data.mRadius, data.basePoint.y + sin( a1 ) * data.mRadius )
1346+
<< QgsPoint( QgsWkbTypes::PointZ, data.basePoint.x + std::cos( a2 ) * data.mRadius, data.basePoint.y + sin( a2 ) * data.mRadius )
13471347
);
13481348

13491349
if ( !createFeature( layer, f, c ) )
@@ -1446,7 +1446,7 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun
14461446
double dy = data.vertlist[i1]->y - data.vertlist[i0]->y;
14471447
double c = sqrt( dx * dx + dy * dy );
14481448
double r = c / 2.0 / sin( a );
1449-
double h = r * ( 1 - cos( a ) );
1449+
double h = r * ( 1 - std::cos( a ) );
14501450

14511451
s << QgsPoint( QgsWkbTypes::PointZ,
14521452
data.vertlist[i0]->x + 0.5 * dx + h * dy / c,
@@ -1557,7 +1557,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data )
15571557
double dy = p1.y() - p0.y();
15581558
double c = sqrt( dx * dx + dy * dy );
15591559
double r = c / 2.0 / sin( a );
1560-
double h = r * ( 1 - cos( a ) );
1560+
double h = r * ( 1 - std::cos( a ) );
15611561

15621562
s << QgsPoint( QgsWkbTypes::PointZ,
15631563
p0.x() + 0.5 * dx + h * dy / c,
@@ -1759,7 +1759,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data )
17591759
double dz = p1.z() - p0.z();
17601760
double c = sqrt( dx * dx + dy * dy );
17611761
double r = c / 2.0 / sin( a );
1762-
double h = r * ( 1 - cos( a ) );
1762+
double h = r * ( 1 - std::cos( a ) );
17631763

17641764
s << QgsPoint( QgsWkbTypes::PointZ,
17651765
p0.x() + 0.5 * dx + h * dy / c,

src/app/nodetool/qgsnodetool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ QgsPointXY QgsNodeTool::positionForEndpointMarker( const QgsPointLocator::Match
682682
double dy = pt1.y() - pt0.y();
683683
double dist = 15 * canvas()->mapSettings().mapUnitsPerPixel();
684684
double angle = std::atan2( dy, dx ); // to the top: angle=0, to the right: angle=90, to the left: angle=-90
685-
double x = pt1.x() + cos( angle ) * dist;
685+
double x = pt1.x() + std::cos( angle ) * dist;
686686
double y = pt1.y() + sin( angle ) * dist;
687687
return QgsPointXY( x, y );
688688
}

src/app/qgsdecorationnortharrow.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ void QgsDecorationNorthArrow::render( const QgsMapSettings &mapSettings, QgsRend
137137

138138
double myRadiansDouble = mRotationInt * M_PI / 180.0;
139139
int xShift = static_cast<int>( (
140-
( centerXDouble * cos( myRadiansDouble ) ) +
140+
( centerXDouble * std::cos( myRadiansDouble ) ) +
141141
( centerYDouble * sin( myRadiansDouble ) )
142142
) - centerXDouble );
143143
int yShift = static_cast<int>( (
144144
( -centerXDouble * sin( myRadiansDouble ) ) +
145-
( centerYDouble * cos( myRadiansDouble ) )
145+
( centerYDouble * std::cos( myRadiansDouble ) )
146146
) - centerYDouble );
147147

148148
// need width/height of paint device

src/app/qgsdecorationnortharrowdialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ void QgsDecorationNorthArrowDialog::drawNorthArrow()
155155
const double PI = 3.14159265358979323846;
156156
double myRadiansDouble = ( PI / 180 ) * rotation;
157157
int xShift = static_cast<int>( (
158-
( centerXDouble * cos( myRadiansDouble ) ) +
158+
( centerXDouble * std::cos( myRadiansDouble ) ) +
159159
( centerYDouble * sin( myRadiansDouble ) )
160160
) - centerXDouble );
161161
int yShift = static_cast<int>( (
162162
( -centerXDouble * sin( myRadiansDouble ) ) +
163-
( centerYDouble * cos( myRadiansDouble ) )
163+
( centerYDouble * std::cos( myRadiansDouble ) )
164164
) - centerYDouble );
165165

166166
//draw the pixmap in the proper position

src/app/qgsmaptoollabel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ bool QgsMapToolLabel::currentLabelRotationPoint( QgsPointXY &pos, bool ignoreUps
376376
}
377377

378378
double angle = mCurrentLabel.pos.rotation;
379-
double xd = xdiff * cos( angle ) - ydiff * sin( angle );
380-
double yd = xdiff * sin( angle ) + ydiff * cos( angle );
379+
double xd = xdiff * std::cos( angle ) - ydiff * sin( angle );
380+
double yd = xdiff * sin( angle ) + ydiff * std::cos( angle );
381381
if ( mCurrentLabel.pos.upsideDown && !ignoreUpsideDown )
382382
{
383383
pos.setX( pos.x() - xd );

src/app/qgsmaptooloffsetpointsymbol.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ QPointF QgsMapToolOffsetPointSymbol::calculateOffset( const QgsPointXY &startPoi
270270
QPointF QgsMapToolOffsetPointSymbol::rotatedOffset( QPointF offset, double angle ) const
271271
{
272272
angle = DEG2RAD( 360 - angle );
273-
double c = cos( angle ), s = sin( angle );
273+
double c = std::cos( angle ), s = sin( angle );
274274
return QPointF( offset.x() * c - offset.y() * s, offset.x() * s + offset.y() * c );
275275
}
276276

src/app/qgsmaptoolrotatefeature.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,12 @@ void QgsMapToolRotateFeature::applyRotation( double rotation )
351351
//calculations for affine transformation
352352
double angle = -1 * mRotation * ( PI / 180 );
353353
QgsPointXY anchorPoint = toLayerCoordinates( vlayer, mStartPointMapCoords );
354-
double a = cos( angle );
354+
double a = std::cos( angle );
355355
double b = -1 * sin( angle );
356-
double c = anchorPoint.x() - cos( angle ) * anchorPoint.x() + sin( angle ) * anchorPoint.y();
356+
double c = anchorPoint.x() - std::cos( angle ) * anchorPoint.x() + sin( angle ) * anchorPoint.y();
357357
double d = sin( angle );
358-
double ee = cos( angle );
359-
double f = anchorPoint.y() - sin( angle ) * anchorPoint.x() - cos( angle ) * anchorPoint.y();
358+
double ee = std::cos( angle );
359+
double f = anchorPoint.y() - sin( angle ) * anchorPoint.x() - std::cos( angle ) * anchorPoint.y();
360360

361361
vlayer->beginEditCommand( tr( "Features Rotated" ) );
362362

src/app/qgsmaptoolrotatelabel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ QgsPointXY QgsMapToolRotateLabel::rotatePointCounterClockwise( const QgsPointXY
230230
double v1x = input.x() - centerPoint.x();
231231
double v1y = input.y() - centerPoint.y();
232232

233-
double v2x = cos( rad ) * v1x - sin( rad ) * v1y;
234-
double v2y = sin( rad ) * v1x + cos( rad ) * v1y;
233+
double v2x = std::cos( rad ) * v1x - sin( rad ) * v1y;
234+
double v2y = sin( rad ) * v1x + std::cos( rad ) * v1y;
235235

236236
return QgsPointXY( centerPoint.x() + v2x, centerPoint.y() + v2y );
237237
}

src/app/qgsmaptoolselectradius.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void QgsMapToolSelectRadius::setRadiusRubberBand( QgsPointXY &radiusEdge )
107107
for ( int i = 0; i <= RADIUS_SEGMENTS; ++i )
108108
{
109109
double theta = i * ( 2.0 * M_PI / RADIUS_SEGMENTS );
110-
QgsPointXY radiusPoint( mRadiusCenter.x() + r * cos( theta ),
110+
QgsPointXY radiusPoint( mRadiusCenter.x() + r * std::cos( theta ),
111111
mRadiusCenter.y() + r * sin( theta ) );
112112
mRubberBand->addPoint( radiusPoint, false );
113113
}

src/app/qgspointrotationitem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void QgsPointRotationItem::paint( QPainter *painter )
5656
{
5757
h = sqrt( ( double ) mPixmap.width() * mPixmap.width() + mPixmap.height() * mPixmap.height() ) / 2; //the half of the item diagonal
5858
dAngel = acos( mPixmap.width() / ( h * 2 ) ) * 180 / M_PI; //the diagonal angel of the original rect
59-
x = h * cos( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 );
59+
x = h * std::cos( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 );
6060
y = h * sin( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 );
6161
}
6262

src/app/qgsrastercalcdialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ void QgsRasterCalcDialog::on_mSqrtButton_clicked()
355355

356356
void QgsRasterCalcDialog::on_mCosButton_clicked()
357357
{
358-
mExpressionTextEdit->insertPlainText( QStringLiteral( " cos ( " ) );
358+
mExpressionTextEdit->insertPlainText( QStringLiteral( " std::cos ( " ) );
359359
}
360360

361361
void QgsRasterCalcDialog::on_mSinButton_clicked()

src/core/composer/qgscomposerarrow.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ void QgsComposerArrow::drawSVGMarker( QPainter *p, MarkerType type, const QStrin
280280
}
281281
QPointF rotatedFixPoint;
282282
double angleRad = angle / 180 * M_PI;
283-
rotatedFixPoint.setX( fixPoint.x() * cos( angleRad ) + fixPoint.y() * -sin( angleRad ) );
284-
rotatedFixPoint.setY( fixPoint.x() * sin( angleRad ) + fixPoint.y() * cos( angleRad ) );
283+
rotatedFixPoint.setX( fixPoint.x() * std::cos( angleRad ) + fixPoint.y() * -sin( angleRad ) );
284+
rotatedFixPoint.setY( fixPoint.x() * sin( angleRad ) + fixPoint.y() * std::cos( angleRad ) );
285285
p->translate( canvasPoint.x() - rotatedFixPoint.x(), canvasPoint.y() - rotatedFixPoint.y() );
286286
}
287287
else

src/core/composer/qgscomposerutils.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ void QgsComposerUtils::drawArrowHead( QPainter *p, const double x, const double
4242
QPointF p2 = QPointF( arrowHeadWidth / 2.0, arrowHeadWidth );
4343

4444
QPointF p1Rotated, p2Rotated;
45-
p1Rotated.setX( p1.x() * cos( angleRad ) + p1.y() * -sin( angleRad ) );
46-
p1Rotated.setY( p1.x() * sin( angleRad ) + p1.y() * cos( angleRad ) );
47-
p2Rotated.setX( p2.x() * cos( angleRad ) + p2.y() * -sin( angleRad ) );
48-
p2Rotated.setY( p2.x() * sin( angleRad ) + p2.y() * cos( angleRad ) );
45+
p1Rotated.setX( p1.x() * std::cos( angleRad ) + p1.y() * -sin( angleRad ) );
46+
p1Rotated.setY( p1.x() * sin( angleRad ) + p1.y() * std::cos( angleRad ) );
47+
p2Rotated.setX( p2.x() * std::cos( angleRad ) + p2.y() * -sin( angleRad ) );
48+
p2Rotated.setY( p2.x() * sin( angleRad ) + p2.y() * std::cos( angleRad ) );
4949

5050
QPolygonF arrowHeadPoly;
5151
arrowHeadPoly << middlePoint;
@@ -88,8 +88,8 @@ void QgsComposerUtils::rotate( const double angle, double &x, double &y )
8888
{
8989
double rotToRad = angle * M_PI / 180.0;
9090
double xRot, yRot;
91-
xRot = x * cos( rotToRad ) - y * sin( rotToRad );
92-
yRot = x * sin( rotToRad ) + y * cos( rotToRad );
91+
xRot = x * std::cos( rotToRad ) - y * sin( rotToRad );
92+
yRot = x * sin( rotToRad ) + y * std::cos( rotToRad );
9393
x = xRot;
9494
y = yRot;
9595
}
@@ -185,7 +185,7 @@ QRectF QgsComposerUtils::largestRotatedRectWithinBounds( const QRectF &originalR
185185

186186
//convert angle to radians and flip
187187
double angleRad = -clippedRotation * M_DEG2RAD;
188-
double cosAngle = cos( angleRad );
188+
double cosAngle = std::cos( angleRad );
189189
double sinAngle = sin( angleRad );
190190

191191
//calculate size of bounds of rotated rectangle

src/core/composer/qgscomposition.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -3012,7 +3012,7 @@ double *QgsComposition::computeGeoTransform( const QgsComposerMap *map, const QR
30123012
double mapYCenter = mapExtent.center().y();
30133013
double alpha = - map->mapRotation() / 180 * M_PI;
30143014
double sinAlpha = sin( alpha );
3015-
double cosAlpha = cos( alpha );
3015+
double cosAlpha = std::cos( alpha );
30163016

30173017
// get the extent (in map units) for the exported region
30183018
QPointF mapItemPos = map->pos();
@@ -3151,12 +3151,12 @@ void QgsComposition::computeWorldFileParameters( const QRectF &exportRegion, dou
31513151

31523152
// rotation matrix
31533153
double r[6];
3154-
r[0] = cos( alpha );
3154+
r[0] = std::cos( alpha );
31553155
r[1] = -sin( alpha );
3156-
r[2] = xCenter * ( 1 - cos( alpha ) ) + yCenter * sin( alpha );
3156+
r[2] = xCenter * ( 1 - std::cos( alpha ) ) + yCenter * sin( alpha );
31573157
r[3] = sin( alpha );
3158-
r[4] = cos( alpha );
3159-
r[5] = - xCenter * sin( alpha ) + yCenter * ( 1 - cos( alpha ) );
3158+
r[4] = std::cos( alpha );
3159+
r[5] = - xCenter * sin( alpha ) + yCenter * ( 1 - std::cos( alpha ) );
31603160

31613161
// result = rotation x scaling = rotation(scaling(X))
31623162
a = r[0] * s[0] + r[1] * s[3];

src/core/effects/qgsshadoweffect.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void QgsShadowEffect::draw( QgsRenderContext &context )
5656
double offsetDist = context.convertToPainterUnits( mOffsetDist, mOffsetUnit, mOffsetMapUnitScale );
5757

5858
double angleRad = mOffsetAngle * M_PI / 180; // to radians
59-
QPointF transPt( -offsetDist * cos( angleRad + M_PI / 2 ),
59+
QPointF transPt( -offsetDist * std::cos( angleRad + M_PI / 2 ),
6060
-offsetDist * sin( angleRad + M_PI / 2 ) );
6161

6262
//transparency, scale

src/core/expression/qgsexpressionfunction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static QVariant fcnSin( const QVariantList &values, const QgsExpressionContext *
262262
static QVariant fcnCos( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
263263
{
264264
double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
265-
return QVariant( cos( x ) );
265+
return QVariant( std::cos( x ) );
266266
}
267267
static QVariant fcnTan( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
268268
{

src/core/geometry/qgsellipse.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ QgsPointSequence QgsEllipse::points( unsigned int segments ) const
208208
for ( QVector<double>::const_iterator it = t.constBegin(); it != t.constEnd(); ++it )
209209
{
210210
double x = mCenter.x() +
211-
mSemiMajorAxis * cos( *it ) * cos( azimuth ) -
211+
mSemiMajorAxis * std::cos( *it ) * std::cos( azimuth ) -
212212
mSemiMinorAxis * sin( *it ) * sin( azimuth );
213213
double y = mCenter.y() +
214-
mSemiMajorAxis * cos( *it ) * sin( azimuth ) +
215-
mSemiMinorAxis * sin( *it ) * cos( azimuth );
214+
mSemiMajorAxis * std::cos( *it ) * sin( azimuth ) +
215+
mSemiMinorAxis * sin( *it ) * std::cos( azimuth );
216216
pts.push_back( QgsPoint( pType, x, y, z, m ) );
217217
}
218218

@@ -257,10 +257,10 @@ QgsRectangle QgsEllipse::boundingBox() const
257257

258258
double angle = mAzimuth * M_PI / 180.0;
259259

260-
double ux = mSemiMajorAxis * cos( angle );
260+
double ux = mSemiMajorAxis * std::cos( angle );
261261
double uy = mSemiMinorAxis * sin( angle );
262262
double vx = mSemiMajorAxis * sin( angle );
263-
double vy = mSemiMinorAxis * cos( angle );
263+
double vy = mSemiMinorAxis * std::cos( angle );
264264

265265
double halfHeight = sqrt( ux * ux + uy * uy );
266266
double halfWidth = sqrt( vx * vx + vy * vy );

src/core/geometry/qgsgeometryutils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ void QgsGeometryUtils::segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, co
703703
addP2 = false;
704704
}
705705

706-
x = centerX + radius * cos( angle );
706+
x = centerX + radius * std::cos( angle );
707707
y = centerY + radius * sin( angle );
708708

709709
if ( !hasZ && !hasM )

src/core/geometry/qgsinternalgeometryengine.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ QgsGeometry QgsInternalGeometryEngine::orthogonalize( double tolerance, int maxI
491491
return QgsGeometry();
492492
}
493493

494-
double lowerThreshold = cos( ( 90 - angleThreshold ) * M_PI / 180.00 );
495-
double upperThreshold = cos( angleThreshold * M_PI / 180.0 );
494+
double lowerThreshold = std::cos( ( 90 - angleThreshold ) * M_PI / 180.00 );
495+
double upperThreshold = std::cos( angleThreshold * M_PI / 180.0 );
496496

497497
if ( const QgsGeometryCollection *gc = qgsgeometry_cast< const QgsGeometryCollection *>( mGeometry ) )
498498
{

src/core/geometry/qgspoint.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,14 @@ QgsPoint QgsPoint::project( double distance, double azimuth, double inclination
567567
if ( !is3D() && qgsDoubleNear( inclination, 90.0 ) )
568568
{
569569
dx = distance * sin( radsXy );
570-
dy = distance * cos( radsXy );
570+
dy = distance * std::cos( radsXy );
571571
}
572572
else
573573
{
574574
double radsZ = inclination * M_PI / 180.0;
575575
dx = distance * sin( radsZ ) * sin( radsXy );
576-
dy = distance * sin( radsZ ) * cos( radsXy );
577-
dz = distance * cos( radsZ );
576+
dy = distance * sin( radsZ ) * std::cos( radsXy );
577+
dz = distance * std::cos( radsZ );
578578
}
579579

580580
return QgsPoint( mX + dx, mY + dy, mZ + dz, mM, pType );

src/core/geometry/qgsregularpolygon.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ QgsRegularPolygon::QgsRegularPolygon( const QgsPoint &pt1, const QgsPoint &pt2,
113113
double length = pt1.distance( pm );
114114

115115
double angle = ( 180 - ( 360 / numSides ) ) / 2.0;
116-
double hypothenuse = length / cos( angle * M_PI / 180 );
116+
double hypothenuse = length / std::cos( angle * M_PI / 180 );
117117
// TODO: inclination
118118

119119
mCenter = pt1.project( hypothenuse, azimuth + angle );
@@ -327,7 +327,7 @@ double QgsRegularPolygon::length() const
327327

328328
double QgsRegularPolygon::apothemToRadius( const double apothem, const unsigned int numSides ) const
329329
{
330-
return apothem / cos( M_PI / numSides );
330+
return apothem / std::cos( M_PI / numSides );
331331
}
332332

333333
double QgsRegularPolygon::interiorAngle( const unsigned int nbSides ) const

src/core/geometry/qgsregularpolygon.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class CORE_EXPORT QgsRegularPolygon
104104
* The apothem is the radius of the inscribed circle.
105105
* \see radius()
106106
*/
107-
double apothem() const { return mRadius * cos( M_PI / mNumberSides ); }
107+
double apothem() const { return mRadius * std::cos( M_PI / mNumberSides ); }
108108

109109
/** Returns the number of sides of the regular polygon.
110110
* \see setNumberSides()

0 commit comments

Comments
 (0)