If you have not read my Easy as 1-2-3-4 page, please read it first. This page is an explanation of how the value of kappa is derived mathematically.
We want to be able to approximate a circle using cubic (or actually bicubic) Bézier curves. To do that, we separate the circle into four arcs and draw each of them separately.
We will only consider the upper right segment (the arc from point A to point B in the above picture) because that way we do not have to deal with negative numbers.
Please note that the angle AOB is 90 degrees, the Bézier control line AA' is horizontal, and the Bézier control line BB' is vertical. The radius r of the circle is the length of the lines OA, OB, as well as OC. The length l of AA' and BB' is unknown, however, it can be expressed as l = r * kappa, where kappa is a constant. No value of kappa will allow us to draw a true arc, but we will get the closest to one visually if we select the point C on the curve AB such that its x and y coordinates are the same as they would be on a true circular arc if the angles AOC and COB equal 45 degrees, and the point C lies exactly in the middle of the curve AB (that is it lies at u = 0.5).
To simplify our calculation, let us decide that r = 1 and the coordinates of O = [0, 0]. In that case, l = kappa, so the coordinates of the four points defining the Bézier curve are:
A = [0, 1] A' = [kappa, 1] B' = [1, kappa] B = [1, 0]
From the definition of a bicubic Bézier curve we know that the coordinates of any point P on the curve AB is this function of u:
P(u) = A * (1 - u)³ + A' * 3u(1 - u)² + B' * 3u²(1 - u) + B * u³
Since point C lies at u = 0.5, and since 1 - 0.5 = 0.5 (and since 0.5 = 1/2), the equation of C is:
C = A/8 + 3A'/8 + 3B'/8 + B/8
The x coordinate of C equals the y coordinate of C. Let us call its value c. From the Pythagorean theorem we can calculate its value:
c² + c² = 1² 2c² = 1
And since all of our coordinates are non-negative, c = sqrt(1/2), which is mathematically the same as sqrt(2)/2. Now, we can solve the equation of C for x:
0/8 + 3 * kappa/8 + 3/8 + 1/8 = sqrt(2)/2 3 * kappa/8 + 4/8 = sqrt(2)/2 3 * kappa/4 + 4/4 = sqrt(2) 3 * kappa/4 + 1 = sqrt(2) 3 * kappa/4 = sqrt(2) - 1 3 * kappa = 4 * (sqrt(2) - 1) kappa = 4 * (sqrt(2) - 1) / 3
We would get the same result if we had solved the equation of C for y. It is trivial to repeat the same calculation for any r:
0r/8 + 3r * kappa/8 + 3r/8 + r/8 = r * sqrt(2)/2 3r * kappa/8 + 4r/8 = r * sqrt(2)/2 3 * kappa/4 + 4/4 = sqrt(2) 3 * kappa/4 + 1 = sqrt(2) 3 * kappa/4 = sqrt(2) - 1 3 * kappa = 4 * (sqrt(2) - 1) kappa = 4 * (sqrt(2) - 1) / 3
Because the four arcs are mirror images of each other about the x and/or y axes, the only difference between them is in the sign. But the value of kappa is constant.
Copyright © 2005 G. Adam Stanislav
All rights reserved
Click on the button to buy Michael Mortenson’s Geometric Transformations (an excellent book!), or to search for similar books.