minor format

This commit is contained in:
Artem Pavlenko 2017-09-11 17:30:37 +01:00
parent 6e9c56ee2c
commit 04f9db4b18

View file

@ -155,14 +155,14 @@ inline double point_to_segment_distance(double x, double y,
return distance(x,y,ax,ay); return distance(x,y,ax,ay);
} }
double r = ((x - ax)*(bx - ax) + (y - ay)*(by -ay))/len2; double r = ((x - ax)*(bx - ax) + (y - ay)*(by - ay))/len2;
if ( r < 0 ) if ( r < 0 )
{ {
return distance(x,y,ax,ay); return distance(x,y,ax,ay);
} }
else if (r > 1) else if (r > 1)
{ {
return distance(x,y,bx,by); return distance(x, y, bx, by);
} }
double s = ((ay - y)*(bx - ax) - (ax - x)*(by - ay))/len2; double s = ((ay - y)*(bx - ax) - (ax - x)*(by - ay))/len2;
return std::fabs(s) * std::sqrt(len2); return std::fabs(s) * std::sqrt(len2);