This was just a cute little experiment in using Three.js for the first time. I implemented three dimensional Bézier curves of arbitrary order. Instead of calculating the points in the curve and then rendering, the above program takes in a set of points and displays the parameterization of the curve in real time. The implementation is recursive, in that a Bézier curve of n points consists of Bézier curves of n-1 points, where a Bézier curve of two points is simply a line. By default, the animation above generates 20 random points in space and shows the generation of the Bézier curve (the red line), and all of the parameterized lines which the curve uses as reference. To get a better understanding of how Bézier curves can be generated, there's a great animation here.

In the controls in the top right of the animation, you can toggle the fixed lines between the input points which uniquely define the curve, the parameterized intermediate lines, the parameterized points, the Bézier curve itself, as well as the "intermediate curves", which are the curves generated by the children of the parent Bézier curve. Moving the slider will randomly generate a new set of points of a certain number and use them to animate a new Bézier curve.