next up previous contents
Next: cubic Bézier curve Up: quadratic Bézier curve Previous: control points choice   Contents


error estimation

Since both the arc and the approximation can be described by parametric equations $ B_2(t)$ and $ E(\eta)$, we could try to find for each point $ B_2(t)$ the closest point $ E(\eta_t)$ such that $ d\left(B_2(t),E(\eta_t)\right) =
\min_{\eta}\{d\left(B_2(t),E(\eta)\right)\}$ and to use this $ t\leftrightarrow\eta_t$ mapping to find the maximal error along the elliptical arc $ \varepsilon_2 =
\max_t\{d\left(B_2(t),E(\eta_t)\right)\}$. This method is accurate, but involves lots of computation. A more practical method consist in building once and for all an analytical model $ \tilde{\varepsilon}_2(a, b, \eta_1,\eta_2)$ approximating $ \varepsilon_2$ and use it.

We first compute the true error by embedding two equation solvers. The first solver is used to compute $ \eta_{t}$ for any given $ t$ (in other words it performs the mapping), using a specific algorithm described in another paper. The second solver is used to find the value of the $ t$ parameter which leads to the maximal error. It is necessary to use very robust algorithms for this purpose, because the notion of closest point is not continuous, so $ \eta_{t}$ seen as a function of $ t$ is not continuous. A trivial example is given by a point $ P(t)$ traveling along the minor axis. When this point crosses the ellipse center, $ \eta_{t}$ jumps from $ -\pi/2$ to $ +\pi/2$. The distance to the closest point, however, is continuous, only its first derivative is discontinuous. These embedded solvers allow us to compute for $ \varepsilon_2$ for any arc, its value depend on $ a$, $ b$, $ \eta_1$ and $ \eta2$.

The next step involves identifying the behaviour of the error when the various parameters change. Using the semi major axis as a scaling parameter and plotting some curves, we first identify canonical parameters: the error model will be :

(9) $\displaystyle \tilde{\varepsilon}_2 = a \times f(b/a,\eta,\Delta\eta)$

where

    $\displaystyle \eta=\frac{\eta_1+\eta_2}{2}$   and$\displaystyle \quad \Delta\eta=\eta_2-\eta_1$

For $ \Delta\eta$ between $ 1/20$ and $ \pi/2$, the error appears to be almost a power of $ \Delta\eta$, so we refine our model:

(10) $\displaystyle f(b/a,\eta,\Delta\eta) = e^{c_0(b/a,\eta)+ c_1(b/a,\eta)\Delta\eta}$

This behaviour seems to be valid also outside of the given interval. However, if $ \Delta\eta$ gets too small, some numerical problems prevent from computing accurately the very tiny real errors. This interval should be compliant with classical needs.

For symmetry reasons, it is sufficient to study the behaviour of the origin and slope functions $ c_0$ and $ c_1$ for $ \eta$ between 0 and $ \pi/2$. The functions decrease from a maximum value at 0 to a minimum value at $ \pi/2$. The peak near the maximum can be very sharp for flat ellipses ($ b\ll a$). This is because the curvature is very important and changes rapidly near the semi major axis ends. We will use several functions $ \cos(2k\eta)$ to represent this behaviour. Our model becomes:

(11) $\displaystyle c_i(b/a,\eta) = \sum_{j=0}^{j=3}r_{i,j}(b/a)\cos(2j\eta)$

Finally, the coefficients functions $ r_{k,i}$ present various asymptotic behaviours when $ b/a$ varies from 0 to 1. In order to get a good fit, we describe the functions as rational functions with a quadratic numerator and linear denominator:

(12) $\displaystyle r_{i,j}(b/a)= \frac{\mu_{i,j,0}\left(\frac{b}{a}\right)^2 +\mu_{i,j,1}\left(\frac{b}{a}\right) +\mu_{i,j,2}} {\left(\frac{b}{a}\right)+\mu_{i,j,3}}$

In fact, two sets of $ \mu_{i,j,k}$ coefficients were used, one set for $ b/a$ between 0 and $ 1/4$, and one set for $ b/a$ between $ 1/4$ and $ 1$. The coefficients are given by tables 1 and 2.

These coefficients were computed by curve fitting means. This imply that for some points $ (b/a,\eta,\Delta\eta)$ this model gives errors larger than the real ones, and at other points it gives smaller errors ( $ \varepsilon_{2,\text{min}} \le \tilde{\varepsilon}_2 \le
\varepsilon_{2,\text{max}}$). Multiplying this least square model by a suitable safety rational fraction $ s(b/a)$, we obtain an upper bound of the error: $ \varepsilon_2 \le s(b/a)\tilde{\varepsilon}_2$.

% latex2html id marker 1483
\framebox[0.9\textwidth]{\parbox{0.85\textwidth}{%%
...
...-quadratic-low} and
\ref{table:coeffs-quadratic-high}}}<tex2html_comment_mark>18

This bound correctly overestimates the error, but is not too conservative. The cumulative distribution function of $ \varepsilon_2/(s(b/a)\tilde{\varepsilon}_2)$ is quite smooth and the mean value of the ratio is $ 0.538$.


Table 1: error coefficients for quadratic Bézier $ (0 < b/a < 1/4)$
$ i$ $ j$ $ \mu_{i,j,0}$ $ \mu_{i,j,1}$ $ \mu_{i,j,2}$ $ \mu_{i,j,3}$
0 0 3.92478 -13.5822 -0.233377 0.0128206
0 1 -1.08814 0.859987 0.000362265 0.000229036
0 2 -0.942512 0.390456 0.0080909 0.00723895
0 3 -0.736228 0.20998 0.0129867 0.0103456
1 0 -0.395018 6.82464 0.0995293 0.0122198
1 1 -0.545608 0.0774863 0.0267327 0.0132482
1 2 0.0534754 -0.0884167 0.012595 0.0343396
1 3 0.209052 -0.0599987 -0.00723897 0.00789976


Table 2: error coefficients for quadratic Bézier $ (1/4 \le b/a \le 1)$
$ i$ $ j$ $ \mu_{i,j,0}$ $ \mu_{i,j,1}$ $ \mu_{i,j,2}$ $ \mu_{i,j,3}$
0 0 0.0863805 -11.5595 -2.68765 0.181224
0 1 0.242856 -1.81073 1.56876 1.68544
0 2 0.233337 -0.455621 0.222856 0.403469
0 3 0.0612978 -0.104879 0.0446799 0.00867312
1 0 0.028973 6.68407 0.171472 0.0211706
1 1 0.0307674 -0.0517815 0.0216803 -0.0749348
1 2 -0.0471179 0.1288 -0.0781702 2.0
1 3 -0.0309683 0.0531557 -0.0227191 0.0434511


next up previous contents
Next: cubic Bézier curve Up: quadratic Bézier curve Previous: control points choice   Contents
Luc Maisonobe 2005-05-29