我想將2d形狀輪廓附加到樣條曲線。在樣條中的某些點處,我會在圖像中顯示幾何體中奇怪的扭曲僞像。我怎樣才能避免使用Frenet-Frame方程?避免扭曲樣條曲線中的僞像[OpenGL,C++]
我爲正常,副法線和切線電流計算:
forward_tangent_vector = glm::normalize(pointforward - pointmid);
backward_tangent_vector = glm::normalize(pointmid - pointback);
second_order_tangent = glm::normalize(forward_tangent_vector - backward_tangent_vector);
binormal = glm::normalize(glm::cross(forward_tangent_vector,second_order_tangent));
normal = glm::normalize(glm::cross(binormal, forward_tangent_vector));
//translation matrix
T = glm::translate(T, pointmid);
normal_axis = glm::vec3(0, 1, 0);
rotationAxis = glm::cross(normal_axis, forward_tangent_vector);
rotationAngle = glm::acos(glm::dot(normal_axis, forward_tangent_vector));
//rotation matrix
R = glm::rotate(R, glm::degrees(rotationAngle), rotationAxis);
那麼問題是我不能確保曲線將C2連續。該曲線由可能或不可以提供C2連續曲線的算法生成。一旦我有了'tbn'矩陣,我該如何改變這些圓形輪廓的基礎(二維形狀)。 – jaykumarark
只需將頂點與此矩陣相乘即可。另外不要忘了將原點翻譯成Frenet-frame的原點。 –