IanniX can manage curves composed of line segments. But we can also manage bezier curves.
When you draw curve with the freehand tool, we sample the mouse and construct a curve with line segments. But we’re sure there is a mathematical tip to make a smooth curve (thanks to bezier curves).
Input : a set of 2D-points
Output : a set of 2D-points with cubic-bezier control (so one 2D-point for point position and two 2D-points for bezier control).
Does somebody have an idea?
I am not a math-guy, but I sure enjoyed viewing the animations on this page: Bézier curves. The External Links section seems to point to possible sources of algorithms, some of which might be in code-form. I don’t know if code is what you’re asking for, Guillaume, but that jsDraw2d library might be useful for design ideas, even though it’s not C/C++.
I suppose a C/C++ library that wraps OpenGL would be what you’re looking for, optimally. Given that drawing smooth curves is such a core problem, there must be a GPL’ed library out there already.
Cheers,
–Bob
Do you still need a way to smoothly connect Bezier curves?
Here is an article on how to do this, along with open source code implementing it.
http://www.codeproject.com/KB/graphics/ClosedBezierSpline.aspx
I hope this helps.
Hi!
Yeah I still need these kind of stuff. The link of AvantGuy was cool, but the translation from JS to C++ was not easy (and need timmmmmme :)).
I’ve bookmarked your link and have a look in further weeks.
Thanks a lot!
No problem. I found that article while researching for my own path-following music project.
I just remembered that the above article is about creating closed curves. You probably also want to be able to make open ended smooth Bezier curves. Here is the companion article that covers open curves:
© IanniX Association
Qu'est-ce que IanniX ? | Téléchargement | Showcase | Forum | Recherche | À propos
Cookie | Durée | Description |
---|---|---|
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |