Skip to content
Snippets Groups Projects
Commit a1e0ef48 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi
Browse files

Fix: point to line segment distance can be NaN.

Change-Id: I7db6bfea925a0eda82bfb1f7b5e1110b193dabdb
parent 33392248
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,10 @@ class ProximityInfoUtils { ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment