diff --git a/modules/autonavigation/path.cpp b/modules/autonavigation/path.cpp index 9ca49d3ee5..9d7472a58d 100644 --- a/modules/autonavigation/path.cpp +++ b/modules/autonavigation/path.cpp @@ -62,21 +62,15 @@ Path::Path(Waypoint start, Waypoint end, CurveType type, } } -void Path::setStartPoint(Waypoint cs) { - _start = std::move(cs); - initializePath(); - // TODO later: maybe recompute duration as well... -} +Waypoint Path::startPoint() const { return _start; } -const Waypoint Path::startPoint() const { return _start; } +Waypoint Path::endPoint() const { return _end; } -const Waypoint Path::endPoint() const { return _end; } +double Path::duration() const { return _duration; } -const double Path::duration() const { return _duration; } +double Path::pathLength() const { return _curve->length(); } -const double Path::pathLength() const { return _curve->length(); } - -const std::vector Path::controlPoints() const { +std::vector Path::controlPoints() const { return _curve->points(); } @@ -154,13 +148,9 @@ void Path::initializePath() { break; default: LERROR("Could not create curve. Type does not exist!"); + throw ghoul::MissingCaseException(); return; } - - if (!_curve || !_rotationInterpolator) { - LERROR("Curve type has not been properly initialized."); - return; - } } } // namespace openspace::autonavigation diff --git a/modules/autonavigation/path.h b/modules/autonavigation/path.h index f02a9ac446..5038f4fa57 100644 --- a/modules/autonavigation/path.h +++ b/modules/autonavigation/path.h @@ -41,23 +41,21 @@ public: // TODO: add a constructor that takes an instruction and curve type? - void setStartPoint(Waypoint wp); + Waypoint startPoint() const; + Waypoint endPoint() const; + double duration() const; + double pathLength() const; - const Waypoint startPoint() const; - const Waypoint endPoint() const; - const double duration() const; - const double pathLength() const; - - const std::vector controlPoints() const; + std::vector controlPoints() const; CameraPose traversePath(double dt); std::string currentAnchor() const; bool hasReachedEnd() const; - double speedAtTime(double time) const; CameraPose interpolatedPose(double distance) const; private: + double speedAtTime(double time) const; void initializePath(); Waypoint _start;