Direct2D通过ID2D1RenderTarget接口支持基本图元(直线,矩形,圆角矩形,椭圆等)的绘制,然而,此接口并未提供对曲线绘制的直接支持。因此,想要使用Direct2D绘制一段通过指定点的曲线,比如Bezier曲线,必须借助于DrawGeometry()方法间接实现。需要通过一定的算法,将指定点转换为定义Path的控制点。幸运的是,codproject上已经有人做了这项工作,给出了相应的转换算法,并给出了C#版的实现:Draw a Smooth Curve through a Se
本文实例为大家分享了OpenGL绘制三次Bezier曲线的具体代码,供大家参考,具体内容如下
计算公式:
运行结果:
代码如下:
#include
#include
#include
#include
#include
using namespace std;
struct Point
{
int x, y;
Point(){};
Point(int tx, int ty)
{
x = tx;
y = ty;
}
};
vector p;
d