How to Acquire Bézier Curves Using Excel

Bézier curves are used in PhotoShop, animation, auto manufacturing, film special effects, higher math curve analysis and for many other functions. In this article, learn to use Bézier curves and the formulas they're based on to create E...
Part 1 of 4:

Preparation

    1. How to Acquire Bézier Curves Using Excel Picture 1How to Acquire Bézier Curves Using Excel Picture 1
    2. How to Acquire Bézier Curves Using Excel Picture 2How to Acquire Bézier Curves Using Excel Picture 2
  1. Open a new Excel workbook and prepare 2 worksheets:
    1. Either click on the green "X" icon, or double-click on Excel in the Microsoft Office folder in your Applications folder by opening a Finder window, in order to start Excel;
    2. Using the File menu or the icon, Open a new workbook;
    3. Save the workbook as "Bezier Curves" into a logical folder, such as "wikiHow Articles" or "MS XL Imagery";
    4. Create via the + button at the bottom or access the second worksheet tab and double-click edit-name it "Saves" -- this will be used to Paste Values and Charts to which you wish to keep and remember, while still having the top worksheet tab for doing the main work on -- if you were to copy and paste, the formula results would change with varying inputs on the top worksheet from the Defined Named Variables, which are global;
    5. Double-click on the first leftmost worksheet tab and edit-name it "3 Curves" (w/o quotes).
  2. Set the Preferences, under the Excel menu:
    1. Be mindful that these settings will affect your future XL work;
    2. General - Set Show this number of recent documents to 15; set Sheets in new workbook to 3; this editor works with Body Font, in a font size of 12; set your preferred file path/ location;
    3. View - Check Show formula bar by default; check Indicators only, and comments on hover for Comments; show All for objects; Show row and column headings, Show outline symbols, Show zero values, Show horizontal scroll bar, Show vertical scroll bar, Show sheet tabs;
    4. Edit - Check all; Display 0 number of decimal places; set Interpret as 21st century for two-digit years before 30; Uncheck Automatically convert date system;
    5. AutoCorrect - Check all
    6. Chart - In Chart Screen Tips, check Show chart names on hover, and check Show data marker values on hover; leave the rest unchecked;
    7. Calculation - Automatically checked; Limit iteration to 100 Maximum iterations with a maximum change of 0.0001, unless goal seeking, then .000 000 000 000 01 (w/o spaces); check Save external link values;
    8. Error checking - Check all and this editor uses dark green or red to flag errors;
    9. Save - Check all; set to 5 minutes;
    10. Compatibility - check Check documents for compatibility
    11. Ribbon - All checked, except Hide group titles is unchecked.
Part 2 of 4:

Do Linear Bezier Curve

  1. Fill in the worksheet's Column Headers and Defined Name Variables
    1. Enter label t into cell A1;
    2. Enter label Psub0_X into cell B1;
    3. Enter label Psub0_Y into cell C1;
    4. Enter label Psub1_X into cell D1;
    5. Enter label Psub1_Y into cell E1;
    6. Enter label Psub2_X into cell F1;
    7. Enter label Psub2_Y into cell G1;
    8. Enter label Psub3_X into cell H1;
    9. Enter label Psub3_Y into cell I1;
    10. Select columns $A:$I and Insert Name Create in Top Row -- those columns are now Defined Name Variables using the various labels for Points 1 to 3 for both X and Y, plus an interpolation point called t;
    11. Select Row $1 and do Format Alignment Center and Font Bold;
    12. (the dollar symbol just means that those variable names or formatting will always pertain to that column or row, absolutely);
    13. Enter label Interpolater: (with colon and a trailing space) to cell K1 and Format Cells Alignment Right -- this is my own method of adjusting the curves inwards and outwards by a basic overall ratio;
    14. Enter a 1 to cell L1, Format Fill Canary Yellow (for input) and Font Underline;
    15. Insert Name Define name Interpolater to cell $L$1;
    16. Select columns $A:$O and Format Cells Number Custom +0.0000;-0.0000;=0.0000
  2. Start filling in the facts and formulas about the Linear Bézier Curve:
    1. Linear Bézier curves
    2. Note: "P0" and "P1", etc., simply stand for Points 0 and 1.
    3. Given Points P0 and P1, a linear Bézier curve is simply a straight line between those two Points.
    4. The curve is given by B(t) = P0 + t*(P1 - P0) = (1-t)*P0 + t*P1, where t is an element in the range [0,1], inclusive, and is equivalent to linear interpolation.
    5. Enter the sub headers and formulas which create the chart:
      1. Enter t to cell A11; enter X P0 to cell B11; enter Y P0 to cell C11; enter X P1 to cell D11; enter Y P1 to cell E11; enter (1-t)*P0 + t*P1 to cell K11 and also to cell L11;
      2. Enter .4 to cell A12; enter 2 to cell B12; enter 2 to cell C12; enter 4 to cell D12; enter 3 to cell E12; enter to cell K12, w/o quotes, the formula "=(1-t)*Psub0_X+t*Psub1_X" and Format Cells Font Red [Result=2.8]; enter to cell L12, w/o quotes, the formula "=(1-t)*Psub0_Y+t*Psub1_Y" and Format Cells Font Red [Result=2.4];
    6. Enter Chart data:
      1. Enter to cell M10 w/o quotes "Linear Bézier curve";
      2. Enter to cell N10 X;
      3. Enter to cell O10 Y;
      4. Enter to cell M11 P0;
      5. Enter to cell M12 B(t);
      6. Enter to cell M13 P1;
      7. Enter to cell M14 t;
      8. Copy Interpolater from cell K1 and paste it to cell M15;
      9. Enter to cell N11 w/o quotes the formula, "=B12";
      10. Enter to cell O11 w/o quotes the formula, "=C12";
      11. Enter to cell N12 w/o quotes the formula, "=K12";
      12. Enter to cell O12 w/o quotes the formula, "=L12";
      13. Enter to cell N13 w/o quotes the formula, "=D12";
      14. Enter to cell O13 w/o quotes the formula, "=E12";
      15. Enter to cell N14 w/o quotes the formula, "=A12";
      16. Enter to cell N15 w/o quotes the formula, "=Interpolater";
  3. Create the Linear Bézier Curve Chart
    1. Select cell range N11:O13;
    2. Select Chart from the Ribbon and select Scatter, Smoothed Line Scatter -- a chart should appear on your worksheet;
    3. Move the chart by selecting inside the border and place its upper left corner at the upper left of cell N2; Resize the chart by hovering over the lower right corner until the cursor changes to a double-headed arrow, then grab the corner and fit the corner to the lower right corner of cell P9;
    4. Click on the line in the chart and edit the data series in the formula bar so that it reads as follows, "=SERIES("Bézier Line",Sheet1!$N$11:$N$13,Sheet1!$O$11:$O$13,1);
    5. Click on the chart line and do menu Format Data Series to bring that dialog box;
    6. Set Marker Fill to Red; Set Marker Style to Circle, 7 pts;
    7. Click inside the border of the chart area, but not on any object, and do Chart Source Data;
    8. Click on the Series Add button and for Name, enter B(t) Marker (or Initial Interpolation);
    9. Click on the middle Data Marker and do Menu Format Data Series -- Marker Style, Round, 10 pt, then do Marker Fill Red; OK;
    10. Click on Chart Layout in the Ribbon and set Axes, Vertical Axis, Axes Options, Number, Uncheck Linked to Source and set Number to 0.00; OK;
    11. Do it again but this time set Line to 3 pt;
    12. Do the same last two steps for the Horizontal axis;
    13. Choose the icon Axis Titles and, by using the Text option and going Home on the Ribbon and coming back, set both titles at 18 Point font in black, with the vertical axis Vertical (text orientation);
    14. Click on the Legend, then Home, and then the Bold icon.
    15. Your chart should now resemble this one, except that I did Copy Picture including the data section and did Paste Picture onto the 'Saves' worksheet, then copied that and opened it in Preview in order to save it as a jpg file:
      How to Acquire Bézier Curves Using Excel Picture 3How to Acquire Bézier Curves Using Excel Picture 3
Part 3 of 4:

Do Quadratic Bezier Curve

  1. Familiarize yourself with the basic facts of the Quadratic Bézier Curve:
    1. A quadratic Bézier curve is the path traced by the function b(t), given points P0, P1 and P2.
    2. B(t) = (1-t)*[(1-t)P0+t*P1] + t*[(1-t)*P1 + P2], where t is an element in the range [0,1], inclusive, which can be interpreted as the linear interpolant of corresponding points in the linear Bézier curves from P0 to P1 and from P1 to P2 respectively.
    3. Rearranging the preceding equation algebraically gives:
    4. B(t) = (1-t)^2*P0 + 2*(1-t)*t*P1 + t^2 * P2, where t is an element in the range [0, 1], inclusive.
    5. The derivative of the Bézier curve with respect to t is
    6. B´(t) = 2*(1-t)*(P1 - P0) + 2*t*(P2 - P1), from which it can be concluded that the tangents to the curve at P0 and P2 intersect at P1.
    7. As t increases from 0 to 1, the curve departs from P0 in the direction of P1, then bends to arrive at P2 from the direction of P1.
    8. The second derivative of the Bézier curve with respect to t is:
    9. B´´(t) = 2*(P2 - 2*P1 + P0].
    10. A quadratic Bézier curve is also a parabolic segment. As a parabola is a conic sector, some sources refer to quadratic Béziers as "conic arcs".
    11. Enter the sub headers and formulas which create the chart:
      1. Enter t to cell A34; enter X P0 to cell B34; enter Y P0 to cell C34; enter X P1 to cell D34; enter Y P1 to cell E39; enter X P2 to cell F34; enter Y P2 to cell G34; enter ((1-t)^2+(1-t)t*P1+t^2* P2)*Interpolater to cell K39 and also to cell L39;
      2. Enter .2 to cell A35; enter 1 to cell B35; enter 3 to cell C35; enter 2 to cell D35; enter 1.5 to cell E35; enter, w/o quotes, "=A35" to cell A40; copy cell A40 and paste it to cell range B40:G40; enter to cell K40, w/o quotes, the formula "=((1-t)^2+(1-t)*t*Psub1_X+t^2*Psub2_X)*Interpolater" and Format Cells Font Red [Result=1.2280]; enter to cell L40, w/o quotes, the formula "=((1-t)^2+(1-t)*t*Psub1_Y+t^2*Psub2_Y)*Interpolater" and Format Cells Font Red [Result=1.0400](given the Interpolater = 1);
  2. Enter the Quadratic Chart data:
    1. Enter to cell N32 X;
    2. Enter to cell O32 Y;
    3. Enter to cell M33 P0;
    4. Enter to cell M34 P1i;
    5. Enter to cell M35 P2;
    6. Enter to cell M36 t;
    7. Enter to cell M37 Interpolater: ;
    8. Enter to cell N33 "=B35" w/o quotes;
    9. Enter to cell N34 "=D40*Interpolater" w/o quotes;
    10. Enter to cell N35 "=F40" w/o quotes;
    11. Enter to cell N36 "=A35" w/o quotes;
    12. Enter to cell N37 "=Interpolater" w/o quotes;
    13. Enter to cell O33 "=C35" w/o quotes;
    14. Enter to cell O34 "=E40*Interpolater" w/o quotes;
    15. Enter to cell O35 "=G40" w/o quotes;
    16. Select cell range M33:O35 and Format Cells Border Black Bold Outline Top Bottom and Sides but not the Middle bar.
    17. Enter to cell M39 P0;
    18. Enter to cell M40 B(t)*Interp;
    19. Enter to cell M41 P2;
    20. Enter to cell N39 "=B40" w/o quotes;
    21. Enter to cell N40 "=K40" w/o quotes;
    22. Enter to cell N41 "=F35" w/o quotes;
    23. Select cell range E40:O40 and Format Cells Font Red;
    24. Select cell range M39:O41 and Format Cells Border Red Dashed Line (long dash) and do Border All selection icon.
  3. Create the Quadratic Curve Chart:
    1. Select cell range N13:O15 and use the Chart item on the Ribbon, or Chart Wizard, or whatever to select Charts - All, Scatter, Smoothed Line Scatter; at this Point, a chart should appear atop your worksheet;
    2. Select inside the border but not on any chart object and do menu item Chart Source Data;
    3. For Series#1, title it P0, P1i, P2; set X-series to $N$33:$N$35 and set Y-series to $033:$O$35;
    4. Hit OK and go back to the same dialog box via Chart Source Data;
    5. For Series#2, title it P0, B(t)i, P2; set X-series to $N$39:$N$41 and set Y-series to $039:$O$41;
    6. These steps may not turn out right: Check by clicking on the first data series that its formula in the formula bar reads,
    7. "=SERIES("P0, P1i, P2", Sheet1!$N$33:$N$35,Sheet1!$O$33:$O$35,1)"
    8. and that the formula in the formula bar for the second data series reads,
    9. "=SERIES("P0, B(t)i, P2",Sheet1!$N$39:$N$41,Sheet1!$O$39:$O$41,2)", w/o quotes.
    10. Format the Axes, Vertical Gridlines and Axes Titles as you did for the Linear Chart above;
    11. Do Chart Layout, Chart Title, Format Title, Text Box and check Resize shape to fit text;
    12. Edit-click in the new Text-Box title box and title the chart Bézier Quadratic Curve (return) P0, P1i, P2 and P0, B(t)i, P2; OK.
    13. Drag the chart so that its upper left corner is in cell M19 and resize it so its lower right corner is in cell Q31.
    14. Except for some Data Marker Styles and Fill and perhaps a few other details, your chart should resemble this one:
      How to Acquire Bézier Curves Using Excel Picture 4How to Acquire Bézier Curves Using Excel Picture 4
Part 4 of 4:

Do Cubic Bezier Curve

  1. Familiarize yourself with the basic facts of the Cubic Bézier Curve:
    1. Four points P0, P1, P2 and P3 in the plane or in a higher dimensional space define a cubic Bézier curve.
    2. The curve starts at P0 going toward P1 and arrives at P3 coming from the direction of P2. Usually, it will not pass through P1 or P2; these points being there only to provide directional information.
    3. The distance between P0 and P1 determines "how long" the curve moves into direction P2 before turning towards P3.
    4. Writing BPiPjPk(t) for the quadratic Bézier curve defined by points Pi, Pj and Pk, the cubic Bézier curve can be defined as a linear combination of two quadratic Bézier curves.
    5. B(t) = (1-t)*BP0,P1,P2(t) + t*BP1,P2,P3(t), with t as an element in the range [0, 1], inclusive.
    6. For some choices of P1 and P2, the curve may intersect itself, or contain a cusp.
    7. Any series of 4 distinct points can be converted to a cubic Bézier curve that goes through all 4 points in order.
    8. Given the starting and ending point of some cubic Bézier curve, and the points along the curve corresponding to t = 1/3 and t = 2/3, the control points for the original Bézier curve can be recovered.
    9. The derivative of the cubic Bézier curve with respect to t is
    10. B´(t) = 3*(1-t)^2 * [P1 - P0] + 6*(1-t)*t*(P2 - P1) + 3*t^2 *(P3 - P2).
    11. The second derivative of the Bézier curve with respect to t is:
    12. B´´(t) = 6*(1-t)*(P2 - 2*P1 + P0) + 6*t*(P3 - 2*P2 + P1).
    13. Enter the sub headers and formulas that create the chart:
      1. Enter t to cell A71; enter X P0 to cell B71; enter Y P0 to cell C71; enter X P1 to cell D71; enter Y P1 to cell E71; enter X P2 to cell F71; enter Y P2 to cell G71;
      2. Enter ((1-t)^3*P0+3*(1-t)^2*t*P1+3*(1-t)*t^2*P2+t^3* P3)*Interpolater to cells K71, L71, K76, L76, K82 and L82;
      3. Enter .5 to cell A72; enter -3 to cell B72; enter -4 to cell C72; enter -.5 to cell D72; enter 1 to cell E72; enter -1 to cell F72; enter 3 to cell G72; enter 4 to cell H72; enter 1 to cell I72;
      4. Enter, w/o quotes, "=1/3" to cell A77; enter, w/o quotes, "=B72" to cell B77 and copy cell B77 and paste it to cell range C77:I77;
      5. Enter, w/o quotes, "=2/3" to cell A83; enter, w/o quotes, "=B77" to cell B83 and copy cell B83 and paste it to cell range C83:I83;
      6. Enter in cell A85, the text w/o quotes, "For further information, see:" and enter in cell A86 http://en.wikipedia.org/wiki/B%C3%A9zier_curve which then step into in the formula bar and edit it at the middle/end of it, adding nothing, press return, and it should become a live link;
      7. Enter to cell K72, w/o quotes, the formula "=((1-t)^3*Psub0_X+3*(1-t)^2*t*Psub1_X+3*(1-t)*t^2*Psub2_X+t^3*Psub3_X)*Interpolater" and Format Cells Font Red [Result=-0.8125]; copy this same formula and paste it to cells K77 and K83 [where the results are -1.2963 and -0.3704, respectively];
      8. Enter to cell L72, w/o quotes, the formula "=((1-t)^3*Psub0_Y+3*(1-t)^2*t*Psub1_Y+3*(1-t)*t^2*Psub2_Y+t^3*Psub3_Y)*Interpolater" and Format Cells Font Red [Result=+1.1250]; copy this same formula and paste it to cells L77 and L83 [where the results are -0.0370 and +1.7037, respectively];
  2. Enter the Chart data section:
    1. Enter t into cell M70;
    2. Enter Pt# into cell N70 -- (not done in the image below);
    3. Enter X into cell O70;
    4. Enter Y into cell P70;
    5. Select cell range M70:O70 and Format Cells Font Bold Size 18;
    6. Enter to cell M72 the formula, "=t"; copy that formula and paste it to cells M77 and M83;
    7. Enter P0 and make 0 a subscript in cell N71. Copy cell N71 and paste it to cell range N72:N84;
    8. You want to have 3 series of 4 digits each, separated by 2 spaces between the series. Edit Series 1 from N71 to N74 so that the P's subscripts read 0, 1i, 2, 3; Delete the entry in cell N75, and edit Series 2 from N76 to N79 so that the P's subscripts read 0,1i, 2, 3; Delete the entry in cell N80, and edit Series 3 from N81 to N84 so that the P's subscripts read 0,1, 2i, 3;
    9. Copy from cell K1 the label Interpolater: and paste it to cell R71; Enter to cell S71 the formula, w/o quotes, "=Interpolater", (stripping off the colon and extra space first if you copied it from R71);
    10. Format Cells Border Red Bold Surrounding Box to cell range Q71:S71 and use the Paint bucket tool in the Toolbar to fill the cell range Q72:S72 with a band of bright red.
    11. Enter to cell O71 the formula w/o quotes, "=B72" and enter to cell P71 "=C72";
    12. Enter to cell O72 the formula w/o quotes, "=K72" and enter to cell P72 "=L72";
    13. Enter to cell O73 the formula w/o quotes, "=F72" and enter to cell P73 "=G72";
    14. Enter to cell O74 the formula w/o quotes, "=H72" and enter to cell P74 "=I72";
    15. Enter to cell O76 the formula w/o quotes, "=B77" and enter to cell P76 "=C77";
    16. Enter to cell O77 the formula w/o quotes, "=K77" and enter to cell P77 "=L77";
    17. Enter to cell O78 the formula w/o quotes, "=F77" and enter to cell P78 "=G77";
    18. Enter to cell O79 the formula w/o quotes, "=H77" and enter to cell P79 "=I77";
    19. Enter to cell O81 the formula w/o quotes, "=B83" and enter to cell P81 "=C83";
    20. Enter to cell O82 the formula w/o quotes, "=D83" and enter to cell P82 "=E83";
    21. Enter to cell O83 the formula w/o quotes, "=K83" and enter to cell P83 "=L83";
    22. Enter to cell O84 the formula w/o quotes, "=H83" and enter to cell P84 "=I83";
    23. Format cells fill yellow and font red for the Shift and Command cell range selection wherever there is an i in the P subscript, for the X and Y values only, i.e. cell range O72:P72+O77:P77+O83:P83.
  3. Create the Bézier Cubic Curve Chart:
    1. Select cell range O71:P74 and create a new Chart via the Chart option on the Ribbon or from the toolbar or menu; select All, Scatter, Smoothed Line Scatter ... and a chart should appear atop your worksheet with a curve on it. Double-click on the curve and edit the title in the front of the series formula in the formula bar until the formula reads, "=SERIES("Cubic Curve",Sheet1!$O$71:$O$74,Sheet1!$P$71:$P$74,1)", w/o quotes externally.
    2. Click inside the chart but not on any chart object once and select menu Chart Source Data;
      1. Below the Series box, click the Add button, then enter the name: ="Control Point 01"; then for the X values, select on your sheet or type in =Sheet1!$O$76:$O$79 and for the Y values select on your sheet or type in =Sheet1!$P$76:$P$79 -- hit OK and verify in the formula bar that the series formula is correct. You should have a second curve; double click on it and format chart series Line Red Weight 5 Dashed line; OK.
      2. Double click in the plot area, Again below the Series box, click the Add button, then enter the name: ="Control Point 02"; then for the X values, select on your sheet or type in =Sheet1!$O$81:$O$84 and for the Y values select on your sheet or type in =Sheet1!$P$81:$P$84 -- hit OK and verify in the formula bar that the series formula is correct. You should have a second curve; double click on it and format chart series Line Green Weight 4 Tiny Dashes line;
      3. Now add the series name ="Control Point Marker #00" with X values =Sheet1!$K$72 and Y values =Sheet1!$L$72 and Format that series or data Point as a big blue-filled style round dot.
      4. Now add the series name ="Control Point Marker #01" with X values =Sheet1!$K$77 and Y values =Sheet1!$L$77 and Format that series or data Point as a big red-filled style round dot.
      5. Now add the series name ="Control Point Marker #02" with X values =Sheet1!$K$83 and Y values =Sheet1!$L$83 and Format that series or data Point as a big green-filled style round dot.
    3. Select the chart and the chart data underneath it by selecting the cell range that includes them, once you've repositioned the chart over the chart data properly to extend from upper left cell 1/2 of M49 to lower right the left quarter of cell T69, and hold the Shift key down and do Edit Copy Picture, activate the Saves worksheet and hold down the Shift Key again and do Paste Picture, Do Copy via command and v, and open the app Preview and do File New from Clipboard. Export it as a .jpg or .png file into your same folder so you can easily send it to friends or keep it with your photos, etc.
    4. Here are the versions created for this article with Interpolate set to 1.4 and 1:
      How to Acquire Bézier Curves Using Excel Picture 5How to Acquire Bézier Curves Using Excel Picture 5
      How to Acquire Bézier Curves Using Excel Picture 6How to Acquire Bézier Curves Using Excel Picture 6



How to Acquire Bézier Curves Using Excel Picture 7How to Acquire Bézier Curves Using Excel Picture 7
4.5 ★ | 2 Vote