More sqrnorm fixes
This commit is contained in:
@@ -76,7 +76,7 @@ distPointTriangleSquared( const Point& _p,
|
||||
const Point v0v1 = _v1 - _v0;
|
||||
const Point v0v2 = _v2 - _v0;
|
||||
const Point n = v0v1 % v0v2; // not normalized !
|
||||
const Scalar d = n.sqrnorm();
|
||||
const Scalar d = sqrnorm(n);
|
||||
|
||||
|
||||
// Check if the triangle is degenerated
|
||||
@@ -88,9 +88,9 @@ distPointTriangleSquared( const Point& _p,
|
||||
// these are not needed for every point, should still perform
|
||||
// better with many points against one triangle
|
||||
const Point v1v2 = _v2 - _v1;
|
||||
const Scalar inv_v0v2_2 = static_cast<Scalar>(1.0) / v0v2.sqrnorm();
|
||||
const Scalar inv_v0v1_2 = static_cast<Scalar>(1.0) / v0v1.sqrnorm();
|
||||
const Scalar inv_v1v2_2 = static_cast<Scalar>(1.0) / v1v2.sqrnorm();
|
||||
const Scalar inv_v0v2_2 = static_cast<Scalar>(1.0) / sqrnorm(v0v2);
|
||||
const Scalar inv_v0v1_2 = static_cast<Scalar>(1.0) / sqrnorm(v0v1);
|
||||
const Scalar inv_v1v2_2 = static_cast<Scalar>(1.0) / sqrnorm(v1v2);
|
||||
|
||||
|
||||
Point v0p = _p - _v0;
|
||||
@@ -177,10 +177,10 @@ distPointTriangleSquared( const Point& _p,
|
||||
}
|
||||
} else {
|
||||
// Calculate the distance to an interior point of the triangle
|
||||
return ( (_p - n*((n|v0p) * invD)) - _p).sqrnorm();
|
||||
return sqrnorm( (_p - n*((n|v0p) * invD)) - _p);
|
||||
}
|
||||
|
||||
return (v0p - _p).sqrnorm();
|
||||
return sqrnorm(v0p - _p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user