From f760193da72b1ef10459f09e638a4d3c64337755 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Jun 2020 14:28:54 +0200 Subject: [PATCH] bug fix, return correct number of view directions --- modules/autonavigation/autonavigationhandler.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/autonavigation/autonavigationhandler.cpp b/modules/autonavigation/autonavigationhandler.cpp index bc5a596b58..037f7c0fbc 100644 --- a/modules/autonavigation/autonavigationhandler.cpp +++ b/modules/autonavigation/autonavigationhandler.cpp @@ -328,7 +328,7 @@ std::vector AutoNavigationHandler::getCurvePositions(int nPerSegment const double du = 1.0 / nPerSegment; - for (std::unique_ptr &p : _pathSegments) { + for (std::unique_ptr& p : _pathSegments) { for (double u = 0.0; u < 1.0; u += du) { glm::dvec3 position = p->interpolatedPose(u).position; positions.push_back(position); @@ -352,10 +352,11 @@ std::vector AutoNavigationHandler::getCurveOrientations(int nPerSegm const double du = 1.0 / nPerSegment; for (std::unique_ptr& p : _pathSegments) { - for (double u = 0.0; u < 1.0; u += du) { + for (double u = 0.0; u <= 1.0; u += du) { glm::dquat orientation = p->interpolatedPose(u).rotation; orientations.push_back(orientation); } + orientations.push_back(p->interpolatedPose(1.0).rotation); } return orientations; @@ -379,13 +380,15 @@ std::vector AutoNavigationHandler::getCurveViewDirections(int nPerSe glm::dquat orientation = p->interpolatedPose(u).rotation; glm::dvec3 direction = glm::normalize(orientation * glm::dvec3(0.0, 0.0, -1.0)); viewDirections.push_back(direction); - } + } + glm::dquat orientation = p->interpolatedPose(1.0).rotation; + glm::dvec3 direction = glm::normalize(orientation * glm::dvec3(0.0, 0.0, -1.0)); + viewDirections.push_back(direction); } return viewDirections; } - // TODO: remove when not needed // Created for debugging std::vector AutoNavigationHandler::getControlPoints() {