move clamp to bezier itself to prevent deadlocks
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user