問題描述
我想實現一個貝塞爾曲線.我以前在 C# 中做過這個,但我完全不熟悉 C++ 庫.我應該如何創建二次曲線?
I'd like to implement a Bézier curve. I've done this in C# before, but I'm totally unfamiliar with the C++ libraries. How should I go about creating a quadratic curve?
void printQuadCurve(float delta, Vector2f p0, Vector2f p1, Vector2f p2);
顯然我們需要使用線性插值,但標準數學庫中是否存在這種方法?如果沒有,我在哪里可以找到它?
Clearly we'd need to use linear interpolation, but does this exist in the standard math library? If not, where can I find it?
我使用的是 Linux.
I'm using Linux.
推薦答案
您之前是否使用過 C# 庫?
Did you use a C# library earlier?
在 C++ 中,沒有貝塞爾曲線的標準庫函數可用(目前).你當然可以推出自己的(CodeProject sample)或尋找數學圖書館.
In C++, no standard library function for Bezier curves is available (yet). You can of course roll your own (CodeProject sample) or look for a math library.
這篇 博文很好地解釋了這個想法,但在 Actionscript 中.翻譯應該沒有太大問題.
This blogpost explains the idea nicely but in Actionscript. Translation should not be much of a problem.
這篇關于如何在 C++ 中實現貝塞爾曲線?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!