-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: The tension parameter does not have the expected effect on the curve #4120
Comments
In a quick unit test, it seems to ignore the last two points. Is that what you're observing? The last point I believe is intentional, so I'd guess this is a simple off-by-one coding mistake. |
No on the whole, when I adjust the tension from 0 to 1, I see a little movement only in the left (starting of the timeline). The rest of the curve remains more or less unchanged. Secondly, the curve behaves exactly opposite compared to what I expect: More tension actually relaxes the curve. Can I attach a video here? |
You'd have to link it to a video service however GIFs will work. Ok, I took a closer look at the tension behavior and I think "tension" is the wrong description here (or the values are reversed). Inkscape uses node handles and the length of them determines the width of the curve. It's been asked before and I think we could benefit from allowing a true zero length curve to obtain a straight line, but we should also extend to the behavior to be able to control both with option to link (default) and unlink. |
Bingo! I was thinking of InkScape when I made the observations. In InkScape, the handles are not only made longer to simulate the increased tension, but the handles are turned toward the next/previous control point also. Thus as the tension is increased, the curve more and more resembles the linear progression curve. |
Probably a good to-do for @codythecoder, related #2466. Thanks for reporting @raindropsfromsky. |
I tried to add tangents (handles) with their lengths proportionate to the tension.
They do not seem to follow either of the two rules:
|
just a comment |
Yes, any bug fixes need to carefully consider backwards compatibility, but we're not in the business of preserving bugs, so please save the comments for the PRs and the actual testing. |
I've also looked into the logic and found that the tension parameter affects slopes of tangent lines. If tension is 0, every tangent line should be a horizontal line. If it's 1, a tangent line from a point will be parallel to the line which connects two adjacent points. For implementation details, see AutomationPattern::generateTangents and the logic below. lmms/src/core/AutomationPattern.cpp Lines 392 to 400 in 788c990
Here m1 and m2 stands for starting tangent and ending tangent.
FYI, the |
Isn't that one of the problems? If you see my actual graph, the tangents are NOT supposed to be horizontal at any time. This will only work if the peaks and troughs are symmetrical around X-axis (such as point#4 in the graph). That is rarely the case. |
Yes, it may be bad in some(maybe almost every?) situation. Current implementation for tension=0 doesn't look good for me.
As long as we keep using cubic Hermite spline, the only way to change the curve is changing tangents at automation points. Unless LMMS allows discontinuous slope at points for cubic Hermite progression(which is supposed to be have smooth curve IMO), that's almost impossible. |
I think we can use control points for cubic Hermite spline, as well as the Bezier curve in #2466. |
I thought that a higher "Tension" in automation curve should make it look more like linear progression, while a lower tension should allow a smoother transition between control points. Secondly, I expected this change to occur throughout the length of the curve.
But this is not so, as can be seen from the following samples:
![image](https://user-images.githubusercontent.com/9047168/35040091-ee74b0de-fba5-11e7-862b-9994cf55e9e3.png)
This is the graph with the lowest tension:
This is the same graph, with the highest tension:
![image](https://user-images.githubusercontent.com/9047168/35040075-df889af4-fba5-11e7-9154-02fce06fe80c.png)
But in reality, the following unexpected things happen:
This is as if we have put multiple nails on a board (where the control points are),
and then threaded a string around them.
As we pull the string from left, only its portion on the left experiences the pull.
The text was updated successfully, but these errors were encountered: