It’s 3D.
Yes, I’m using bezier curves. I bend the cylinder like a bezier curve.
template< class T, class U >
static FORCEINLINE_DEBUGGABLE T CubicInterp( const T& P0, const T& T0, const T& P1, const T& T1, const U& A )
{
const float A2 = A * A;
const float A3 = A2 * A;
return (T)(((2*A3)-(3*A2)+1) * P0) + ((A3-(2*A2)+A) * T0) + ((A3-A2) * T1) + (((-2*A3)+(3*A2)) * P1);
}
Direction (normal=red arrow) I calculate as the first derivative of the bezier curve equation.
template< class T, class U >
static FORCEINLINE_DEBUGGABLE T CubicInterpDerivative( const T& P0, const T& T0, const T& P1, const T& T1, const U& A )
{
T a = 6.f*P0 + 3.f*T0 + 3.f*T1 - 6.f*P1;
T b = -6.f*P0 - 4.f*T0 - 2.f*T1 + 6.f*P1;
T c = T0;
const float A2 = A * A;
return (a * A2) + (b * A) + c;
}
I can find cross product direction (normal=red arrow) and the global UP vector, which will give me a some orthogonal vector.
I still can’t add volume or thickness to the spline after deformation.