Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using de Casteljau's algorithm you can find the coordinates x and y of a bezier curve for any t, the percentage or interpolation step. So a t of .1 would give you the x and y at 10% of the curve from the beginning. A t of .9 would be 90% from the beginning, and so on.</p> <p>In our cubic bezier we have p0 (point 0), cp0 (control point 0), cp1 (control point 1), and p1 (point 1).</p> <p>In the <strong>first step</strong> of the algorithm we draw a line connecting p0 and cp0, another line connecting cp0 and cp1, and another still connecting cp1 and p1. Then for all 3 of these lines we're going to find the point on them that is t % from the start of them.</p> <p>I'll call the points as follows:</p> <ul> <li>p0 -> cp0 = A </li> <li>cp0 -> cp1 = B </li> <li><p>cp1 -> p1 = C</p> <pre><code>Ax = ( (1 - t) * p0x ) + (t * cp0x); Ay = ( (1 - t) * p0y ) + (t * cp0y); Bx = ( (1 - t) * cp0x ) + (t * cp1x); By = ( (1 - t) * cp0y ) + (t * cp1y); Cx = ( (1 - t) * cp1x ) + (t * p1x); Cy = ( (1 - t) * cp1y ) + (t * p1y); </code></pre></li> </ul> <p>The <strong>second step</strong> is very much like the first. In the first we connected the four points with lines and then found 3 new points on them. In this step we'll connect those 3 points with lines find 2 new points on them. I'll call these two new points D and E.</p> <pre><code> Dx = ( (1 - t) * Ax ) + (t * Bx); Dy = ( (1 - t) * Ay ) + (t * By); Ex = ( (1 - t) * Bx ) + (t * Cx); Ey = ( (1 - t) * By ) + (t * Cy); </code></pre> <p>Finally, we can connect these last two points with another line, and find the last point on it which will give us the point on the bezier curve for that t. I'll call this point P.</p> <pre><code> Px = ( (1 - t) * Dx ) + (t * Ex); Py = ( (1 - t) * Dy ) + (t * Ey); </code></pre> <p>There we go, we now have the x and y coordinate of a point on the bezier that is t% from the start. I'll add some pictures soon.</p> <p><img src="https://i.stack.imgur.com/vdFqk.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload