Bug fixed in the ClosestPoint2Box2 function
This commit is contained in:
parent
e90c417d2b
commit
e3d8489f0f
|
@ -338,14 +338,14 @@ Point2<ScalarType> ClosestPoint2Box2(const Point2<ScalarType> &test,
|
||||||
|
|
||||||
Point2<ScalarType> closest = ClosestPoint(Segs[0], test);
|
Point2<ScalarType> closest = ClosestPoint(Segs[0], test);
|
||||||
ScalarType minDist = (closest-test).Norm();
|
ScalarType minDist = (closest-test).Norm();
|
||||||
for (int i=0;i<4;i++)
|
for (int i = 1; i < 4; i++)
|
||||||
{
|
{
|
||||||
Point2<ScalarType> test=ClosestPoint(Segs[i],test);
|
Point2<ScalarType> point = ClosestPoint(Segs[i], test);
|
||||||
ScalarType dist=(closest-test).Norm();
|
ScalarType dist = (test - point).Norm();
|
||||||
if (dist < minDist)
|
if (dist < minDist)
|
||||||
{
|
{
|
||||||
minDist = dist;
|
minDist = dist;
|
||||||
closest=test;
|
closest = point;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return closest;
|
return closest;
|
||||||
|
|
Loading…
Reference in New Issue