title: How to make a b-spline cubic curve with 4 points in C# Unity
body: <p>I need to calculate a 4-point cubic non-uniform B-Spline (p0, p1, p2, p3) that interpolates p0 and p3.</p>
  
  <p>Until Now I was able to make the function calculate the curve but I don't know how to add the multiplicity at points p0 and p3 to do the interpolation. The code created until now is as follows.</p>
  
  <pre><code>private Vector2 CalculaB_Spline(float t, Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3)
  {
      //(t)=0×B0(u−2)−1×B1(u−2)+1×B2(u−2)+2×B3(u−2)
      float tt = t * t;
      float ttt = t * t * t;
      float u = 1 - t;
      float uuu = u * u * u;
      float q3 = uuu;
      float q2 = 3f * ttt - 6f * tt + 4f;
      float q1 =-3f * ttt + 3f * tt + 3f * t + 1f;
      float q0 = ttt;
      Vector2 p = (p0 * q3 + 
      p1 * q2 +
      p2 * q1 +
      p3 * q0) ;
      p /= 6;
      return p;
  }
  </code></pre>
  
  <p>I hope to be able to use this function to do a C2 continuity by joining with a grade 5 Bezier curve.</p>