Skip to content

Commit

Permalink
Swap q(pow) -> std::pow
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 24, 2017
1 parent 77c3be9 commit 031bf41
Show file tree
Hide file tree
Showing 50 changed files with 112 additions and 112 deletions.
2 changes: 1 addition & 1 deletion src/analysis/interpolation/CloughTocherInterpolator.cc
Expand Up @@ -64,7 +64,7 @@ double CloughTocherInterpolator::calcBernsteinPoly( int n, int i, int j, int k,
return 0; return 0;
} }


double result = MathUtils::faculty( n ) * qPow( u, i ) * qPow( v, j ) * qPow( w, k ) / ( MathUtils::faculty( i ) * MathUtils::faculty( j ) * MathUtils::faculty( k ) ); double result = MathUtils::faculty( n ) * std::pow( u, i ) * std::pow( v, j ) * std::pow( w, k ) / ( MathUtils::faculty( i ) * MathUtils::faculty( j ) * MathUtils::faculty( k ) );
return result; return result;
} }


Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/MathUtils.cc
Expand Up @@ -107,7 +107,7 @@ double MathUtils::calcBernsteinPoly( int n, int i, double t )
return 0; return 0;
} }


return lower( n, i ) * qPow( t, i ) * qPow( ( 1 - t ), ( n - i ) ); return lower( n, i ) * std::pow( t, i ) * std::pow( ( 1 - t ), ( n - i ) );
} }


double MathUtils::cFDerBernsteinPoly( int n, int i, double t ) double MathUtils::cFDerBernsteinPoly( int n, int i, double t )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/interpolation/qgsidwinterpolator.cpp
Expand Up @@ -50,7 +50,7 @@ int QgsIDWInterpolator::interpolatePoint( double x, double y, double &result )
result = vertex_it.z; result = vertex_it.z;
return 0; return 0;
} }
currentWeight = 1 / ( pow( distance, mDistanceCoefficient ) ); currentWeight = 1 / ( std::pow( distance, mDistanceCoefficient ) );
sumCounter += ( currentWeight * vertex_it.z ); sumCounter += ( currentWeight * vertex_it.z );
sumDenominator += currentWeight; sumDenominator += currentWeight;
} }
Expand Down
22 changes: 11 additions & 11 deletions src/analysis/raster/qgskde.cpp
Expand Up @@ -181,7 +181,7 @@ QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::addFeature( const
double pixelCentroidX = ( xPosition + xp + 0.5 ) * mPixelSize + mBounds.xMinimum(); double pixelCentroidX = ( xPosition + xp + 0.5 ) * mPixelSize + mBounds.xMinimum();
double pixelCentroidY = ( yPosition + yp + 0.5 ) * mPixelSize + mBounds.yMinimum(); double pixelCentroidY = ( yPosition + yp + 0.5 ) * mPixelSize + mBounds.yMinimum();


double distance = sqrt( pow( pixelCentroidX - ( *pointIt ).x(), 2.0 ) + pow( pixelCentroidY - ( *pointIt ).y(), 2.0 ) ); double distance = sqrt( std::pow( pixelCentroidX - ( *pointIt ).x(), 2.0 ) + std::pow( pixelCentroidY - ( *pointIt ).y(), 2.0 ) );


// is pixel outside search bandwidth of feature? // is pixel outside search bandwidth of feature?
if ( distance > radius ) if ( distance > radius )
Expand Down Expand Up @@ -324,13 +324,13 @@ double QgsKernelDensityEstimation::quarticKernel( const double distance, const d
case OutputScaled: case OutputScaled:
{ {
// Normalizing constant // Normalizing constant
double k = 116. / ( 5. * M_PI * pow( bandwidth, 2 ) ); double k = 116. / ( 5. * M_PI * std::pow( bandwidth, 2 ) );


// Derived from Wand and Jones (1995), p. 175 // Derived from Wand and Jones (1995), p. 175
return k * ( 15. / 16. ) * pow( 1. - pow( distance / bandwidth, 2 ), 2 ); return k * ( 15. / 16. ) * std::pow( 1. - std::pow( distance / bandwidth, 2 ), 2 );
} }
case OutputRaw: case OutputRaw:
return pow( 1. - pow( distance / bandwidth, 2 ), 2 ); return pow( 1. - std::pow( distance / bandwidth, 2 ), 2 );
} }
return 0.0; //no, seriously, I told you NO WARNINGS! return 0.0; //no, seriously, I told you NO WARNINGS!
} }
Expand All @@ -342,13 +342,13 @@ double QgsKernelDensityEstimation::triweightKernel( const double distance, const
case OutputScaled: case OutputScaled:
{ {
// Normalizing constant // Normalizing constant
double k = 128. / ( 35. * M_PI * pow( bandwidth, 2 ) ); double k = 128. / ( 35. * M_PI * std::pow( bandwidth, 2 ) );


// Derived from Wand and Jones (1995), p. 175 // Derived from Wand and Jones (1995), p. 175
return k * ( 35. / 32. ) * pow( 1. - pow( distance / bandwidth, 2 ), 3 ); return k * ( 35. / 32. ) * std::pow( 1. - std::pow( distance / bandwidth, 2 ), 3 );
} }
case OutputRaw: case OutputRaw:
return pow( 1. - pow( distance / bandwidth, 2 ), 3 ); return pow( 1. - std::pow( distance / bandwidth, 2 ), 3 );
} }
return 0.0; // this is getting ridiculous... don't you ever listen to a word I say? return 0.0; // this is getting ridiculous... don't you ever listen to a word I say?
} }
Expand All @@ -360,13 +360,13 @@ double QgsKernelDensityEstimation::epanechnikovKernel( const double distance, co
case OutputScaled: case OutputScaled:
{ {
// Normalizing constant // Normalizing constant
double k = 8. / ( 3. * M_PI * pow( bandwidth, 2 ) ); double k = 8. / ( 3. * M_PI * std::pow( bandwidth, 2 ) );


// Derived from Wand and Jones (1995), p. 175 // Derived from Wand and Jones (1995), p. 175
return k * ( 3. / 4. ) * ( 1. - pow( distance / bandwidth, 2 ) ); return k * ( 3. / 4. ) * ( 1. - std::pow( distance / bandwidth, 2 ) );
} }
case OutputRaw: case OutputRaw:
return ( 1. - pow( distance / bandwidth, 2 ) ); return ( 1. - std::pow( distance / bandwidth, 2 ) );
} }


return 0.0; // la la la i'm not listening return 0.0; // la la la i'm not listening
Expand All @@ -383,7 +383,7 @@ double QgsKernelDensityEstimation::triangularKernel( const double distance, cons


if ( mDecay >= 0 ) if ( mDecay >= 0 )
{ {
double k = 3. / ( ( 1. + 2. * mDecay ) * M_PI * pow( bandwidth, 2 ) ); double k = 3. / ( ( 1. + 2. * mDecay ) * M_PI * std::pow( bandwidth, 2 ) );


// Derived from Wand and Jones (1995), p. 175 (with addition of decay parameter) // Derived from Wand and Jones (1995), p. 175 (with addition of decay parameter)
return k * ( 1. - ( 1. - mDecay ) * ( distance / bandwidth ) ); return k * ( 1. - ( 1. - mDecay ) * ( distance / bandwidth ) );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsrastermatrix.cpp
Expand Up @@ -292,7 +292,7 @@ double QgsRasterMatrix::calculateTwoArgumentOp( TwoArgOperator op, double arg1,
} }
else else
{ {
return qPow( arg1, arg2 ); return pow( arg1, arg2 );
} }
case opEQ: case opEQ:
return ( arg1 == arg2 ? 1.0 : 0.0 ); return ( arg1 == arg2 ? 1.0 : 0.0 );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/vector/qgszonalstatistics.cpp
Expand Up @@ -309,7 +309,7 @@ int QgsZonalStatistics::calculateStatistics( QgsFeedback *feedback )
double variance = sumSquared / featureStats.values.count(); double variance = sumSquared / featureStats.values.count();
if ( mStatistics & QgsZonalStatistics::StDev ) if ( mStatistics & QgsZonalStatistics::StDev )
{ {
double stdev = qPow( variance, 0.5 ); double stdev = std::pow( variance, 0.5 );
changeAttributeMap.insert( stdevIndex, QVariant( stdev ) ); changeAttributeMap.insert( stdevIndex, QVariant( stdev ) );
} }
if ( mStatistics & QgsZonalStatistics::Variance ) if ( mStatistics & QgsZonalStatistics::Variance )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationgrid.cpp
Expand Up @@ -787,7 +787,7 @@ bool QgsDecorationGrid::getIntervalFromExtent( double *values, bool useXAxis )
if ( !qgsDoubleNear( interval, 0.0 ) ) if ( !qgsDoubleNear( interval, 0.0 ) )
{ {
double interval2 = 0; double interval2 = 0;
int factor = pow( 10, floor( log10( interval ) ) ); int factor = std::pow( 10, floor( log10( interval ) ) );
if ( factor != 0 ) if ( factor != 0 )
{ {
interval2 = std::round( interval / factor ) * factor; interval2 = std::round( interval / factor ) * factor;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationscalebar.cpp
Expand Up @@ -163,7 +163,7 @@ void QgsDecorationScaleBar::render( const QgsMapSettings &mapSettings, QgsRender
// snap to integer < 10 times power of 10 // snap to integer < 10 times power of 10
if ( mSnapping ) if ( mSnapping )
{ {
double scaler = pow( 10.0, myPowerOf10 ); double scaler = std::pow( 10.0, myPowerOf10 );
myActualSize = std::round( myActualSize / scaler ) * scaler; myActualSize = std::round( myActualSize / scaler ) * scaler;
myScaleBarWidth = myActualSize / myMapUnitsPerPixelDouble; myScaleBarWidth = myActualSize / myMapUnitsPerPixelDouble;
} }
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposermapgrid.cpp
Expand Up @@ -1445,7 +1445,7 @@ QString QgsComposerMapGrid::gridAnnotationString( double value, QgsComposerMapGr
{ {
QString hemisphere; QString hemisphere;


double coordRounded = std::round( value * pow( 10.0, mGridAnnotationPrecision ) ) / pow( 10.0, mGridAnnotationPrecision ); double coordRounded = std::round( value * std::pow( 10.0, mGridAnnotationPrecision ) ) / std::pow( 10.0, mGridAnnotationPrecision );
if ( coord == QgsComposerMapGrid::Longitude ) if ( coord == QgsComposerMapGrid::Longitude )
{ {
//don't use E/W suffixes if ambiguous (e.g., 180 degrees) //don't use E/W suffixes if ambiguous (e.g., 180 degrees)
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposernodesitem.cpp
Expand Up @@ -50,7 +50,7 @@ QgsComposerNodesItem::QgsComposerNodesItem( const QString &tagName,
double QgsComposerNodesItem::computeDistance( QPointF pt1, double QgsComposerNodesItem::computeDistance( QPointF pt1,
QPointF pt2 ) const QPointF pt2 ) const
{ {
return sqrt( pow( pt1.x() - pt2.x(), 2 ) + pow( pt1.y() - pt2.y(), 2 ) ); return sqrt( std::pow( pt1.x() - pt2.x(), 2 ) + std::pow( pt1.y() - pt2.y(), 2 ) );
} }


bool QgsComposerNodesItem::addNode( QPointF pt, bool QgsComposerNodesItem::addNode( QPointF pt,
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgscomposerscalebar.cpp
Expand Up @@ -262,14 +262,14 @@ void QgsComposerScaleBar::refreshDataDefinedProperty( const QgsComposerObject::D
// nextNiceNumber(4573.23, d) = 5000 (d=1) -> 4600 (d=10) -> 4580 (d=100) -> 4574 (d=1000) -> etc // nextNiceNumber(4573.23, d) = 5000 (d=1) -> 4600 (d=10) -> 4580 (d=100) -> 4574 (d=1000) -> etc
inline double nextNiceNumber( double a, double d = 1 ) inline double nextNiceNumber( double a, double d = 1 )
{ {
double s = qPow( 10.0, floor( log10( a ) ) ) / d; double s = std::pow( 10.0, floor( log10( a ) ) ) / d;
return ceil( a / s ) * s; return ceil( a / s ) * s;
} }


// prevNiceNumber(4573.23, d) = 4000 (d=1) -> 4500 (d=10) -> 4570 (d=100) -> 4573 (d=1000) -> etc // prevNiceNumber(4573.23, d) = 4000 (d=1) -> 4500 (d=10) -> 4570 (d=100) -> 4573 (d=1000) -> etc
inline double prevNiceNumber( double a, double d = 1 ) inline double prevNiceNumber( double a, double d = 1 )
{ {
double s = qPow( 10.0, floor( log10( a ) ) ) / d; double s = std::pow( 10.0, floor( log10( a ) ) ) / d;
return floor( a / s ) * s; return floor( a / s ) * s;
} }


Expand Down Expand Up @@ -474,7 +474,7 @@ void QgsComposerScaleBar::applyDefaultSize( QgsUnitTypes::DistanceUnit u )


double segmentWidth = initialUnitsPerSegment / upperMagnitudeMultiplier; double segmentWidth = initialUnitsPerSegment / upperMagnitudeMultiplier;
int segmentMagnitude = floor( log10( segmentWidth ) ); int segmentMagnitude = floor( log10( segmentWidth ) );
double unitsPerSegment = upperMagnitudeMultiplier * ( qPow( 10.0, segmentMagnitude ) ); double unitsPerSegment = upperMagnitudeMultiplier * ( std::pow( 10.0, segmentMagnitude ) );
double multiplier = floor( ( widthInSelectedUnits / ( unitsPerSegment * 10.0 ) ) / 2.5 ) * 2.5; double multiplier = floor( ( widthInSelectedUnits / ( unitsPerSegment * 10.0 ) ) / 2.5 ) * 2.5;


if ( multiplier > 0 ) if ( multiplier > 0 )
Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgsimageoperation.cpp
Expand Up @@ -290,7 +290,7 @@ void QgsImageOperation::HueSaturationPixelOperation::operator()( QRgb &rgb, cons
{ {
// Raising the saturation. Use a saturation curve to prevent // Raising the saturation. Use a saturation curve to prevent
// clipping at maximum saturation with ugly results. // clipping at maximum saturation with ugly results.
s = qMin( static_cast< int >( 255. * ( 1 - qPow( 1 - ( s / 255. ), qPow( mSaturation, 2 ) ) ) ), 255 ); s = qMin( static_cast< int >( 255. * ( 1 - std::pow( 1 - ( s / 255. ), std::pow( mSaturation, 2 ) ) ) ), 255 );
} }


if ( mColorize ) if ( mColorize )
Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgsimageoperation.h
Expand Up @@ -375,7 +375,7 @@ class CORE_EXPORT QgsImageOperation
, mSpread( spread ) , mSpread( spread )
, mProperties( properties ) , mProperties( properties )
{ {
mSpreadSquared = qPow( mSpread, 2.0 ); mSpreadSquared = std::pow( mSpread, 2.0 );
} }


void operator()( QRgb &rgb, const int x, const int y ); void operator()( QRgb &rgb, const int x, const int y );
Expand Down
4 changes: 2 additions & 2 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -402,7 +402,7 @@ static QVariant fcnExpScale( const QVariantList &values, const QgsExpressionCont
} }


// Return exponentially scaled value // Return exponentially scaled value
return QVariant( ( ( rangeMax - rangeMin ) / pow( domainMax - domainMin, exponent ) ) * pow( val - domainMin, exponent ) + rangeMin ); return QVariant( ( ( rangeMax - rangeMin ) / std::pow( domainMax - domainMin, exponent ) ) * std::pow( val - domainMin, exponent ) + rangeMin );
} }


static QVariant fcnMax( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) static QVariant fcnMax( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
Expand Down Expand Up @@ -2883,7 +2883,7 @@ static QVariant fcnRound( const QVariantList &values, const QgsExpressionContext
if ( values.length() == 2 && values.at( 1 ).toInt() != 0 ) if ( values.length() == 2 && values.at( 1 ).toInt() != 0 )
{ {
double number = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); double number = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
double scaler = pow( 10.0, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) ); double scaler = std::pow( 10.0, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
return QVariant( std::round( number * scaler ) / scaler ); return QVariant( std::round( number * scaler ) / scaler );
} }


Expand Down
2 changes: 1 addition & 1 deletion src/core/expression/qgsexpressionnodeimpl.cpp
Expand Up @@ -279,7 +279,7 @@ QVariant QgsExpressionNodeBinaryOperator::evalNode( QgsExpression *parent, const
ENSURE_NO_EVAL_ERROR; ENSURE_NO_EVAL_ERROR;
double fR = QgsExpressionUtils::getDoubleValue( vR, parent ); double fR = QgsExpressionUtils::getDoubleValue( vR, parent );
ENSURE_NO_EVAL_ERROR; ENSURE_NO_EVAL_ERROR;
return QVariant( pow( fL, fR ) ); return QVariant( std::pow( fL, fR ) );
} }


case boAnd: case boAnd:
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsellipse.cpp
Expand Up @@ -64,7 +64,7 @@ QgsEllipse QgsEllipse::fromFoci( const QgsPoint &pt1, const QgsPoint &pt2, const
QgsPoint center = QgsGeometryUtils::midpoint( pt1, pt2 ); QgsPoint center = QgsGeometryUtils::midpoint( pt1, pt2 );


double axis_a = dist / 2.0; double axis_a = dist / 2.0;
double axis_b = sqrt( pow( axis_a, 2.0 ) - pow( dist_p1p2 / 2.0, 2.0 ) ); double axis_b = sqrt( std::pow( axis_a, 2.0 ) - std::pow( dist_p1p2 / 2.0, 2.0 ) );


return QgsEllipse( center, axis_a, axis_b, azimuth ); return QgsEllipse( center, axis_a, axis_b, azimuth );
} }
Expand Down
8 changes: 4 additions & 4 deletions src/core/geometry/qgsgeometryutils.cpp
Expand Up @@ -451,7 +451,7 @@ void QgsGeometryUtils::circleCenterRadius( const QgsPoint &pt1, const QgsPoint &
{ {
centerX = ( pt1.x() + pt2.x() ) / 2.0; centerX = ( pt1.x() + pt2.x() ) / 2.0;
centerY = ( pt1.y() + pt2.y() ) / 2.0; centerY = ( pt1.y() + pt2.y() ) / 2.0;
radius = sqrt( pow( centerX - pt1.x(), 2.0 ) + pow( centerY - pt1.y(), 2.0 ) ); radius = sqrt( std::pow( centerX - pt1.x(), 2.0 ) + std::pow( centerY - pt1.y(), 2.0 ) );
return; return;
} }


Expand All @@ -461,8 +461,8 @@ void QgsGeometryUtils::circleCenterRadius( const QgsPoint &pt1, const QgsPoint &
dx31 = pt3.x() - pt1.x(); dx31 = pt3.x() - pt1.x();
dy31 = pt3.y() - pt1.y(); dy31 = pt3.y() - pt1.y();


h21 = pow( dx21, 2.0 ) + pow( dy21, 2.0 ); h21 = std::pow( dx21, 2.0 ) + std::pow( dy21, 2.0 );
h31 = pow( dx31, 2.0 ) + pow( dy31, 2.0 ); h31 = std::pow( dx31, 2.0 ) + std::pow( dy31, 2.0 );


// 2*Cross product, d<0 means clockwise and d>0 counterclockwise sweeping angle // 2*Cross product, d<0 means clockwise and d>0 counterclockwise sweeping angle
d = 2 * ( dx21 * dy31 - dx31 * dy21 ); d = 2 * ( dx21 * dy31 - dx31 * dy21 );
Expand All @@ -477,7 +477,7 @@ void QgsGeometryUtils::circleCenterRadius( const QgsPoint &pt1, const QgsPoint &
// Calculate centroid coordinates and radius // Calculate centroid coordinates and radius
centerX = pt1.x() + ( h21 * dy31 - h31 * dy21 ) / d; centerX = pt1.x() + ( h21 * dy31 - h31 * dy21 ) / d;
centerY = pt1.y() - ( h21 * dx31 - h31 * dx21 ) / d; centerY = pt1.y() - ( h21 * dx31 - h31 * dx21 ) / d;
radius = sqrt( pow( centerX - pt1.x(), 2.0 ) + pow( centerY - pt1.y(), 2.0 ) ); radius = sqrt( std::pow( centerX - pt1.x(), 2.0 ) + std::pow( centerY - pt1.y(), 2.0 ) );
} }


bool QgsGeometryUtils::circleClockwise( double angle1, double angle2, double angle3 ) bool QgsGeometryUtils::circleClockwise( double angle1, double angle2, double angle3 )
Expand Down
4 changes: 2 additions & 2 deletions src/core/geometry/qgsgeos.cpp
Expand Up @@ -2635,7 +2635,7 @@ int QgsGeos::lineContainedInLine( const GEOSGeometry *line1, const GEOSGeometry
return -1; return -1;
} }


double bufferDistance = pow( 10.0L, geomDigits( line2 ) - 11 ); double bufferDistance = std::pow( 10.0L, geomDigits( line2 ) - 11 );


GEOSGeometry *bufferGeom = GEOSBuffer_r( geosinit.ctxt, line2, bufferDistance, DEFAULT_QUADRANT_SEGMENTS ); GEOSGeometry *bufferGeom = GEOSBuffer_r( geosinit.ctxt, line2, bufferDistance, DEFAULT_QUADRANT_SEGMENTS );
if ( !bufferGeom ) if ( !bufferGeom )
Expand Down Expand Up @@ -2665,7 +2665,7 @@ int QgsGeos::pointContainedInLine( const GEOSGeometry *point, const GEOSGeometry
if ( !point || !line ) if ( !point || !line )
return -1; return -1;


double bufferDistance = pow( 10.0L, geomDigits( line ) - 11 ); double bufferDistance = std::pow( 10.0L, geomDigits( line ) - 11 );


GEOSGeometry *lineBuffer = GEOSBuffer_r( geosinit.ctxt, line, bufferDistance, 8 ); GEOSGeometry *lineBuffer = GEOSBuffer_r( geosinit.ctxt, line, bufferDistance, 8 );
if ( !lineBuffer ) if ( !lineBuffer )
Expand Down
12 changes: 6 additions & 6 deletions src/core/geometry/qgslinestring.cpp
Expand Up @@ -679,8 +679,8 @@ void QgsLineString::extend( double startDistance, double endDistance )
// start of line // start of line
if ( startDistance > 0 ) if ( startDistance > 0 )
{ {
double currentLen = sqrt( qPow( mX.at( 0 ) - mX.at( 1 ), 2 ) + double currentLen = sqrt( std::pow( mX.at( 0 ) - mX.at( 1 ), 2 ) +
qPow( mY.at( 0 ) - mY.at( 1 ), 2 ) ); std::pow( mY.at( 0 ) - mY.at( 1 ), 2 ) );
double newLen = currentLen + startDistance; double newLen = currentLen + startDistance;
mX[ 0 ] = mX.at( 1 ) + ( mX.at( 0 ) - mX.at( 1 ) ) / currentLen * newLen; mX[ 0 ] = mX.at( 1 ) + ( mX.at( 0 ) - mX.at( 1 ) ) / currentLen * newLen;
mY[ 0 ] = mY.at( 1 ) + ( mY.at( 0 ) - mY.at( 1 ) ) / currentLen * newLen; mY[ 0 ] = mY.at( 1 ) + ( mY.at( 0 ) - mY.at( 1 ) ) / currentLen * newLen;
Expand All @@ -689,8 +689,8 @@ void QgsLineString::extend( double startDistance, double endDistance )
if ( endDistance > 0 ) if ( endDistance > 0 )
{ {
int last = mX.size() - 1; int last = mX.size() - 1;
double currentLen = sqrt( qPow( mX.at( last ) - mX.at( last - 1 ), 2 ) + double currentLen = sqrt( std::pow( mX.at( last ) - mX.at( last - 1 ), 2 ) +
qPow( mY.at( last ) - mY.at( last - 1 ), 2 ) ); std::pow( mY.at( last ) - mY.at( last - 1 ), 2 ) );
double newLen = currentLen + endDistance; double newLen = currentLen + endDistance;
mX[ last ] = mX.at( last - 1 ) + ( mX.at( last ) - mX.at( last - 1 ) ) / currentLen * newLen; mX[ last ] = mX.at( last - 1 ) + ( mX.at( last ) - mX.at( last - 1 ) ) / currentLen * newLen;
mY[ last ] = mY.at( last - 1 ) + ( mY.at( last ) - mY.at( last - 1 ) ) / currentLen * newLen; mY[ last ] = mY.at( last - 1 ) + ( mY.at( last ) - mY.at( last - 1 ) ) / currentLen * newLen;
Expand Down Expand Up @@ -916,8 +916,8 @@ QgsPoint QgsLineString::centroid() const
{ {
double currentX = mX.at( i ); double currentX = mX.at( i );
double currentY = mY.at( i ); double currentY = mY.at( i );
double segmentLength = sqrt( qPow( currentX - prevX, 2.0 ) + double segmentLength = sqrt( std::pow( currentX - prevX, 2.0 ) +
qPow( currentY - prevY, 2.0 ) ); std::pow( currentY - prevY, 2.0 ) );
if ( qgsDoubleNear( segmentLength, 0.0 ) ) if ( qgsDoubleNear( segmentLength, 0.0 ) )
continue; continue;


Expand Down
6 changes: 3 additions & 3 deletions src/core/pal/feature.cpp
Expand Up @@ -1161,7 +1161,7 @@ int FeaturePart::createCurvedCandidatesAlongLine( QList< LabelPosition * > &lPos
if ( i == 0 ) if ( i == 0 )
path_distances[i] = 0; path_distances[i] = 0;
else else
path_distances[i] = sqrt( pow( old_x - mapShape->x[i], 2 ) + pow( old_y - mapShape->y[i], 2 ) ); path_distances[i] = sqrt( std::pow( old_x - mapShape->x[i], 2 ) + std::pow( old_y - mapShape->y[i], 2 ) );
old_x = mapShape->x[i]; old_x = mapShape->x[i];
old_y = mapShape->y[i]; old_y = mapShape->y[i];


Expand Down Expand Up @@ -1808,13 +1808,13 @@ bool FeaturePart::nextCharPosition( double charWidth, double segment_length, Poi
dx = new_x - old_x; dx = new_x - old_x;
dy = new_y - old_y; dy = new_y - old_y;
} }
while ( sqrt( pow( start_x - new_x, 2 ) + pow( start_y - new_y, 2 ) ) < charWidth ); // Distance from start_ to new_ while ( sqrt( std::pow( start_x - new_x, 2 ) + std::pow( start_y - new_y, 2 ) ) < charWidth ); // Distance from start_ to new_


// Calculate the position to place the end of the character on // Calculate the position to place the end of the character on
GeomFunction::findLineCircleIntersection( start_x, start_y, charWidth, old_x, old_y, new_x, new_y, end_x, end_y ); GeomFunction::findLineCircleIntersection( start_x, start_y, charWidth, old_x, old_y, new_x, new_y, end_x, end_y );


// Need to calculate distance on the new segment // Need to calculate distance on the new segment
distance = sqrt( pow( old_x - end_x, 2 ) + pow( old_y - end_y, 2 ) ); distance = sqrt( std::pow( old_x - end_x, 2 ) + std::pow( old_y - end_y, 2 ) );
} }
return true; return true;
} }
2 changes: 1 addition & 1 deletion src/core/pal/pal.cpp
Expand Up @@ -356,7 +356,7 @@ Problem *Pal::extract( double lambda_min, double phi_min, double lambda_max, dou
feat = fFeats->takeFirst(); feat = fFeats->takeFirst();


prob->featStartId[i] = idlp; prob->featStartId[i] = idlp;
prob->inactiveCost[i] = pow( 2, 10 - 10 * feat->priority ); prob->inactiveCost[i] = std::pow( 2, 10 - 10 * feat->priority );


switch ( feat->feature->getGeosType() ) switch ( feat->feature->getGeosType() )
{ {
Expand Down
2 changes: 1 addition & 1 deletion src/core/pal/rtree.hpp
Expand Up @@ -1180,7 +1180,7 @@ namespace pal
} }
else else
{ {
return static_cast< ELEMTYPEREAL >( pow( radius, NUMDIMS ) * m_unitSphereVolume ); return static_cast< ELEMTYPEREAL >( std::pow( radius, NUMDIMS ) * m_unitSphereVolume );
} }
} }


Expand Down
4 changes: 2 additions & 2 deletions src/core/qgis.h
Expand Up @@ -236,7 +236,7 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
double br = frexp( b, &bexp ); double br = frexp( b, &bexp );


return aexp == bexp && return aexp == bexp &&
std::round( ar * pow( 10.0, significantDigits ) ) == std::round( br * pow( 10.0, significantDigits ) ); std::round( ar * std::pow( 10.0, significantDigits ) ) == std::round( br * std::pow( 10.0, significantDigits ) );
} }


/** /**
Expand All @@ -246,7 +246,7 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
*/ */
inline double qgsRound( double number, double places ) inline double qgsRound( double number, double places )
{ {
int scaleFactor = pow( 10, places ); int scaleFactor = std::pow( 10, places );
return static_cast<double>( static_cast<qlonglong>( number * scaleFactor + 0.5 ) ) / scaleFactor; return static_cast<double>( static_cast<qlonglong>( number * scaleFactor + 0.5 ) ) / scaleFactor;
} }


Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatetransform.cpp
Expand Up @@ -352,7 +352,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r
// even with 1000 points it takes < 1ms // even with 1000 points it takes < 1ms
// TODO: how to effectively and precisely reproject bounding box? // TODO: how to effectively and precisely reproject bounding box?
const int nPoints = 1000; const int nPoints = 1000;
double d = sqrt( ( rect.width() * rect.height() ) / pow( sqrt( static_cast< double >( nPoints ) ) - 1, 2.0 ) ); double d = sqrt( ( rect.width() * rect.height() ) / std::pow( sqrt( static_cast< double >( nPoints ) ) - 1, 2.0 ) );
int nXPoints = static_cast< int >( ceil( rect.width() / d ) ) + 1; int nXPoints = static_cast< int >( ceil( rect.width() / d ) ) + 1;
int nYPoints = static_cast< int >( ceil( rect.height() / d ) ) + 1; int nYPoints = static_cast< int >( ceil( rect.height() / d ) ) + 1;


Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsfield.cpp
Expand Up @@ -268,7 +268,7 @@ bool QgsField::convertCompatible( QVariant &v ) const


if ( d->type == QVariant::Double && d->precision > 0 ) if ( d->type == QVariant::Double && d->precision > 0 )
{ {
double s = qPow( 10, d->precision ); double s = std::pow( 10, d->precision );
double d = v.toDouble() * s; double d = v.toDouble() * s;
v = QVariant( ( d < 0 ? ceil( d - 0.5 ) : floor( d + 0.5 ) ) / s ); v = QVariant( ( d < 0 ? ceil( d - 0.5 ) : floor( d + 0.5 ) ) / s );
return true; return true;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgshistogram.cpp
Expand Up @@ -65,7 +65,7 @@ bool QgsHistogram::setValues( const QgsVectorLayer *layer, const QString &fieldO
double QgsHistogram::optimalBinWidth() const double QgsHistogram::optimalBinWidth() const
{ {
//Freedman-Diaconis rule //Freedman-Diaconis rule
return 2.0 * mIQR * qPow( mValues.count(), -1 / 3.0 ); return 2.0 * mIQR * std::pow( mValues.count(), -1 / 3.0 );
} }


int QgsHistogram::optimalNumberBins() const int QgsHistogram::optimalNumberBins() const
Expand Down

0 comments on commit 031bf41

Please sign in to comment.