From 27d29090d8ea626226af92e5a626b3d261ce5d59 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 24 Jul 2016 23:59:59 +0300 Subject: FULLPIPE: Clarified MovGraph::calcDistance() implementation --- engines/fullpipe/motion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index baea2e28bd..47cf52417b 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1289,11 +1289,11 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzz int n2x = link->_graphDst->_x; int n2y = link->_graphDst->_y; double dist1x = (double)(point->x - n1x); - double dist1y = (double)(n1y - point->y); + double dist1y = (double)(point->y - n1y); double dist2x = (double)(n2x - n1x); double dist2y = (double)(n2y - n1y); - double dist1 = sqrt(dist1y * dist1y + dist1x * dist1x); - double dist2 = ((double)(n1y - n2y) * dist1y + dist2x * dist1x) / link->_length / dist1; + double dist1 = sqrt(dist1x * dist1x + dist1y * dist1y); + double dist2 = (dist2y * dist1y + dist2x * dist1x) / link->_length / dist1; double distm = dist2 * dist1; double res = sqrt(1.0 - dist2 * dist2) * dist1; -- cgit v1.2.3