Tiny refactor/cleanup

This commit is contained in:
Emma Broman
2021-06-04 16:03:43 +02:00
parent 7f9d8b8da6
commit 39c8f8283f
2 changed files with 12 additions and 24 deletions

View File

@@ -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<glm::dvec3> Path::controlPoints() const {
std::vector<glm::dvec3> 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

View File

@@ -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<glm::dvec3> controlPoints() const;
std::vector<glm::dvec3> 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;