(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.0' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 9781, 267]*) (*NotebookOutlinePosition[ 10418, 289]*) (* CellTagsIndexPosition[ 10374, 285]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Bezier Curves", "Title"], Cell[CellGroupData[{ Cell["The setup", "Subsection"], Cell[TextData[{ StyleBox["Get some special graphing commands --- ", FontSize->14], StyleBox["DisplayTogether[ ]", FontSize->14, FontWeight->"Bold"], StyleBox[", to be specific:", FontSize->14] }], "Text"], Cell[BoxData[ \(<< Graphics`Graphics`\)], "Input"], Cell[TextData[StyleBox["Set the nodes:", FontSize->14]], "Text"], Cell[BoxData[{ \(\({x0, y0}\ = \ {0, 1};\)\), "\[IndentingNewLine]", \(\({x1, y1}\ = \ {3, 2};\)\)}], "Input"], Cell[TextData[StyleBox["Set the control points (the latter are related to \ guide points):", FontSize->14]], "Text"], Cell[BoxData[{ \(\({a0, b0}\ = \ {1, 3};\)\), "\[IndentingNewLine]", \(\({a1, b1}\ = \ {0.7, 0.5};\)\)}], "Input"], Cell[TextData[StyleBox["Set the scale factor:", FontSize->14]], "Text"], Cell[BoxData[ \(\(k\ = \ 3;\)\)], "Input"], Cell[TextData[StyleBox["Define the resulting parametric cubics:", FontSize->14]], "Text"], Cell[BoxData[{ \(x[t_] := \((2*\((x0 - x1)\) + k*\((a0 + a1)\))\)* t^3 + \((3*\((x1 - x0)\) - k*\((a1 + 2*a0)\))\)*t^2 + k*a0*t + x0\), "\[IndentingNewLine]", \(y[t_] := \((2*\((y0 - y1)\) + k*\((b0 + b1)\))\)* t^3 + \((3*\((y1 - y0)\) - k*\((b1 + 2*b0)\))\)*t^2 + k*b0*t + y0\)}], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["The graph", "Subsection"], Cell[TextData[StyleBox["The following command shows not only the Bezier \ curve, but also the lines to which the Bezier curve is to be tangent (at the \ nodes).", FontSize->14]], "Text"], Cell[BoxData[ \(DisplayTogether[\[IndentingNewLine]ParametricPlot[{x[t], y[t]}, \ {t, 0, 1}, AspectRatio \[Rule] Automatic, \ PlotRange \[Rule] All], \[IndentingNewLine]\[IndentingNewLine]ListPlot[{{x0, y0}, {x0, y0} + {a0, b0}, {x1, y1}, {x1, y1} - {a1, b1}}, PlotStyle \[Rule] AbsolutePointSize[ 5]], \[IndentingNewLine]\[IndentingNewLine]Graphics[{\ \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x0, y0}, {x0, y0} + {a0, b0}}]}, \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x1, y1}, {x1, y1} - {a1, b1}}]}}]\[IndentingNewLine]]\)], "Input"], Cell[TextData[StyleBox["To see just the nodes, guide points, and resulting \ curve:", FontSize->14]], "Text"], Cell[BoxData[ \(DisplayTogether[\[IndentingNewLine]ParametricPlot[{x[t], y[t]}, \ {t, 0, 1}, AspectRatio \[Rule] Automatic, \ PlotRange \[Rule] All], \[IndentingNewLine]\[IndentingNewLine]ListPlot[{{x0, y0}, {x0, y0} + {a0, b0}, {x1, y1}, {x1, y1} - {a1, b1}}, PlotStyle \[Rule] AbsolutePointSize[5]]\[IndentingNewLine]]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["An example with 2 sets of nodes and control points", "Subsection"], Cell[BoxData[{ \(\({x0, y0}\ = \ {0, 1};\)\), "\n", \(\({x1, y1}\ = \ {3, 2};\)\), "\n", \(\({x2, y2}\ = \ {5, 1};\)\n\), "\[IndentingNewLine]", \(\({a0, b0}\ = \ {1, 3};\)\), "\n", \(\({a1a, b1a}\ = \ {\(-0.5\), \(-0.7\)};\)\), "\n", \(\({a1b, b1b}\ = \ {1.3, \(-2.5\)};\)\), "\[IndentingNewLine]", \(\({a2, b2}\ = \ {0.3, 1};\)\n\), "\[IndentingNewLine]", \(\(k\ = \ 3;\)\n\), "\[IndentingNewLine]", \(X1[t_] := \((2*\((x0 - x1)\) + k*\((a0 + a1a)\))\)* t^3 + \((3*\((x1 - x0)\) - k*\((a1a + 2*a0)\))\)*t^2 + k*a0*t + x0\), "\n", \(Y1[t_] := \((2*\((y0 - y1)\) + k*\((b0 + b1a)\))\)* t^3 + \((3*\((y1 - y0)\) - k*\((b1a + 2*b0)\))\)*t^2 + k*b0*t + y0\[IndentingNewLine]\), "\n", \(X2[t_] := \((2*\((x1 - x2)\) + k*\((a1b + a2)\))\)* t^3 + \((3*\((x2 - x1)\) - k*\((a2 + 2*a1b)\))\)*t^2 + k*a1b*t + x1\), "\n", \(Y2[t_] := \((2*\((y1 - y2)\) + k*\((b1b + b2)\))\)* t^3 + \((3*\((y2 - y1)\) - k*\((b2 + 2*b1b)\))\)*t^2 + k*b1b*t + y1\), "\[IndentingNewLine]", \(\)}], "Input"], Cell[BoxData[ \(DisplayTogether[\[IndentingNewLine]ParametricPlot[{X1[t], Y1[t]}, \ {t, 0, 1}, AspectRatio \[Rule] Automatic, \ PlotRange \[Rule] All], \[IndentingNewLine]\[IndentingNewLine]ParametricPlot[{X2[t], Y2[t]}, \ {t, 0, 1}, AspectRatio \[Rule] Automatic, \ PlotRange \[Rule] All], \[IndentingNewLine]\[IndentingNewLine]ListPlot[{{x0, y0}, {x0, y0} + {a0, b0}, {x1, y1}, {x1, y1} - {a1a, b1a}, {x1, y1} + {a1b, b1b}, {x2, y2}, {x2, y2} - {a2, b2}}, PlotStyle \[Rule] AbsolutePointSize[ 5]], \[IndentingNewLine]\[IndentingNewLine]Graphics[{\ \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x0, y0}, {x0, y0} + {a0, b0}}]}, \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x1, y1}, {x1, y1} - {a1a, b1a}}]}, \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x1, y1}, {x1, y1} + {a1b, b1b}}]}, \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x2, y2}, {x2, y2} - {a2, b2}}]}\[IndentingNewLine]}]\[IndentingNewLine]]\)], \ "Input"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ An example employing opposite guide points at the 1st node to make \ the curve be smooth there\ \>", "Subsection"], Cell[BoxData[{ \(\({x0, y0}\ = \ {0, 1};\)\), "\n", \(\({x1, y1}\ = \ {3, 2};\)\), "\n", \(\(\({x2, y2}\ = \ {5, 1};\)\(\n\) \)\), "\[IndentingNewLine]", \(\({a0, b0}\ = \ {1, 3};\)\), "\n", \(\({a1, b1}\ = \ {0.2, \(-0.7\)};\)\), "\n", \(\(\({a2, b2}\ = \ {\(-1\), \(-2\)};\)\(\[IndentingNewLine]\) \)\), "\n", \(\(\(k\ = \ 5;\)\(\[IndentingNewLine]\) \)\), "\n", \(X1[t_] := \((2*\((x0 - x1)\) + k*\((a0 + a1)\))\)* t^3 + \((3*\((x1 - x0)\) - k*\((a1 + 2*a0)\))\)*t^2 + k*a0*t + x0\), "\n", \(\(\(Y1[ t_] := \((2*\((y0 - y1)\) + k*\((b0 + b1)\))\)* t^3 + \((3*\((y1 - y0)\) - k*\((b1 + 2*b0)\))\)*t^2 + k*b0*t + y0\)\(\n\) \)\), "\[IndentingNewLine]", \(X2[t_] := \((2*\((x1 - x2)\) + k*\((a1 + a2)\))\)* t^3 + \((3*\((x2 - x1)\) - k*\((a2 + 2*a1)\))\)*t^2 + k*a1*t + x1\), "\n", \(Y2[t_] := \((2*\((y1 - y2)\) + k*\((b1 + b2)\))\)* t^3 + \((3*\((y2 - y1)\) - k*\((b2 + 2*b1)\))\)*t^2 + k*b1*t + y1\), "\[IndentingNewLine]", \(\)}], "Input"], Cell[BoxData[ \(DisplayTogether[\[IndentingNewLine]ParametricPlot[{X1[t], Y1[t]}, \ {t, 0, 1}, AspectRatio \[Rule] Automatic, \ PlotRange \[Rule] All], \[IndentingNewLine]\[IndentingNewLine]ParametricPlot[{X2[t], Y2[t]}, \ {t, 0, 1}, AspectRatio \[Rule] Automatic, \ PlotRange \[Rule] All], \[IndentingNewLine]\[IndentingNewLine]ListPlot[{{x0, y0}, {x0, y0} + {a0, b0}, {x1, y1}, {x1, y1} - {a1, b1}, {x1, y1} + {a1, b1}, {x2, y2}, {x2, y2} - {a2, b2}}, PlotStyle \[Rule] AbsolutePointSize[ 5]], \[IndentingNewLine]\[IndentingNewLine]Graphics[{\ \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x0, y0}, {x0, y0} + {a0, b0}}]}, \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x1, y1}, {x1, y1} - {a1, b1}}]}, \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x1, y1}, {x1, y1} + {a1, b1}}]}, \[IndentingNewLine]{Dashing[{0.02, 0.02}], Line[{{x2, y2}, {x2, y2} - {a2, b2}}]}\[IndentingNewLine]}]\[IndentingNewLine]]\)], \ "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"5.0 for Macintosh", ScreenRectangle->{{0, 1280}, {0, 795}}, WindowSize->{520, 673}, WindowMargins->{{67, Automatic}, {Automatic, 36}} ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 30, 0, 88, "Title"], Cell[CellGroupData[{ Cell[1831, 57, 31, 0, 38, "Subsection"], Cell[1865, 59, 226, 8, 54, "Text"], Cell[2094, 69, 54, 1, 27, "Input"], Cell[2151, 72, 66, 1, 34, "Text"], Cell[2220, 75, 121, 2, 43, "Input"], Cell[2344, 79, 118, 2, 34, "Text"], Cell[2465, 83, 125, 2, 43, "Input"], Cell[2593, 87, 73, 1, 34, "Text"], Cell[2669, 90, 47, 1, 27, "Input"], Cell[2719, 93, 91, 1, 34, "Text"], Cell[2813, 96, 337, 6, 75, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3187, 107, 31, 0, 38, "Subsection"], Cell[3221, 109, 188, 3, 54, "Text"], Cell[3412, 114, 738, 15, 235, "Input"], Cell[4153, 131, 111, 2, 34, "Text"], Cell[4267, 135, 401, 7, 139, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[4705, 147, 72, 0, 38, "Subsection"], Cell[4780, 149, 1124, 21, 347, "Input"], Cell[5907, 172, 1289, 27, 379, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[7233, 204, 124, 3, 56, "Subsection"], Cell[7360, 209, 1109, 25, 331, "Input"], Cell[8472, 236, 1281, 27, 379, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)