am a1e0ef48: Fix: point to line segment distance can be NaN.
* commit 'a1e0ef4836f59a9fd5a2b44ecb94c27227e159c6': Fix: point to line segment distance can be NaN.main
commit
d5aa36505f
|
@ -100,6 +100,10 @@ class ProximityInfoUtils {
|
||||||
const float dotProduct = ray1x * ray2x + ray1y * ray2y;
|
const float dotProduct = ray1x * ray2x + ray1y * ray2y;
|
||||||
const float lineLengthSqr = GeometryUtils::SQUARE_FLOAT(ray2x)
|
const float lineLengthSqr = GeometryUtils::SQUARE_FLOAT(ray2x)
|
||||||
+ GeometryUtils::SQUARE_FLOAT(ray2y);
|
+ GeometryUtils::SQUARE_FLOAT(ray2y);
|
||||||
|
if (lineLengthSqr <= 0.0f) {
|
||||||
|
// Return point to the point distance.
|
||||||
|
return getSquaredDistanceFloat(x, y, x1, y1);
|
||||||
|
}
|
||||||
const float projectionLengthSqr = dotProduct / lineLengthSqr;
|
const float projectionLengthSqr = dotProduct / lineLengthSqr;
|
||||||
|
|
||||||
float projectionX;
|
float projectionX;
|
||||||
|
|
Loading…
Reference in New Issue