PINK: rework getting length between locations

This commit is contained in:
Andrei Prykhodko 2018-06-27 23:04:53 +03:00 committed by Eugene Sandulenko
parent 40488c8b22
commit e25a9cabb4

View File

@ -108,8 +108,7 @@ WalkAction *WalkMgr::getWalkAction() {
double WalkMgr::getLengthBetweenLocations(WalkLocation *first, WalkLocation *second) {
Coordinates firstCoord = getLocationCoordinates(first->getName());
Coordinates secondCoord = getLocationCoordinates(second->getName());
return (double)sqrt((double)(secondCoord.point.x - firstCoord.point.x) * (secondCoord.point.x - firstCoord.point.x) +
(secondCoord.point.y - firstCoord.point.y) * (secondCoord.point.y - firstCoord.point.y));
return hypot(secondCoord.point.x - firstCoord.point.x, secondCoord.point.y - firstCoord.point.y);
}
Coordinates WalkMgr::getLocationCoordinates(const Common::String &locationName) {