minor format
This commit is contained in:
parent
6e9c56ee2c
commit
04f9db4b18
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue