135 (number): Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>LittleWink
en>EmausBot
m Bot: Migrating 1 interwiki links, now provided by Wikidata on d:Q521294
 
Line 1: Line 1:
In the [[mathematics|mathematical]] field of [[numerical analysis]], '''De Casteljau's algorithm''' is a [[Recursion|recursive]] method to evaluate polynomials in [[Bernstein form]] or [[Bézier curve]]s, named after its inventor [[Paul de Casteljau]]. '''De Casteljau's algorithm''' can also be used to split a single Bézier curve into two Bézier curves at an arbitrary parameter value.
Hello from Denmark. I'm glad to came here. My first name is Harlan. <br>I live in a small city called Kobenhavn K in western Denmark.<br>I was also born in Kobenhavn K 21 years ago. Married in July 2007. I'm working at the backery.<br><br>My homepage - [http://de.mutfak-muhabbet.com/forum/content/step-step-guide-college-amp-bookbyte-coupons-35606 bookbyte discount Coupons]
 
Although the algorithm is slower for most architectures when compared with the direct approach, it is more [[numerically stable]].
 
==Definition==
A Bézier curve ''B'' (of degree ''n'') can be written in Bernstein form as follows
 
:<math>B(t) = \sum_{i=0}^{n}\beta_{i}b_{i,n}(t) </math>,
 
where ''b'' is a [[Bernstein polynomial|Bernstein basis polynomial]]
 
:<math> b_{i,n}(t) = {n \choose i}(1-t)^{n-i}t^i</math>.
 
The curve at point ''t''<sub>0</sub> can be evaluated with the [[recurrence relation]]
 
:<math>\beta_i^{(0)} := \beta_i \mbox{ , } i=0,\ldots,n</math>
:<math>\beta_i^{(j)} := \beta_i^{(j-1)} (1-t_0) + \beta_{i+1}^{(j-1)} t_0 \mbox{ , } i = 0,\ldots,n-j \mbox{ , } j= 1,\ldots,n</math>
 
Then, the evaluation of <math>B</math> at point <math>t_0</math> can be evaluated in <math>n</math> steps of the algorithm. The result <math>B(t_0)</math> is given by :
 
:<math>B(t_0)=\beta_0^{(n)}.</math>
 
Moreover, the Bézier curve <math>B</math> can be split at point <math>t_0</math> into two curves with respective control points :
:<math>\beta_0^{(0)},\beta_0^{(1)},\ldots,\beta_0^{(n)}</math>
:<math>\beta_0^{(n)},\beta_1^{(n-1)},\ldots,\beta_n^{(0)}</math>
 
== Example implementation ==
 
Here is an example implementation of De Casteljau's algorithm in [[Haskell (programming language)|Haskell]]:
<source lang="haskell">
deCasteljau :: Double -> [(Double, Double)] -> (Double, Double)
deCasteljau t [b] = b
deCasteljau t coefs = deCasteljau t reduced
  where
    reduced = zipWith (lerpP t) coefs (tail coefs)
    lerpP t (x0, y0) (x1, y1) = (lerp t x0 x1, lerp t y0 y1)
    lerp t a b = t * b + (1 - t) * a
</source>
 
==Notes==
When doing the calculation by hand it is useful to write down the coefficients in a triangle scheme as
 
:<math>
\begin{matrix}
\beta_0    & = \beta_0^{(0)}    &                  &        &              \\
            &                    & \beta_0^{(1)}    &        &              \\
\beta_1    & = \beta_1^{(0)}    &                  &        &              \\
            &                    &                  & \ddots  &              \\
\vdots      &                    & \vdots            &        & \beta_0^{(n)} \\
            &                    &                  &        &              \\
\beta_{n-1} & = \beta_{n-1}^{(0)} &                  &        &              \\
            &                    & \beta_{n-1}^{(1)} &        &              \\
\beta_n    & = \beta_n^{(0)}    &                  &        &              \\
\end{matrix}
</math>
 
When choosing a point ''t''<sub>0</sub> to evaluate a Bernstein polynomial we can use the two diagonals of the triangle scheme to construct a division of the polynomial
 
:<math>B(t) = \sum_{i=0}^n \beta_i^{(0)} b_{i,n}(t) \mbox{ , } \qquad t \in [0,1]</math>
 
into
 
:<math>B_1(t) = \sum_{i=0}^n \beta_0^{(i)} b_{i,n}\left(\frac{t}{t_0}\right) \mbox{ , } \qquad t \in [0,t_0]</math>
 
and
 
:<math>B_2(t) = \sum_{i=0}^n \beta_i^{(n-i)} b_{i,n}\left(\frac{t-t_0}{1-t_0}\right) \mbox{ , } \qquad t \in [t_0,1]</math>
 
==Example==
We want to evaluate the Bernstein polynomial of degree 2 with the Bernstein coefficients
:<math>\beta_0^{(0)} = \beta_0</math>
:<math>\beta_1^{(0)} = \beta_1</math>
:<math>\beta_2^{(0)} = \beta_2</math>
at the point ''t''<sub>0</sub>.
 
We start the recursion with
:<math>\beta_0^{(1)} = \beta_0^{(0)} (1-t_0) + \beta_1^{(0)}t_0 = \beta_0(1-t_0) + \beta_1 t_0</math>
:<math>\beta_1^{(1)} = \beta_1^{(0)} (1-t_0) + \beta_2^{(0)}t_0 = \beta_1(1-t_0) + \beta_2 t_0</math>
 
and with the second iteration the recursion stops with
:<math>
\begin{align}
\beta_0^{(2)} & = \beta_0^{(1)} (1-t_0) + \beta_1^{(1)} t_0      \\
\            & = \beta_0(1-t_0) (1-t_0) + \beta_1 t_0 (1-t_0) + \beta_1(1-t_0)t_0 + \beta_2 t_0 t_0 \\
\            & = \beta_0 (1-t_0)^2 + \beta_1 2t_0(1-t_0) + \beta_2 t_0^2
\end{align}
</math>
 
which is the expected Bernstein polynomial of degree&nbsp;''2''.
 
==Bézier curve==
When evaluating a Bézier curve of degree ''n'' in 3 dimensional space with ''n''+1 control points '''P'''<sub>''i''</sub>
 
:<math>\mathbf{B}(t) = \sum_{i=0}^{n} \mathbf{P}_i b_{i,n}(t) \mbox{ , } t \in [0,1]</math>
 
with
 
:<math>\mathbf{P}_i :=
\begin{pmatrix}
x_i \\
y_i \\
z_i
\end{pmatrix}
</math>.
 
we split the Bézier curve into three separate equations
 
:<math>B_1(t) = \sum_{i=0}^{n} x_i b_{i,n}(t) \mbox{ , } t \in [0,1]</math>
:<math>B_2(t) = \sum_{i=0}^{n} y_i b_{i,n}(t) \mbox{ , } t \in [0,1]</math>
:<math>B_3(t) = \sum_{i=0}^{n} z_i b_{i,n}(t) \mbox{ , } t \in [0,1]</math>
 
which we evaluate individually using De Casteljau's algorithm.
 
==Geometric interpretation==
The geometric interpretation of De Casteljau's algorithm is straightforward.
*Consider a Bézier curve with control points <math>\scriptstyle P_0,...,P_n</math>. Connecting the consecutive points we create the control polygon of the curve.
*Subdivide now each line segment of this polygon with the ratio <math>\scriptstyle t : (1-t)</math> and connect the points you get. This way you arrive at the new polygon having one less segment.
*Repeat the process until you arrive at the single point - this is the point of the curve corresponding to the parameter <math>\scriptstyle t</math>.
The following picture shows this process for a cubic Bézier curve:
 
[[Image:DeCasteljau1.svg]]
 
Note that the intermediate points that were constructed are in fact the control points for two new Bézier curves, both exactly coincident with the old one. This algorithm not only evaluates the curve at <math>\scriptstyle t</math>, but splits the curve into two pieces at <math>\scriptstyle t</math>, and provides the equations of the two sub-curves in Bézier form.
 
The interpretation given above is valid for a nonrational Bézier curve. To evaluate a rational Bézier curve in <math>\scriptstyle \mathbf{R}^n</math>, we may project the point into <math>\scriptstyle \mathbf{R}^{n+1}</math>; for example, a curve in three dimensions may have its control points <math>\scriptstyle \{(x_i, y_i, z_i)\}</math> and weights <math>\scriptstyle \{w_i\}</math> projected to the weighted control points <math>\scriptstyle \{(w_ix_i, w_iy_i, w_iz_i, w_i)\}</math>. The algorithm then proceeds as usual, interpolating in <math>\scriptstyle \mathbf{R}^4</math>. The resulting four-dimensional points may be projected back into three-space with a [[perspective divide]].
 
In general, operations on a rational curve (or surface) are equivalent to operations on a nonrational curve in a [[projective space]]. This representation as the "weighted control points" and weights is often convenient when evaluating rational curves.
 
==References==
*Farin, Gerald & Hansford, Dianne (2000). ''The Essentials of CAGD''.  Natic, MA: A K Peters, Ltd.  ISBN 1-56881-123-3
 
==See also==
*[[Bézier curve]]s
*[[De Boor's algorithm]]
*[[Horner scheme]] to evaluate polynomials in [[monomial form]]
*[[Clenshaw algorithm]] to evaluate polynomials in [[Chebyshev form]]
 
==External links==
* [http://hcklbrrfnn.wordpress.com/2012/08/20/piecewise-linear-approximation-of-bezier-curves/ Piecewise linear approximation of Bézier curves] – description of De Casteljau's algorithm, including a criterion to determine when to stop the recusion
* [http://jeremykun.com/2013/05/11/bezier-curves-and-picasso/ Bezier Curves and Picasso] — Description and illustration of De Casteljau's algorithm applied to cubic Bézier curves.
 
[[Category:Splines]]
[[Category:Numerical analysis]]

Latest revision as of 08:39, 29 July 2014

Hello from Denmark. I'm glad to came here. My first name is Harlan.
I live in a small city called Kobenhavn K in western Denmark.
I was also born in Kobenhavn K 21 years ago. Married in July 2007. I'm working at the backery.

My homepage - bookbyte discount Coupons