How do I implement a B#233;zier curve in C++?(如何在 C++ 中实现贝塞尔曲线?)
问题描述
我想实现一个贝塞尔曲线.我以前在 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++ 中实现贝塞尔曲线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 C++ 中实现贝塞尔曲线?
基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
