nodeview: clamp bezier value
This commit is contained in:
@@ -36,7 +36,7 @@ double Bezier::QuadraticTtoY(double a, double b, double c, double t)
|
||||
|
||||
double Bezier::CubicXtoT(double x_target, double a, double b, double c, double d)
|
||||
{
|
||||
double tolerance = 0.0001;
|
||||
const double tolerance = 0.0001;
|
||||
|
||||
double lower = 0.0;
|
||||
double upper = 1.0;
|
||||
@@ -51,7 +51,7 @@ double Bezier::CubicXtoT(double x_target, double a, double b, double c, double d
|
||||
upper = percent;
|
||||
}
|
||||
|
||||
percent = (upper + lower) / 2.0;
|
||||
percent = (upper + lower) * 0.5;
|
||||
x = CubicTtoY(a, b, c, d, percent);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ void NodeViewEdge::SetPoints(const QPointF &start, const QPointF &end, bool inpu
|
||||
y4 = start.y();
|
||||
}
|
||||
|
||||
double t = Bezier::CubicXtoT(continue_x, x1, x2, x3, x4);
|
||||
double t = Bezier::CubicXtoT(clamp(continue_x, x1, x4), 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