Skip to content

Commit b5ca4b4

Browse files
committed
(q)sqrt -> std::sqrt
1 parent fec03ca commit b5ca4b4

File tree

78 files changed

+190
-190
lines changed

Some content is hidden

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

78 files changed

+190
-190
lines changed

src/analysis/interpolation/DualEdgeTriangulation.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,8 @@ int DualEdgeTriangulation::insertForcedSegment( int p1, int p2, bool breakline )
12711271
p3 = mHalfEdge[mHalfEdge[actedge]->getNext()]->getPoint();
12721272
p4 = mHalfEdge[mHalfEdge[mHalfEdge[actedge]->getNext()]->getDual()]->getPoint();
12731273
MathUtils::lineIntersection( mPointVector[p1], mPointVector[p2], mPointVector[p3], mPointVector[p4], &crosspoint );
1274-
double dista = sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1275-
double distb = sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
1274+
double dista = std::sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1275+
double distb = std::sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
12761276
if ( dista <= distb )
12771277
{
12781278
insertForcedSegment( p1, p3, breakline );
@@ -1293,8 +1293,8 @@ int DualEdgeTriangulation::insertForcedSegment( int p1, int p2, bool breakline )
12931293
p3 = mHalfEdge[mHalfEdge[actedge]->getNext()]->getPoint();
12941294
p4 = mHalfEdge[mHalfEdge[mHalfEdge[actedge]->getNext()]->getDual()]->getPoint();
12951295
MathUtils::lineIntersection( mPointVector[p1], mPointVector[p2], mPointVector[p3], mPointVector[p4], &crosspoint );
1296-
double distpart = sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
1297-
double disttot = sqrt( ( mPointVector[p3]->x() - mPointVector[p4]->x() ) * ( mPointVector[p3]->x() - mPointVector[p4]->x() ) + ( mPointVector[p3]->y() - mPointVector[p4]->y() ) * ( mPointVector[p3]->y() - mPointVector[p4]->y() ) );
1296+
double distpart = std::sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
1297+
double disttot = std::sqrt( ( mPointVector[p3]->x() - mPointVector[p4]->x() ) * ( mPointVector[p3]->x() - mPointVector[p4]->x() ) + ( mPointVector[p3]->y() - mPointVector[p4]->y() ) * ( mPointVector[p3]->y() - mPointVector[p4]->y() ) );
12981298
float frac = distpart / disttot;
12991299

13001300
if ( frac == 0 || frac == 1 )//just in case MathUtils::lineIntersection does not work as expected
@@ -1359,8 +1359,8 @@ int DualEdgeTriangulation::insertForcedSegment( int p1, int p2, bool breakline )
13591359
p3 = mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getPoint();
13601360
p4 = mHalfEdge[mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getNext()]->getPoint();
13611361
MathUtils::lineIntersection( mPointVector[p1], mPointVector[p2], mPointVector[p3], mPointVector[p4], &crosspoint );
1362-
double dista = sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1363-
double distb = sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
1362+
double dista = std::sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1363+
double distb = std::sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
13641364
if ( dista <= distb )
13651365
{
13661366
insertForcedSegment( p1, p3, breakline );
@@ -1381,8 +1381,8 @@ int DualEdgeTriangulation::insertForcedSegment( int p1, int p2, bool breakline )
13811381
p3 = mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getPoint();
13821382
p4 = mHalfEdge[mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getNext()]->getPoint();
13831383
MathUtils::lineIntersection( mPointVector[p1], mPointVector[p2], mPointVector[p3], mPointVector[p4], &crosspoint );
1384-
double distpart = sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1385-
double disttot = sqrt( ( mPointVector[p3]->x() - mPointVector[p4]->x() ) * ( mPointVector[p3]->x() - mPointVector[p4]->x() ) + ( mPointVector[p3]->y() - mPointVector[p4]->y() ) * ( mPointVector[p3]->y() - mPointVector[p4]->y() ) );
1384+
double distpart = std::sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1385+
double disttot = std::sqrt( ( mPointVector[p3]->x() - mPointVector[p4]->x() ) * ( mPointVector[p3]->x() - mPointVector[p4]->x() ) + ( mPointVector[p3]->y() - mPointVector[p4]->y() ) * ( mPointVector[p3]->y() - mPointVector[p4]->y() ) );
13861386
float frac = distpart / disttot;
13871387
if ( frac == 0 || frac == 1 )
13881388
{
@@ -1406,8 +1406,8 @@ int DualEdgeTriangulation::insertForcedSegment( int p1, int p2, bool breakline )
14061406
p3 = mHalfEdge[mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getNext()]->getPoint();
14071407
p4 = mHalfEdge[mHalfEdge[mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getNext()]->getNext()]->getPoint();
14081408
MathUtils::lineIntersection( mPointVector[p1], mPointVector[p2], mPointVector[p3], mPointVector[p4], &crosspoint );
1409-
double dista = sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1410-
double distb = sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
1409+
double dista = std::sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1410+
double distb = std::sqrt( ( crosspoint.x() - mPointVector[p4]->x() ) * ( crosspoint.x() - mPointVector[p4]->x() ) + ( crosspoint.y() - mPointVector[p4]->y() ) * ( crosspoint.y() - mPointVector[p4]->y() ) );
14111411
if ( dista <= distb )
14121412
{
14131413
insertForcedSegment( p1, p3, breakline );
@@ -1428,8 +1428,8 @@ int DualEdgeTriangulation::insertForcedSegment( int p1, int p2, bool breakline )
14281428
p3 = mHalfEdge[mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getNext()]->getPoint();
14291429
p4 = mHalfEdge[mHalfEdge[mHalfEdge[mHalfEdge[crossedEdges.last()]->getDual()]->getNext()]->getNext()]->getPoint();
14301430
MathUtils::lineIntersection( mPointVector[p1], mPointVector[p2], mPointVector[p3], mPointVector[p4], &crosspoint );
1431-
double distpart = sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1432-
double disttot = sqrt( ( mPointVector[p3]->x() - mPointVector[p4]->x() ) * ( mPointVector[p3]->x() - mPointVector[p4]->x() ) + ( mPointVector[p3]->y() - mPointVector[p4]->y() ) * ( mPointVector[p3]->y() - mPointVector[p4]->y() ) );
1431+
double distpart = std::sqrt( ( crosspoint.x() - mPointVector[p3]->x() ) * ( crosspoint.x() - mPointVector[p3]->x() ) + ( crosspoint.y() - mPointVector[p3]->y() ) * ( crosspoint.y() - mPointVector[p3]->y() ) );
1432+
double disttot = std::sqrt( ( mPointVector[p3]->x() - mPointVector[p4]->x() ) * ( mPointVector[p3]->x() - mPointVector[p4]->x() ) + ( mPointVector[p3]->y() - mPointVector[p4]->y() ) * ( mPointVector[p3]->y() - mPointVector[p4]->y() ) );
14331433
float frac = distpart / disttot;
14341434
if ( frac == 0 || frac == 1 )
14351435
{

src/analysis/interpolation/LinTriangleInterpolator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool LinTriangleInterpolator::calcNormVec( double x, double y, Vector3D *vec )
8282
if ( !calcFirstDerY( x, y, &vec2 ) )
8383
{return false;}
8484
Vector3D vec3( vec1.getY()*vec2.getZ() - vec1.getZ()*vec2.getY(), vec1.getZ()*vec2.getX() - vec1.getX()*vec2.getZ(), vec1.getX()*vec2.getY() - vec1.getY()*vec2.getX() );//calculate vector product
85-
double absvec3 = sqrt( vec3.getX() * vec3.getX() + vec3.getY() * vec3.getY() + vec3.getZ() * vec3.getZ() );//length of vec3
85+
double absvec3 = std::sqrt( vec3.getX() * vec3.getX() + vec3.getY() * vec3.getY() + vec3.getZ() * vec3.getZ() );//length of vec3
8686
vec->setX( vec3.getX() / absvec3 );//standardize vec3 and assign it to vec
8787
vec->setY( vec3.getY() / absvec3 );
8888
vec->setZ( vec3.getZ() / absvec3 );

src/analysis/interpolation/MathUtils.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ bool MathUtils::circumcenter( QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint
119119
{
120120
if ( p1 && p2 && p3 && result )
121121
{
122-
double distp1p2 = sqrt( ( p1->x() - p2->x() ) * ( p1->x() - p2->x() ) + ( p1->y() - p2->y() ) * ( p1->y() - p2->y() ) );
123-
double distp2p3 = sqrt( ( p2->x() - p3->x() ) * ( p2->x() - p3->x() ) + ( p2->y() - p3->y() ) * ( p2->y() - p3->y() ) );
122+
double distp1p2 = std::sqrt( ( p1->x() - p2->x() ) * ( p1->x() - p2->x() ) + ( p1->y() - p2->y() ) * ( p1->y() - p2->y() ) );
123+
double distp2p3 = std::sqrt( ( p2->x() - p3->x() ) * ( p2->x() - p3->x() ) + ( p2->y() - p3->y() ) * ( p2->y() - p3->y() ) );
124124
if ( distp1p2 > distp2p3 )
125125
{
126126
//swap p1 and p3 to avoid round-off errors
@@ -142,9 +142,9 @@ bool MathUtils::circumcenter( QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint
142142

143143
#if 0
144144
//debugging: test, if the distances from p1, p2, p3 to result are equal
145-
double dist1 = sqrt( ( p1->getX() - result->getX() ) * ( p1->getX() - result->getX() ) + ( p1->getY() - result->getY() ) * ( p1->getY() - result->getY() ) );
146-
double dist2 = sqrt( ( p2->getX() - result->getX() ) * ( p2->getX() - result->getX() ) + ( p2->getY() - result->getY() ) * ( p2->getY() - result->getY() ) );
147-
double dist3 = sqrt( ( p3->getX() - result->getX() ) * ( p3->getX() - result->getX() ) + ( p3->getY() - result->getY() ) * ( p3->getY() - result->getY() ) );
145+
double dist1 = std::sqrt( ( p1->getX() - result->getX() ) * ( p1->getX() - result->getX() ) + ( p1->getY() - result->getY() ) * ( p1->getY() - result->getY() ) );
146+
double dist2 = std::sqrt( ( p2->getX() - result->getX() ) * ( p2->getX() - result->getX() ) + ( p2->getY() - result->getY() ) * ( p2->getY() - result->getY() ) );
147+
double dist3 = std::sqrt( ( p3->getX() - result->getX() ) * ( p3->getX() - result->getX() ) + ( p3->getY() - result->getY() ) * ( p3->getY() - result->getY() ) );
148148

149149
if ( dist1 - dist2 > 1 || dist2 - dist1 > 1 || dist1 - dist3 > 1 || dist3 - dist1 > 1 )
150150
{
@@ -180,9 +180,9 @@ bool MathUtils::circumcenter( QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint
180180
MathUtils::lineIntersection( &midpoint12, &helppoint1, &midpoint23, &helppoint2, result );
181181

182182
//debugging: test, if the distances from p1, p2, p3 to result are equal
183-
double dist1 = sqrt( ( p1->getX() - result->getX() ) * ( p1->getX() - result->getX() ) + ( p1->getY() - result->getY() ) * ( p1->getY() - result->getY() ) );
184-
double dist2 = sqrt( ( p2->getX() - result->getX() ) * ( p2->getX() - result->getX() ) + ( p2->getY() - result->getY() ) * ( p2->getY() - result->getY() ) );
185-
double dist3 = sqrt( ( p3->getX() - result->getX() ) * ( p3->getX() - result->getX() ) + ( p3->getY() - result->getY() ) * ( p3->getY() - result->getY() ) );
183+
double dist1 = std::sqrt( ( p1->getX() - result->getX() ) * ( p1->getX() - result->getX() ) + ( p1->getY() - result->getY() ) * ( p1->getY() - result->getY() ) );
184+
double dist2 = std::sqrt( ( p2->getX() - result->getX() ) * ( p2->getX() - result->getX() ) + ( p2->getY() - result->getY() ) * ( p2->getY() - result->getY() ) );
185+
double dist3 = std::sqrt( ( p3->getX() - result->getX() ) * ( p3->getX() - result->getX() ) + ( p3->getY() - result->getY() ) * ( p3->getY() - result->getY() ) );
186186

187187
if ( dist1 - dist2 > 1 || dist2 - dist1 > 1 || dist1 - dist3 > 1 || dist3 - dist1 > 1 )
188188
{
@@ -210,7 +210,7 @@ double MathUtils::distPointFromLine( QgsPoint *thepoint, QgsPoint *p1, QgsPoint
210210
double a = normal.getX();
211211
double b = normal.getY();
212212
double c = -( normal.getX() * p2->x() + normal.getY() * p2->y() );
213-
double distance = std::fabs( ( a * thepoint->x() + b * thepoint->y() + c ) / ( sqrt( a * a + b * b ) ) );
213+
double distance = std::fabs( ( a * thepoint->x() + b * thepoint->y() + c ) / ( std::sqrt( a * a + b * b ) ) );
214214
return distance;
215215
}
216216
else
@@ -619,7 +619,7 @@ bool MathUtils::normalLeft( Vector3D *v1, Vector3D *result, double length )
619619
return false;
620620
}
621621

622-
result->setX( ( -b + sqrt( d ) ) / ( 2 * a ) ); //take one of the two solutions of the quadratic equation
622+
result->setX( ( -b + std::sqrt( d ) ) / ( 2 * a ) ); //take one of the two solutions of the quadratic equation
623623
result->setY( ( -result->getX()*v1->getX() ) / v1->getY() );
624624

625625
QgsPoint point1( 0, 0, 0 );
@@ -676,7 +676,7 @@ bool MathUtils::normalRight( Vector3D *v1, Vector3D *result, double length )
676676
return false;
677677
}
678678

679-
result->setX( ( -b + sqrt( d ) ) / ( 2 * a ) ); //take one of the two solutions of the quadratic equation
679+
result->setX( ( -b + std::sqrt( d ) ) / ( 2 * a ) ); //take one of the two solutions of the quadratic equation
680680
result->setY( ( -result->getX()*v1->getX() ) / v1->getY() );
681681

682682
QgsPoint point1( 0, 0, 0 );
@@ -787,7 +787,7 @@ bool MathUtils::normalMinDistance( Vector3D *tangent, Vector3D *target, Vector3D
787787
QgsDebugMsg( "warning, only complex solution of xg" );
788788
return false;
789789
}
790-
xg1 = sqrt( xgalpha1 ) * ( -yt * yw * xt + yt * yt * xw + xw * zt * zt - zt * xt * zw );
790+
xg1 = std::sqrt( xgalpha1 ) * ( -yt * yw * xt + yt * yt * xw + xw * zt * zt - zt * xt * zw );
791791
xg2 = -sqrt( xgalpha1 ) * ( -yt * yw * xt + yt * yt * xw + xw * zt * zt - zt * xt * zw );
792792

793793
//calculate yg
@@ -798,7 +798,7 @@ bool MathUtils::normalMinDistance( Vector3D *tangent, Vector3D *target, Vector3D
798798
return false;
799799
}
800800
yg1 = -sqrt( ygalpha1 ) * ( -yw * xt * xt - zt * zt * yw + zt * yt * zw + yt * xw * xt );
801-
yg2 = sqrt( ygalpha1 ) * ( -yw * xt * xt - zt * zt * yw + zt * yt * zw + yt * xw * xt );
801+
yg2 = std::sqrt( ygalpha1 ) * ( -yw * xt * xt - zt * zt * yw + zt * yt * zw + yt * xw * xt );
802802

803803
//calculate zg
804804
double zgalpha1 = 1 / ( 2 * xt * xt * yw * yw * zt * zt - 2 * zt * zt * zt * xt * zw * xw + yt * yt * yt * yt * zw * zw + yt * yt * zw * zw * zt * zt + xt * xt * yt * yt * xw * xw + xt * xt * yw * yw * yt * yt - 2 * xt * xt * xt * zt * zw * xw + yt * yt * yt * yt * xw * xw + yt * yt * yw * yw * zt * zt + 2 * xt * xt * yt * yt * zw * zw - 2 * yt * yt * yt * yw * zt * zw + zt * zt * xt * xt * zw * zw + zt * zt * zt * zt * xw * xw + xt * xt * zt * zt * xw * xw + 2 * zt * zt * xw * xw * yt * yt - 2 * xt * xt * yw * zt * yt * zw - 2 * xt * yt * yt * yt * xw * yw - 2 * xt * xt * xt * yw * yt * xw - 2 * xt * zt * zt * xw * yt * yw - 2 * xt * zt * xw * yt * yt * zw - 2 * yw * zt * zt * zt * yt * zw + xt * xt * xt * xt * yw * yw + yw * yw * zt * zt * zt * zt + xt * xt * xt * xt * zw * zw );
@@ -808,10 +808,10 @@ bool MathUtils::normalMinDistance( Vector3D *tangent, Vector3D *target, Vector3D
808808
return false;
809809
}
810810
zg1 = -sqrt( zgalpha1 ) * ( yt * yw * zt - yt * yt * zw + xw * zt * xt - xt * xt * zw );
811-
zg2 = sqrt( zgalpha1 ) * ( yt * yw * zt - yt * yt * zw + xw * zt * xt - xt * xt * zw );
811+
zg2 = std::sqrt( zgalpha1 ) * ( yt * yw * zt - yt * yt * zw + xw * zt * xt - xt * xt * zw );
812812

813-
double distance1 = sqrt( ( xw - xg1 ) * ( xw - xg1 ) + ( yw - yg1 ) * ( yw - yg1 ) + ( zw - zg1 ) * ( zw - zg1 ) );
814-
double distance2 = sqrt( ( xw - xg2 ) * ( xw - xg2 ) + ( yw - yg2 ) * ( yw - yg2 ) + ( zw - zg2 ) * ( zw - zg2 ) );
813+
double distance1 = std::sqrt( ( xw - xg1 ) * ( xw - xg1 ) + ( yw - yg1 ) * ( yw - yg1 ) + ( zw - zg1 ) * ( zw - zg1 ) );
814+
double distance2 = std::sqrt( ( xw - xg2 ) * ( xw - xg2 ) + ( yw - yg2 ) * ( yw - yg2 ) + ( zw - zg2 ) * ( zw - zg2 ) );
815815

816816
if ( distance1 <= distance2 )//find out, which solution is the maximum and which the minimum
817817
{

src/analysis/interpolation/qgsidwinterpolator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int QgsIDWInterpolator::interpolatePoint( double x, double y, double &result )
4444

4545
Q_FOREACH ( const vertexData &vertex_it, mCachedBaseData )
4646
{
47-
distance = sqrt( ( vertex_it.x - x ) * ( vertex_it.x - x ) + ( vertex_it.y - y ) * ( vertex_it.y - y ) );
47+
distance = std::sqrt( ( vertex_it.x - x ) * ( vertex_it.x - x ) + ( vertex_it.y - y ) * ( vertex_it.y - y ) );
4848
if ( ( distance - 0 ) < std::numeric_limits<double>::min() )
4949
{
5050
result = vertex_it.z;

src/analysis/raster/qgshillshadefilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ float QgsHillshadeFilter::processNineCellWindow( float *x11, float *x21, float *
3838
}
3939

4040
float zenith_rad = mLightAngle * M_PI / 180.0;
41-
float slope_rad = atan( sqrt( derX * derX + derY * derY ) );
41+
float slope_rad = atan( std::sqrt( derX * derX + derY * derY ) );
4242
float azimuth_rad = mLightAzimuth * M_PI / 180.0;
4343
float aspect_rad = 0;
4444
if ( derX == 0 && derY == 0 ) //aspect undefined, take a neutral value. Better solutions?

src/analysis/raster/qgskde.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ QgsKernelDensityEstimation::Result QgsKernelDensityEstimation::addFeature( const
181181
double pixelCentroidX = ( xPosition + xp + 0.5 ) * mPixelSize + mBounds.xMinimum();
182182
double pixelCentroidY = ( yPosition + yp + 0.5 ) * mPixelSize + mBounds.yMinimum();
183183

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

186186
// is pixel outside search bandwidth of feature?
187187
if ( distance > radius )

src/analysis/raster/qgsrastermatrix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ bool QgsRasterMatrix::oneArgumentOperation( OneArgOperator op )
216216
}
217217
else
218218
{
219-
mData[i] = sqrt( value );
219+
mData[i] = std::sqrt( value );
220220
}
221221
break;
222222
case opSIN:

src/analysis/raster/qgsslopefilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ float QgsSlopeFilter::processNineCellWindow( float *x11, float *x21, float *x31,
3434
return mOutputNodataValue;
3535
}
3636

37-
return atan( sqrt( derX * derX + derY * derY ) ) * 180.0 / M_PI;
37+
return atan( std::sqrt( derX * derX + derY * derY ) ) * 180.0 / M_PI;
3838
}
3939

src/analysis/vector/qgstransectsample.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,28 +440,28 @@ bool QgsTransectSample::closestSegmentPoints( const QgsGeometry &g1, const QgsGe
440440

441441
if ( d1 <= d2 && d1 <= d3 && d1 <= d4 )
442442
{
443-
dist = sqrt( d1 );
443+
dist = std::sqrt( d1 );
444444
pt1 = p11;
445445
pt2 = minDistPoint1;
446446
return true;
447447
}
448448
else if ( d2 <= d1 && d2 <= d3 && d2 <= d4 )
449449
{
450-
dist = sqrt( d2 );
450+
dist = std::sqrt( d2 );
451451
pt1 = p12;
452452
pt2 = minDistPoint2;
453453
return true;
454454
}
455455
else if ( d3 <= d1 && d3 <= d2 && d3 <= d4 )
456456
{
457-
dist = sqrt( d3 );
457+
dist = std::sqrt( d3 );
458458
pt1 = p21;
459459
pt2 = minDistPoint3;
460460
return true;
461461
}
462462
else
463463
{
464-
dist = sqrt( d4 );
464+
dist = std::sqrt( d4 );
465465
pt1 = p21;
466466
pt2 = minDistPoint4;
467467
return true;
@@ -512,7 +512,7 @@ bool QgsTransectSample::closestSegmentPoints( const QgsGeometry &g1, const QgsGe
512512
pt1.sqrDistToSegment( p21.x(), p21.y(), p22.x(), p22.y(), pt2 );
513513
}
514514

515-
dist = sqrt( pt1.sqrDist( pt2 ) );
515+
dist = std::sqrt( pt1.sqrDist( pt2 ) );
516516
return true;
517517
}
518518

src/app/dwg/libdxfrw/drw_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class DRW_Coord
175175
void unitize()
176176
{
177177
double dist;
178-
dist = sqrt( x * x + y * y + z * z );
178+
dist = std::sqrt( x * x + y * y + z * z );
179179
if ( dist > 0.0 )
180180
{
181181
x = x / dist;

0 commit comments

Comments
 (0)