Avoid checking agains espilon at the end of curve interpolation

For long paths this epsilon corresponds to a large portion of the curve and will result in clipping to the start and/or end state
This commit is contained in:
Emma Broman
2020-11-05 11:44:12 +01:00
parent c860e0ce49
commit 3b08862fc6
2 changed files with 4 additions and 6 deletions

View File

@@ -38,7 +38,6 @@
namespace {
constexpr const char* _loggerCat = "AvoidCollisionCurve";
const double Epsilon = 1E-7;
const double CloseToNodeThresholdFactor = 5.0;
const double AvoidCollisionDistanceFactor = 3.0;
@@ -112,10 +111,10 @@ AvoidCollisionCurve::AvoidCollisionCurve(const Waypoint& start, const Waypoint&
// Interpolate a list of control points and knot times
glm::dvec3 AvoidCollisionCurve::interpolate(double u) {
if (u < Epsilon) {
if (u <= 0.0) {
return _points[1];
}
if (u > (1.0 - Epsilon)) {
if (u > 1.0) {
return *(_points.end() - 2);
}

View File

@@ -38,7 +38,6 @@
namespace {
constexpr const char* _loggerCat = "ZoomOutOverviewCurve";
const double Epsilon = 1E-12;
} // namespace
@@ -94,9 +93,9 @@ ZoomOutOverviewCurve::ZoomOutOverviewCurve(const Waypoint& start, const Waypoint
}
glm::dvec3 ZoomOutOverviewCurve::interpolate(double u) {
if (u < Epsilon)
if (u <= 0.0)
return _points[0];
if (u > (1.0 - Epsilon))
if (u > 1.0)
return _points.back();
return interpolation::piecewiseCubicBezier(u, _points, _parameterIntervals);