Spline curves originate from flexible strips used to create smooth curves in traditional drafting applications. Much like Bezier curves they are formed mathematically from piecewise approximations of cubic polynomial functions with zero, first and second order continuity. B-Splines are one type of spline that are perhaps the most popular in computer graphics applications, they are defined as follows: If we have N+1 control points Pk we can derive a continuous function P(v) as where N(v) are called blending functions, uk are known as break points, where they occur on the curve are known as knots. There are a number of possible options for the knot positions, for example a uniform spacing where uk = k. More commonly the following function is chosen </span></div>

#include <conio.h>
#include <graphics.h>
#include <iostream.h>

struct point {
    int x, y;
}* p;

void main() {
    int n;
    int gd = DETECT, gm = VGAHI;
    initgraph( & gd, & gm, "");
    cout << "Enter control points ";
    cin >> n;
    p = new point[n];
    for (int i = 0; i < n; i++) {
        cout << "Enter point P" << i << "(x,y)";
        cin >> p[i].x >> p[i].y;
        circle(p[i].x + getmaxx() / 2, getmaxy() / 2 - p[i].y, 5);
    }
    for (i = 0; i < n - 3; i++) {
        for (float u = 0; u <= 1; u += .01) {
            float x, y;
            x = (1 - u) * (1 - u) * (1 - u) * p[i].x + (3 * u * u * u - 6 * u * u + 4) * p[i + 1].x + (-3 * u * u * u + 3 * u * u + 3 * u + 1) * p[i + 2].x + u * u * u * p[i + 3].x;
            x /= 6;
            y = (1 - u) * (1 - u) * (1 - u) * p[i].y + (3 * u * u * u - 6 * u * u + 4) * p[i + 1].y + (-3 * u * u * u + 3 * u * u + 3 * u + 1) * p[i + 2].y + u * u * u * p[i + 3].y;
            y /= 6;
            putpixel(x + getmaxx() / 2, getmaxy() / 2 - y, 7);
        }
    }
    getch();
}