Skip to content
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

Evaluation by time doesn't take in account tangents X-axis #1

Open
arkaht opened this issue Apr 30, 2024 · 0 comments
Open

Evaluation by time doesn't take in account tangents X-axis #1

arkaht opened this issue Apr 30, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@arkaht
Copy link
Owner

arkaht commented Apr 30, 2024

The method Curve::evaluate_by_time doesn't take in account the X-axis of tangents, making it useless inside the editor.

As the code suggests, it isn't implemented yet, some tries have been made but the results are not satisfying enough:

// Compute tangents Y-positions
/*const float y1 = p0.y + atan2f( t1.y / m1, t1.x / m1 ) * time_diff * m1 / 3.0f;
const float y2 = p3.y + atan2f( t2.y / m2, t2.x / m2 ) * time_diff * m2 / 3.0f;*/
const float y1 = p0.y + t1.y;
const float y2 = p3.y + t2.y;
return Utils::bezier_interp( p0.y, y1, y2, p3.y, t );

I have looked into Unreal's code and to A Primer on Bézier Curves but I still can't wrap my head around the mathematics behind their implementations to make the tangent weights working as expected.

As a side note, this small yet major change would force any existing timed-based curves to be re-made to correspond to the new behavior.

@arkaht arkaht added enhancement New feature or request help wanted Extra attention is needed labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant