math_for_graphics.cpp: use abs() instead of std::abs() for integer values, to avoid errors with some compilers.

This commit is contained in:
jean-pierre charras 2015-12-07 11:01:33 +01:00
parent c80d92e927
commit fefa8d16f0
1 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@
#include <float.h>
#include <limits.h>
#include <common.h>
#include <stdlib.h> // for abs function
#include <math_for_graphics.h>
static bool InRange( double x, double xi, double xf );
@ -464,7 +464,7 @@ double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int
{
// vertical line segment
if( InRange( y, yi, yf ) )
return std::abs( x - xi );
return abs( x - xi );
else
return std::min( Distance( x, y, xi, yi ), Distance( x, y, xf, yf ) );
}
@ -472,7 +472,7 @@ double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int
{
// horizontal line segment
if( InRange( x, xi, xf ) )
return std::abs( y - yi );
return abs( y - yi );
else
return std::min( Distance( x, y, xi, yi ), Distance( x, y, xf, yf ) );
}