不是计算角度只是将框架推入模型视图矩阵。 Normal,Binormal和Tangent进入矩阵的左上角3x3,第4列中的平移和元素4,4是1.代替Frenet帧使用已经提到的Bishop帧。因此在代码中:
// assuming you manage your curve in a (opaque) struct Bezier
struct BezierCurve;
typedef float vec3[3];
void bezierEvaluate(BezierCurve *bezier, float t, vec3 normal, vec3 binormal, vec3 tangent, vec3 pos);
void apply_bezier_transform(Bezier *bezier, float t)
{
float M[16]; // OpenGL uses column major ordering
// and this code is a excellent example why it does so:
bezierEvaluate(bezier, t, &M[0], &M[4], &M[8], &M[12]);
M[3] = M[7] = M[11] = 0.;
M[15] = 1.;
glMultMatrixf(M);
}
您确定您正确计算角度和位置吗?没有代码,不能说。 – 2011-06-05 15:12:56