Approximation of Circular Arcs by Parametric Polynomials Emil Žagar Lecture on Geometric Modelling at Charles University in Prague December 6th 2017 1 / 44
Outline Introduction Standard Reprezentations of Circular Arcs Naive Parametric Polynomial Approximation Bézier Curves Approximation of Circular Arcs by Bézier Curves 2 / 44
Introduction Basic question: what is a circle (circular arc)? A set of points in the plane at a fixed (constant) distance from a particular point (center). Planar curve which has a constant (nonzero) curvature. One of the conic section curves. A solution of the ordinary differential equation... y (y q) + (x p) = 0, p, q R. 3 / 44
We shall consider a cricular arc as a planar parametirc curve. Parameterization of a planar curve: a (smooth) map r of the closed interval I R to R 2 : r : I R 2, r 0, r(t) = (x(t), y(t)) T, x, y : I R. There are infinitely many parameterizations (just consider reparameterization; compositum of the original parameterization by smooth (bijective) map ρ : J R I ). 4 / 44
As simple as possible parameterizations are required in practice polynomial, rational,... Unfortunately: the whole circle can not be parameterized by parametric polynomials. Almost the whole circle can be represented as rational curve. Polynomial parameterizations are still quite popular in industry. So we need good parametric polynomial approximations of circular arcs. 5 / 44
Standard Reprezentations of Circular Arcs Consider unit circle centered at O(0, 0). Explicit representation: y(x) = ± 1 x 2, 1 x 1. Advantages: simple evaluation, simple plotting,... Disadvantage: not a single formula describing the whole object. 6 / 44
Implicit representation: x 2 + y 2 1 = 0. Advantages: simple formula for a whole object, easy check if the point is on the curve,... Disadvantage: complicated plotting. Parametric representation shares some nice properties of explicit and implicit representation. 7 / 44
Standard parametric representation of circular arc: x(ϕ) = cos ϕ, y(ϕ) = sin ϕ, ϕ [ α, α], α [0, π]. 0.8 0.6 0.4 0.2 0 0.2 0.4 0.6 0.8 1 0.5 0 0.5 1 Figure: Parameterization of the unit circular arc given by the central angle 2 π/3. 8 / 44
Naive Parametric Polynomial Approximation Componentwise approximation. One possibility is right at hand: Taylor expansion around ϕ = 0): x(ϕ) p n (ϕ), y(ϕ) q n (ϕ), where p n (ϕ) = q n (ϕ) = n ( 1) k ϕ2k (2k)!, n ( 1) k ϕ 2k+1 (2k + 1)!. k=0 k=0 Disadvantage: a lot of terms required for larger angles (n 1). 9 / 44
Figure: Approximation of the circular arc given by the central angle 2 π/3. Taylor approximants: degree 2 (red), degree 3 (purple), degree 4 (black). 10 / 44
We consider the curve componentwise. Components of the circular arcs are connected, x 2 + y 2 1, e.g.,... We should use the approach where we consider that components are not independent. A usual aprroach: Bézier curves. 11 / 44
Bézier curves For a given sequence of planar points {P j } n j=0 define b(t) = n P j Bj n (t), t [0, 1], j=0 where B n j (t) := are Bernstein polynomials. ( ) n t j (1 t) n j, j = 0, 1,..., n, j The curve b obtained is so called planar Bézier curve. Points {P j } n j=0 are control points, and the polygon given by the control points is control polygon. 12 / 44
Figure: Bézier curve of degree 4 (red) given by control points (black) and control polygon (blue). 13 / 44
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Figure: Basis Bernstein polynomials of degree 4 (B 4 0 red, B4 1 green, B 4 2 blue, B4 3 black and B4 4 pink). 14 / 44
Independently developed by P.E. Bézier 1 and P. de Casteljau 2. Extremely popular in computer era. Basic tool in CAGD(Computer Aided Geometric Design): animations, car industry, aircraft industry, modelling in general,... Can be generalized to surfaces and solids. 1 Pierre Étienne Bézier, 1910-1999, french engineer at Renault. 2 Paul de Faget de Casteljau, 1930-1999, french engineer at Citroën. 15 / 44
Important properties: The first and the last control points are interpolatory: b(0) = P 0, b(1) = P n. Tangent vectors at the first and at the last control point are b (0) = n(p 1 P 0 ), b (1) = n(p n P n 1 ). Convex hull property: the whole curve is in the convex hull of the control points. 16 / 44
If j-th control point is moved by the vector v, the curve is moved by B n j (t) v. Variation diminishing property: the number of the intersections of the curve by a line is bounded by the number of intersections of the same line by the control polygon. The curve is affine invariant (PostScript).... 17 / 44
Figure: ( ) The third control point of the Bézier curve is moved by 1 v =. 1 18 / 44
Figure: Variation diminishing property. 19 / 44
Figure: Anticlockwise rotation of the Bézier curve by 90 around the first control point. 20 / 44
Figure: Scaling of the Bézier curve by factor 2. 21 / 44
Approximation of Circular Arcs by Bézier Curves Consider polynomial approximant p n : [0, 1] R 2 of degree n of the circular arc in Bézier form. In contrast to Taylor approximation we can easily interpolate boundary points of the arc. Thus: p n (t) = n P j Bj n (t), j=0 kjer je P 0 = [cos ϕ, sin ϕ] T in P n = [cos ϕ, sin ϕ] T. 22 / 44
We use the property of the derivative at the boundary points: p (0) = d [sin ϕ, cos ϕ] T p (1) = d [ sin ϕ, cos ϕ] T. The free parameter d 0 is a shape parameter or geometric continuity of the first order parameter (the direction of the tangent is prescribed, but not the magnitude). Due to the symmetry d is the same for both tangents and also control points are symmetric. 23 / 44
P n d P n 1 P 1 d P 0 Figure: Control points of the Bézier approximant if geometric continuity at the boundary points is required. 24 / 44
The parameter d and control points (P 2,..., P n 2 ) can be used as shape parameters. Several possibilities: minimization of the deviation of the approximant from the circular arc, optimal curvature profile, approximation of the arc-length,... The minimization of the deviation will be considered here. 25 / 44
Distance Between Parametric Curves. Easy question: How to measure a distance between parametric curves? Not so easy as in functional case. Different parameterizations. One possibility: just measure distance between sets of points (Hausdorff distance). Let X and Y be given sets and d a metric on X Y : { } d H (X, Y ) = max sup inf d(x, y), sup inf d(x, y) x X y Y y Y x X 26 / 44
Figure: Hausdorff distance between X and Y (source: Wikipedia). Disadvantage: huge time complexity even in discrete case. 27 / 44
Consider two curves p : I R 2, q : I R 2 ; naive approach: Example Take p, q : [0, 1] R 2, where d(p, q) = max p(t) q(t) 2. t I p(t) = [t, t] T, q(t) = [1 t, 1 t] T, Then What is wrong here? max p(t) q(t) 2 = 2. t [0,1] 28 / 44
Parametric distance: p : I R 2, q : J R 2. d(p, q) = inf φ where φ : I J in a bijection. max p(t) (q φ) (t) 2, t I Obviously Hausdorff distance is smaller than parametric. So max p(t) (q φ) (t) 2, for particular φ, t I is an upper bound for Hausdorff distance. 29 / 44
Problem: How to chose an appropriate φ? How to determine a required maximum? In some special cases parametric distance can be simplified. Radial distance for circular arcs. The distance between circular arc and parametric curve p = [x, y] T is measured in radial direction. x(t) 2 + y(t) 2 1 1 2 x(t) 2 + y(t) 2 1. 30 / 44
Approximation by Quadratic Curve Find an appoximant of the form p 2 (t) = 2 P j Bj 2 (t) = P 0 (1 t) 2 + P 1 2t(1 t) + P 2 t 2. j=0 Clearly: P 0 = [cos ϕ, sin ϕ] T, P 2 = [cos ϕ, sin ϕ] T. Simple geometry implies P 1 = [sec ϕ, 0] T. No additional free parameters to be used. 31 / 44
Figure: Approximation of circular arc (blue dashed) by quadratic Bézier curve (red). 32 / 44
Let e ϕ := max p(t) 2 2 1. t [0,1] We are interested in e ϕ as a function of ϕ. It is easy to see e ϕ = max p(t) 2 2 1 = p2 (1/2) 2 2 1. t [0,1] Some further derivation implies e ϕ = sin4 ϕ 4 cos 2 ϕ = ϕ4 4 + ϕ6 12 + O ( ϕ 8). 33 / 44
Asymptotic approximation order is 4. The same is true also for Taylor approximants of degree 2. But we did a progress in interpolating two points and two tangent directions. Can we do better using Bézier curves of degree 3? 34 / 44
Approximation by Cubic Curve Let 3 p 3 (t) = P j Bj 3 (t). j=0 Basic properties of Bézier curves imply P 0 = [cos ϕ, sin ϕ] T, P 1 = [cos ϕ, sin ϕ] + d [sin ϕ, cos ϕ] T, P 2 = [cos ϕ, sin ϕ] + d [sin ϕ, cos ϕ] T, P 3 = [cos ϕ, sin ϕ] T. 35 / 44
P 3 d P 2 P 1 d P 0 Figure: Sketch of an approximation by cubic Bézier curve. 36 / 44
We are free to choose a parameter d. Different choices imply different approximants. One possibility is to choose d in a way that we minimize e ϕ := max p3 (t) 2 2 1. t [0,1] This can be done in several ways: one can, e. g., require p 3 (1/2) 2 2 1 = 0. 37 / 44
Figure: Several approximations of circular arc given by central angle 2π/3 (blue dashed) by cubic Bézier curve: d = 4/3 tan(ϕ/2) (red), d = 1/2 (magenta) and d = 3/2 (black). 38 / 44
Figure: Approximation of circular arc given by central angle ϕ = 5 π/3. 39 / 44
We can generalize this approach to approximants od higher order. Analysis of the existence of the solution is much more complicated. Systems of nonlinear equations appear. Open problem: for each n N there exists a Bézier curve of degree n, which interpolates two points and two tangent directions. Its approximation order is 2 n. 40 / 44
Approximants of particular segments can be put together. The results are splines. For circular arcs it is very easy, since only rotations of segments for 2 ϕ are required. The resulting spline is G 1 continuous, sometimes even G 2 continuous. 41 / 44
42 / 44
Figure: Approximation of a whole circle by cubic spline of four pieces. The parameter d is not chosen optimally.the outer spline corresponds to d which is to large, and the inner spline corresponds to d which is to small. 43 / 44
Any questions? 44 / 44