Bézier and Julia

In the 80ies and 90ies, it was common practice to call things with the prefix Computer Aided. Similar to what we see nowadays with the suffix as Code or as a Service. Today there is Infrastructure as Code, Policy as Code, Sofware as a Service, Platform as a Service and so on. Back then, there was Computer Aided Manufacturing (CAM), Computer Aided Engineering (CAE) and most important Computer Aided Design (CAD). In the 60ies, two french car manufacturer's engineers, namely Pierre Bézier from Renault and Paul de Casteljau from Citroen developed, independently [1], a very important tool for the CAD world, called the Bézier curves. Pierre Bézier was born in 1910 in Paris, France and studied mechanical and electrical engineering. While working on a software called UNISURF, he developed the Bézier curves. As the he patented and correspondingly published the work in 1968, they have been named after him [2]. Probably another reason for filing patents and why they are relevant for engineers.

Working with Bézier curves only by dragging and dropping points, for example in PowerPoint, it may seem tricky and annoying to use sometimes. But a closer look into their mathematical description makes it first visible, that they are really not that complicated and second, it gives some hints how to draw them. In the end, it is just a function with a parameter t that varies between 0 and 1. In a two dimensional form it is straightforward. Nevertheless, those curves are the basics before handling more complex structures called Non-uniform rational B-Splines (NURBS) which are used in Computer Generated Imagery (CIG). Splines are chains of partwise defined polynoms. Together with Casteljau, Isaac Jacob Schönberg and Carl de Boor, Bézier is one of the inital idea generator in this area [3]. Besides that they are used for drawing letters with SVG like this impressive example for the old Icelandic letter forms.

The advantage with Bézier curves, is the mathematical description of an elegant curve, as it were Curves as Code. The points P on the curve are declared with coordinates xp and yp. A special feature of them is, that the control points are outside of the curve itself. In the below equation, the quadratic Bézier curve has a 2D start point A with coordinates xa and ya , and a 2D end point C with the corresponding coordinates xc and yc. In this quadratic form, there is one control point B with xb and yb which does not lie on the curve.

xp = (1-t)2 xa + 2t(1-t)xb + t2xb yp = (1-t)2ya + 2t(1-t)yb + t2yb

When t=1, then xp becomes xc, here in black at A(1,1). Same holds true for yp = yc. When t=0, then xp becomes xa, here in green at C(6,4). In between, depending on where control point B(7,1) with xb, yb lies, the curve moves into that direction. One could imagine the control point like a point of gravity when walking from start point A to end point C. The Julia code for this video is placed in a Jupyter Notebook. There, Julia's Dot-Syntax for vectorizing functions is applied to calculate the x and y values for points on the Bézier curve.

[1] Wikipedia: Béziere curve
[2] Wikipedia: Pierre Béziere
[3] Wikipedia: B-Splines