move clamp to bezier itself to prevent deadlocks

This commit is contained in:
itsmattkc
2020-11-23 08:43:02 +11:00
parent 60f515a2cc
commit 7b266c51a4
2 changed files with 6 additions and 2 deletions
+5
View File
@@ -22,6 +22,8 @@
#include <QtMath>
#include "common/clamp.h"
namespace olive {
double Bezier::QuadraticXtoT(double x, double a, double b, double c)
@@ -38,6 +40,9 @@ double Bezier::CubicXtoT(double x_target, double a, double b, double c, double d
{
const double tolerance = 0.0001;
// Clamp to prevent deadlocks
x_target = clamp(x_target, a, d);
double lower = 0.0;
double upper = 1.0;
+1 -2
View File
@@ -26,7 +26,6 @@
#include <QStyleOptionGraphicsItem>
#include "common/bezier.h"
#include "common/clamp.h"
#include "common/lerp.h"
#include "nodeview.h"
#include "nodeviewscene.h"
@@ -153,7 +152,7 @@ void NodeViewEdge::SetPoints(const QPointF &start, const QPointF &end, bool inpu
y4 = start.y();
}
double t = Bezier::CubicXtoT(clamp(continue_x, x1, x4), x1, x2, x3, x4);
double t = Bezier::CubicXtoT(continue_x, x1, x2, x3, x4);
double y = Bezier::CubicTtoY(y1, y2, y3, y4, t);
angle = qAtan2(end.y() - y, end.x() - continue_x);