Minor refactor

This commit is contained in:
Emma Broman
2020-02-17 10:51:56 -05:00
parent 95449a633c
commit 566b9959ec
3 changed files with 4 additions and 4 deletions
@@ -141,7 +141,7 @@ void AutoNavigationHandler::updateCamera(double deltaTime) {
double displacement = deltaTime * cps.speedAtTime(_currentTime - cps.startTime());
_distanceAlongCurrentSegment += displacement;
double relativeDisplacement = _distanceAlongCurrentSegment / cps.length();
double relativeDisplacement = _distanceAlongCurrentSegment / cps.pathLength();
relativeDisplacement = std::max(0.0, std::min(relativeDisplacement, 1.0));
// When halfway along a curve, set anchor node in orbitalNavigator, to render
+2 -2
View File
@@ -75,7 +75,7 @@ const double PathSegment::startTime() const { return _startTime; }
const double PathSegment::endTime() const { return _startTime + _duration; }
const double PathSegment::length() const { return _curve->length(); }
const double PathSegment::pathLength() const { return _curve->length(); }
// TODO: remove function for debugging
const std::vector<glm::dvec3> PathSegment::getControlPoints() const {
@@ -91,7 +91,7 @@ const std::vector<glm::dvec3> PathSegment::getControlPoints() const {
double PathSegment::speedAtTime(double time) {
ghoul_assert(time >= 0 && time <= _duration, "Time out of range [0, duration]");
double t = time / _duration;
return (length() * _speedFunction.value(t)) / _speedFunction.integratedSum;
return (pathLength() * _speedFunction.value(t)) / _speedFunction.integratedSum;
}
glm::dvec3 PathSegment::getPositionAt(double u) const {
+1 -1
View File
@@ -55,7 +55,7 @@ public:
const double duration() const;
const double startTime() const;
const double endTime() const;
const double length() const;
const double pathLength() const;
const std::vector<glm::dvec3> getControlPoints() const; // TODO: remove this debugging function