# Fly 3D

## Unraveling Beziér Splines (转载)

Unraveling Beziér Splines
by Justin Reynen

Bezier曲线的数学原理

1 = t + (1 - t)

T为任意值等式都成立，但是我们所关注的T值是在0和1之间。

1^2 = (t + (1 - t))^2

1 = t^2 + 2*t*(1-t) + (1-t)*(1-t)

#define B1(t)          (t*t)

#define B2(t)          (2*t*(1-t))

#define B3(t)          ((1-t)*(1-t))

typedef struct sCPoint

{

int x;

int y;

}  C_POINT;

C_POINT controlP[3];

//Note: it is assumed that each controlP has already been filled out with

//an x and y coordinate.

double count;  //used as our counter

double detailBias; //how many points should we put on our curve.

double x,y; //used as accumulators to make our code easier to read

detailBias = 1 / 50; //we'll put 51 points on out curve (0.02 detail bias)

do

{

x = controlP[0].x*B1(count) + controlP[1].x*B2(count) + controlP.x[2]*B2(count);

y = controlP[0]*B1.y(count) + controlP[1].y*B2(count) + controlP.y[2]*B2(count);

PutPixel(x,y,RGB(255,255,255));

count += detailBias;

}while( count <= 1);

C_POINT points[5][5];

In Conclusion

Pro's:

Con's:

(happykevins译)

posted on 2009-12-19 11:01 陈翔飞 阅读(199) 评论(0)  编辑 收藏 引用 所属分类: 计算机图形学