Replace abs() with std::abs().

This commit is contained in:
Chris Pavlina 2015-06-26 19:21:09 -04:00 committed by Wayne Stambaugh
parent f194905117
commit 3af895e285
1 changed files with 5 additions and 5 deletions

View File

@ -68,13 +68,13 @@ bool FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, in
else else
{ {
if( dist ) if( dist )
*dist = std::min( abs( a - xi ), abs( a - xf ) ); *dist = std::min( std::abs( a - xi ), std::abs( a - xf ) );
return false; return false;
} }
} }
if( fabs( b - d ) < 1E-12 ) if( std::abs( b - d ) < 1E-12 )
{ {
// parallel lines // parallel lines
if( dist ) if( dist )
@ -429,7 +429,7 @@ double GetPointToLineDistance( double a, double b, int x, int y, double* xpp, do
*ypp = y; *ypp = y;
} }
return abs( a - x ); return std::abs( a - x );
} }
// find c,d such that (x,y) lies on y = c + dx where d=(-1/b) // find c,d such that (x,y) lies on y = c + dx where d=(-1/b)
@ -466,7 +466,7 @@ double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int
{ {
// vertical line segment // vertical line segment
if( InRange( y, yi, yf ) ) if( InRange( y, yi, yf ) )
return abs( x - xi ); return std::abs( x - xi );
else else
return std::min( Distance( x, y, xi, yi ), Distance( x, y, xf, yf ) ); return std::min( Distance( x, y, xi, yi ), Distance( x, y, xf, yf ) );
} }
@ -474,7 +474,7 @@ double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int
{ {
// horizontal line segment // horizontal line segment
if( InRange( x, xi, xf ) ) if( InRange( x, xi, xf ) )
return abs( y - yi ); return std::abs( y - yi );
else else
return std::min( Distance( x, y, xi, yi ), Distance( x, y, xf, yf ) ); return std::min( Distance( x, y, xi, yi ), Distance( x, y, xf, yf ) );
} }