Working on 3d tube extrusion along a Bezier path in 3d space using C# and have come to an impasse. I have integrated GLMSharp for vectors, dot, cross and normal etc.. I'm unsure how to create an Up Vector and whether that's the problem. I am outputting to .3ds format and the following image shows gaps or twists in some cases. I am inquiring for a solution.

```
//  frenet serret code
void get_circle(int i, double theta, float[,] mmp, float[] p1, float[] p2, float rad,float[] cen)
{
    float[] n = new float[3];

    vec3 tp1 = new vec3(p1[0], p1[1], p1[2]);
    vec3 tp2 = new vec3(p2[0], p2[1], p2[2]);

    vec3 T = (tp2 - tp1);
    T = T.Normalized;

    vec3 B = vec3.Cross(T, tp2 + tp1);
    B = B.Normalized;

    vec3 N = vec3.Cross(B, T);

    N = N.Normalized;

    float x = (float)Math.Cos(theta)*rad;
    float y = (float)Math.Sin(theta)*rad;

    vec3 vertex = tp1 + B * x + N * y;

    mmp[i,0] = cen[0] + vertex.x;
    mmp[i,1] = cen[1] + vertex.y;
    mmp[i,2] = cen[2] + vertex.z;
}

```

[twists or gaps](https://i.stack.imgur.com/2vfZz.gif)