-
Notifications
You must be signed in to change notification settings - Fork 41
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
Drawing Bezier curves #32
Comments
https://www.geeksforgeeks.org/cubic-bezier-curve-implementation-in-c/amp/ Probably a better implementation |
More efficient bezier without use of lerp function
|
Cool, thanks. Looks like that will cause a lot of overdrawing, since the curves are always drawn using 100 lines. |
Yeah I didn’t fine tune the increment of t, but it could probably be incremented by a little more. |
Just to be clear, it's not a performance (as in cycles) issue. The problem with overdrawing is that it does not play well with alpha. I'll look into it for a later update. |
You would need a different implementation to avoid overdraw issues. Just using an arbitrary increment on t is "guessing" that start and endpoints don't overlap. Using a line rasterization algorithm would work: https://zingl.github.io/bresenham.html |
Actually after some though it should be fine, since |
I made a way to draw quadratic and cubic bezier curves, but I'm not going to bother with making a pull request cause of the problem described here that I had earlier for the pr with the circles.
https://stackoverflow.com/questions/37344280/git-diff-is-showing-full-file-has-changed-for-a-single-line-change-but-only-for
Heres the code for the two bezier drawing functions:
I also have a test file attached that shows them in action.
build for that file :
g++ tigr.c test.cpp -o test -lopengl32 -lgdi32 -lWinmm
test.txt
(Made me do it as a txt file for some reason)
The text was updated successfully, but these errors were encountered: