不是計算角度只是將框架推入模型視圖矩陣。 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