{VERSION 4 0 "IBM INTEL NT" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 261 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 271 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 272 "" 0 1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STYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 262 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 263 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 264 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE " " 0 265 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 266 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 267 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "Unit 8: Numerical Methods " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 25 "Chapt er 40: Interpolation" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 28 "Section 40.5: Bezier curves" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 9 "Copyright" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Copyright * 2001 by Addison Wesley Longman, Inc." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 302 "All rights reserved. No part of thi s publication may be reproduced, stored in a retrieval system, or tran smitted, in any form or by any means, electronic, mechanical, photocop ying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 15 "Initializations" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "with(linalg):\nwith(plots): \nwith(plottools):\nread(`pvac.txt`):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 15 "Definition \+ 40.1" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 "Given the " }{XPPEDIT 18 0 "n+1" "6#,&%\"nG\"\"\"F%F%" }{TEXT -1 8 " points " }{XPPEDIT 18 0 "p[k]=``(x[k],y[k]),k=0,`...`,n" "6&/&% \"pG6#%\"kG-%!G6$&%\"xG6#F'&%\"yG6#F'/F'\"\"!%$...G%\"nG" }{TEXT -1 32 ", and the corresponding vectors " }{TEXT 258 1 "P" }{XPPEDIT 18 0 "``[k]" "6#&%!G6#%\"kG" }{TEXT -1 3 " = " }{XPPEDIT 18 0 "x[k]" "6#&% \"xG6#%\"kG" }{TEXT -1 1 " " }{TEXT 256 1 "i" }{TEXT -1 3 " + " } {XPPEDIT 18 0 "y[k]" "6#&%\"yG6#%\"kG" }{TEXT -1 1 " " }{TEXT 257 1 "j " }{TEXT -1 17 ", the associated " }{XPPEDIT 18 0 "n" "6#%\"nG" } {TEXT -1 10 "th degree " }{TEXT 283 6 "Bezier" }{TEXT -1 1 " " }{TEXT 284 5 "curve" }{TEXT -1 12 " is given by" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 258 "" 0 "" {TEXT 285 1 "R" }{XPPEDIT 18 0 "``(u)=Sum([n !/k!/(n-k)!]*(1-u)^(n-k)*u^k,k=0..n)" "6#/-%!G6#%\"uG-%$SumG6$*(7#*(-% *factorialG6#%\"nG\"\"\"-F/6#%\"kG!\"\"-F/6#,&F1F2F5F6F6F2),&F2F2F'F6, &F1F2F5F6F2)F'F5F2/F5;\"\"!F1" }{TEXT -1 1 " " }{TEXT 286 1 "P" } {XPPEDIT 18 0 "``[k]" "6#&%!G6#%\"kG" }{TEXT -1 1 " " }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 76 "where the coefficients \+ in the square bracket are the binomial coefficients \"" }{XPPEDIT 18 0 "n" "6#%\"nG" }{TEXT -1 8 " choose " }{XPPEDIT 18 0 "k" "6#%\"kG" } {TEXT -1 7 "\", and " }{XPPEDIT 18 0 "0<=u" "6#1\"\"!%\"uG" }{XPPEDIT 18 0 "``<=1" "6#1%!G\"\"\"" }{TEXT -1 3 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 36 "(Texts such as [1] accent the f irst " }{TEXT 282 1 "e" }{TEXT -1 135 ", while texts such as [2] don't . In either event, the author has always heard the name pronounced wi th three syllables, as Bez-ee-ay.)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 " " {TEXT -1 12 "Example 40.9" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "The cubic Bezier curve associated with th e " }{XPPEDIT 18 0 "n+1=4" "6#/,&%\"nG\"\"\"F&F&\"\"%" }{TEXT -1 29 " \+ points has the general form " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 261 "" 0 "" {TEXT -1 1 " " }{TEXT 287 1 "R" }{XPPEDIT 18 0 "``(u)" "6# -%!G6#%\"uG" }{TEXT -1 5 " = 1 " }{XPPEDIT 18 0 "``(1-u)^3*u^0" "6#*&- %!G6#,&\"\"\"F(%\"uG!\"\"\"\"$F)\"\"!" }{TEXT -1 1 " " }{TEXT 288 1 "P " }{XPPEDIT 18 0 "``[0]+3*(1-u)^2*u^`1`" "6#,&&%!G6#\"\"!\"\"\"*(\"\"$ F(*$,&F(F(%\"uG!\"\"\"\"#F()F-%\"1GF(F(" }{TEXT -1 1 " " }{TEXT 289 1 "P" }{XPPEDIT 18 0 "``[1]+3*(1-u)^`1`*u^2" "6#,&&%!G6#\"\"\"F'*(\"\"$F '),&F'F'%\"uG!\"\"%\"1GF'F,\"\"#F'" }{TEXT -1 1 " " }{TEXT 290 1 "P" } {XPPEDIT 18 0 "``[2]" "6#&%!G6#\"\"#" }{TEXT -1 5 " + 1 " }{XPPEDIT 18 0 "``(1-u)^0*u^3" "6#*&-%!G6#,&\"\"\"F(%\"uG!\"\"\"\"!F)\"\"$" } {TEXT -1 1 " " }{TEXT 291 1 "P" }{XPPEDIT 18 0 "``[3]" "6#&%!G6#\"\"$ " }{TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 44 "where the binomial coefficients evaluate to " }{XPPEDIT 18 0 "1,3,3,1" "6&\"\"\"\"\"$F$F#" }{TEXT -1 46 ", respectively. In f act, using Maple, we have" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "for k from 0 to 3 do\nbinomial(3,k) ;\nod;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "for the four binomial coefficients \"3 choose \+ " }{XPPEDIT 18 0 "k" "6#%\"kG" }{TEXT -1 9 "\", where " }{XPPEDIT 18 0 "k=0,`...`,3" "6%/%\"kG\"\"!%$...G\"\"$" }{TEXT -1 1 "." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 15 "The four points" } }{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "p[0] := [0,0];\np[1] := [-1,2];\np[2] := [7,3];\np[3] := [5,0]; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "determine the cubic Bezier" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "R := evalm(add(bi nomial(3,k)*(1-u)^(3-k)*u^k*p[k],k=0..3));" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 8 "Maple's " } {TEXT 259 5 "evalm" }{TEXT -1 27 " command accepts the lists " } {XPPEDIT 18 0 "p[k]" "6#&%\"pG6#%\"kG" }{TEXT -1 34 " and converts the m to the vectors " }{TEXT 260 1 "P" }{XPPEDIT 18 0 "``[k]" "6#&%!G6#% \"kG" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 29 "Expanding the parentheses in " }{TEXT 292 1 "R" }{TEXT -1 6 " gives" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "`R` = map(simplify,R);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "which is graphed as the solid curve in Figure 40.10." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 370 "for k from 0 to \+ 3 do\nd||k := disk(p[k],.1,color=black);\nod:\npp1 := plot([R[1],R[2], u=0..1],color=green):\npp2 := plot([[p[0],p[1]],[p[2],p[3]]], color=re d, linestyle=2):\npp3 := textplot(\{[.4,.3,`p0`],[-1,2.3,`p1`],[7.1,3. 3,`p2`], [4.7,.3,`p3`]\}):\ndisplay([d||(0..3),pp||(1..3)], scaling=co nstrained, labels=[x,y], labelfont=[TIMES,ITALIC,12], xtickmarks=9, yt ickmarks=3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "The two intermediate points " }{XPPEDIT 18 0 "p[1]" "6#&%\"pG6#\"\"\"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "p[2 ]" "6#&%\"pG6#\"\"#" }{TEXT -1 12 " are called " }{TEXT 261 14 "contro l points" }{TEXT -1 285 ", and influence the shape of the Bezier curve . To see the effect of these points on the shape of the curve, examin e the following animation in which the two control points move horizon tally along two parallel lines. Thus, the four points from which to c onstruct the Bezier curve are " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "p[0];\np[1] := [t,2];\np[2] \+ := [6-t,3];\np[3];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "The associated Bezier curve, now p arametrized by " }{XPPEDIT 18 0 "t" "6#%\"tG" }{TEXT -1 7 ", with " } {XPPEDIT 18 0 "-1<=t" "6#1,$\"\"\"!\"\"%\"tG" }{XPPEDIT 18 0 "``<=7" " 6#1%!G\"\"(" }{TEXT -1 9 ", is then" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "Rt := evalm(add(binomial(3 ,k)*(1-u)^(3-k)*u^k*p[k],k=0..3));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "and the desir ed animation is given by" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 463 "X := unapply(Rt[1],t):\nY := unapp ly(Rt[2],t):\nF1 := t-> plot([X(t),Y(t), u = 0..1], color = green):\nF 2 := t-> plot(\{[[t,2],[0,0]],[[6-t,3],[5,0]]\}, color = red):\nF3 := \+ z-> display([disk(subs(t=z,p[1]),.1,color=black), disk(subs(t=z,p[2]), .1,color=black)]):\nF := t-> display([F1(t),F2(t),F3(t)]):\nff := disp lay([seq(F(-1+k*8/50), k = 0..50), seq(F(-1+(50-k)*8/50),k=1..49)], in sequence = true):\ndisplay([ff,d0,d3],scaling=constrained, xtickmarks= 9, ytickmarks=3);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 33 "The red line segments connecting \+ " }{XPPEDIT 18 0 "p[0]" "6#&%\"pG6#\"\"!" }{TEXT -1 6 " with " } {XPPEDIT 18 0 "p[1]" "6#&%\"pG6#\"\"\"" }{TEXT -1 6 ", and " } {XPPEDIT 18 0 "p[2]" "6#&%\"pG6#\"\"#" }{TEXT -1 6 " with " }{XPPEDIT 18 0 "p[3]" "6#&%\"pG6#\"\"$" }{TEXT -1 102 " appear to be tangent to \+ the Bezier curve at the endpoints of the curve. Indeed, a computation shows " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 262 "" 0 "" {TEXT -1 1 " " }{TEXT 293 1 "R" }{TEXT -1 1 "'" }{XPPEDIT 18 0 "``(0)" "6#-%!G6 #\"\"!" }{TEXT -1 6 " = 3 (" }{TEXT 294 1 "P" }{XPPEDIT 18 0 "``[1]-`` " "6#,&&%!G6#\"\"\"F'F%!\"\"" }{TEXT 295 1 "P" }{XPPEDIT 18 0 "``[0]" "6#&%!G6#\"\"!" }{TEXT -1 2 ") " }}{PARA 0 "" 0 "" {TEXT -1 3 "and" }} {PARA 263 "" 0 "" {TEXT -1 1 " " }{TEXT 296 1 "R" }{TEXT -1 1 "'" } {XPPEDIT 18 0 "``(1)=3" "6#/-%!G6#\"\"\"\"\"$" }{TEXT -1 2 " (" } {TEXT 297 1 "P" }{XPPEDIT 18 0 "``[3]-``" "6#,&&%!G6#\"\"$\"\"\"F%!\" \"" }{TEXT 298 1 "P" }{XPPEDIT 18 0 "``[2]" "6#&%!G6#\"\"#" }{TEXT -1 2 ") " }}{PARA 0 "" 0 "" {TEXT -1 34 "Indeed, differentiating to obtai n " }{TEXT 299 1 "R" }{TEXT -1 10 "', we have" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "`R'` := map (diff,R,u);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "Evaluating " }{TEXT 300 1 "R" }{TEXT -1 24 "' at the endpoints gives" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "subs(u=0,op(`R'`));\nsubs(u= 1,op(`R'`));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "and the obvious vector arithmetic gives f or 3 (" }{TEXT 301 1 "P" }{XPPEDIT 18 0 "``[1]-``" "6#,&&%!G6#\"\"\"F' F%!\"\"" }{TEXT 302 1 "P" }{XPPEDIT 18 0 "``[0]" "6#&%!G6#\"\"!" } {TEXT -1 9 ") and 3 (" }{TEXT 303 1 "P" }{XPPEDIT 18 0 "``[3]-``" "6#, &&%!G6#\"\"$\"\"\"F%!\"\"" }{TEXT 304 1 "P" }{XPPEDIT 18 0 "``[2]" "6# &%!G6#\"\"#" }{TEXT -1 13 ") the vectors" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "evalm(3*([-1,2]-p[0] ));\nevalm(3*(p[3]-[7,3]));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 324 "so that lines connecting \+ the first and second points, and the third and fourth points, must nec essarily be tangent to the Bezier curve. In effect, the curve appears to be a flexible rod with red \"handles\" attached at the ends. As t he red \"handles\" are manipulated, the rod flexes and assumes the sha pe of the Bezier curve." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 33 "Constructing a Cubic Bezier Curve" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 "The four points " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "p [0] := [1,5];\np[1] := [4,7];\np[2] := [5,12];\np[3] := [9,4];" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 33 "determine the cubic Bezier curve " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "R := map(si mplify,evalm(add(binomial(3,k)*(1-u)^(3-k)*u^k*p[k],k=0..3)));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "which, along with the four points, is graphed in Figure 4 0.11." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 307 "for k from 0 to 3 do\nd||k := disk(p[k],.1,color=bla ck);\nod:\nf1 := display([d||(0..3),plot([R[1],R[2],u=0..1],color=blac k)], scaling=constrained, xtickmarks=9, ytickmarks=3, labels=[x,y], la belfont=[TIMES,ITALIC,12]):\npp:=textplot(\{[1.4,4.9,`p0`],[4.4,7,`p1` ],[5.4,12,`p2`],[9.3,4.2,`p3`]\}):display([f1,pp]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "T o understand how the control points " }{XPPEDIT 18 0 "p[1]" "6#&%\"pG6 #\"\"\"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "p[2]" "6#&%\"pG6#\"\"#" } {TEXT -1 100 " influence the shape of the Bezier curve, draw line segm ents connecting consecutive pairs of points " }{XPPEDIT 18 0 "p[k],p[k +1],k=0,1,2" "6'&%\"pG6#%\"kG&F$6#,&F&\"\"\"F*F*/F&\"\"!F*\"\"#" } {TEXT -1 39 ". Then using vector notation, and for " }{XPPEDIT 18 0 " k=0,1,2" "6%/%\"kG\"\"!\"\"\"\"\"#" }{TEXT -1 6 ", let " }{TEXT 305 1 "Q" }{XPPEDIT 18 0 "``[k+1](u)" "6#-&%!G6#,&%\"kG\"\"\"F)F)6#%\"uG" } {TEXT -1 33 " describe the segment connecting " }{XPPEDIT 18 0 "p[k]" "6#&%\"pG6#%\"kG" }{TEXT -1 6 " with " }{XPPEDIT 18 0 "p[k+1]" "6#&%\" pG6#,&%\"kG\"\"\"F(F(" }{TEXT -1 15 ". Thus, we let" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 266 "" 0 "" {TEXT -1 1 " " }{TEXT 307 1 "Q" } {XPPEDIT 18 0 "``[1]" "6#&%!G6#\"\"\"" }{XPPEDIT 18 0 "``(u)" "6#-%!G6 #%\"uG" }{TEXT -1 33 " describe the segment connecting " }{XPPEDIT 18 0 "p[0]" "6#&%\"pG6#\"\"!" }{TEXT -1 6 " with " }{XPPEDIT 18 0 "p[1]" "6#&%\"pG6#\"\"\"" }}{PARA 264 "" 0 "" {TEXT 308 1 "Q" }{XPPEDIT 18 0 "``[2]" "6#&%!G6#\"\"#" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 33 " describe the segment connecting " }{XPPEDIT 18 0 "p[1]" "6#&% \"pG6#\"\"\"" }{TEXT -1 6 " with " }{XPPEDIT 18 0 "p[2]" "6#&%\"pG6#\" \"#" }}{PARA 265 "" 0 "" {TEXT 309 1 "Q" }{XPPEDIT 18 0 "``[3]" "6#&%! G6#\"\"$" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 33 " descri be the segment connecting " }{XPPEDIT 18 0 "p[2]" "6#&%\"pG6#\"\"#" } {TEXT -1 6 " with " }{XPPEDIT 18 0 "p[3]" "6#&%\"pG6#\"\"$" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 37 "In addition, for \+ each fixed value of " }{XPPEDIT 18 0 "u" "6#%\"uG" }{TEXT -1 17 " in t he interval " }{XPPEDIT 18 0 "[0,1]" "6#7$\"\"!\"\"\"" }{TEXT -1 2 ", \+ " }{TEXT 306 1 "Q" }{XPPEDIT 18 0 "``[k](u),k=1,2,3" "6&-&%!G6#%\"kG6# %\"uG/F'\"\"\"\"\"#\"\"$" }{TEXT -1 51 ", is a single point on the res pective line segment." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 25 "We can therefore connect " }}{PARA 259 "" 0 "" {TEXT -1 11 "the points " }{TEXT 262 1 "Q" }{XPPEDIT 18 0 "``[1]" "6#&%!G6# \"\"\"" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 5 " and " } {TEXT 263 1 "Q" }{XPPEDIT 18 0 "``[2]" "6#&%!G6#\"\"#" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 23 " with the line segment " }{TEXT 264 1 "Q" }{XPPEDIT 18 0 "``[4]" "6#&%!G6#\"\"%" }{XPPEDIT 18 0 "``(u) " "6#-%!G6#%\"uG" }}{PARA 0 "" 0 "" {TEXT -1 4 "and " }}{PARA 260 "" 0 "" {TEXT -1 11 "the points " }{TEXT 265 1 "Q" }{XPPEDIT 18 0 "``[2] " "6#&%!G6#\"\"#" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 5 " and " }{TEXT 266 1 "Q" }{XPPEDIT 18 0 "``[3]" "6#&%!G6#\"\"$" } {XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 23 " with the line seg ment " }{TEXT 267 1 "Q" }{XPPEDIT 18 0 "``[5]" "6#&%!G6#\"\"&" } {XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 30 "Finally, for each fixed value " } {XPPEDIT 18 0 "u" "6#%\"uG" }{TEXT -1 17 " in the interval " } {XPPEDIT 18 0 "[0,1]" "6#7$\"\"!\"\"\"" }{TEXT -1 2 ", " }{TEXT 268 1 "Q" }{XPPEDIT 18 0 "``[4]" "6#&%!G6#\"\"%" }{XPPEDIT 18 0 "``(u)" "6#- %!G6#%\"uG" }{TEXT -1 5 " and " }{TEXT 269 1 "Q" }{XPPEDIT 18 0 "``[5] " "6#&%!G6#\"\"&" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 57 " are points which can be connected with the line segment " }{TEXT 270 1 "Q" }{XPPEDIT 18 0 "``[6]" "6#&%!G6#\"\"'" }{XPPEDIT 18 0 "``(u) " "6#-%!G6#%\"uG" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 3 "As " }{XPPEDIT 18 0 "u" "6#%\"uG" }{TEXT -1 65 " varies from 0 to 1, the corresponding point on the line segmen t " }{TEXT 271 1 "Q" }{XPPEDIT 18 0 "``[6]" "6#&%!G6#\"\"'" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 77 " traces the Bezier cubic, s hown in cyan, in Figure 40.12. The line segments " }{TEXT 272 1 "Q" } {XPPEDIT 18 0 "``[4]" "6#&%!G6#\"\"%" }{XPPEDIT 18 0 "``(u)" "6#-%!G6# %\"uG" }{TEXT -1 5 " and " }{TEXT 273 1 "Q" }{XPPEDIT 18 0 "``[5]" "6# &%!G6#\"\"&" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 40 " are shown in red, and the line segment " }{TEXT 274 1 "Q" }{XPPEDIT 18 0 "``[6]" "6#&%!G6#\"\"'" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 18 " is shown in blue." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 765 "a1 := [11/5,29/5]:\na2 := [22/5,9] :\na3 := [33/5,44/5]:\na4 := [77/25,177/25]: \na5 := [132/25,223/25]: \na6 := [99/25,977/125]:\nb1 := plot([[p[0],p[1]],[p[1],p[2]],[p[2],p[ 3]]], color = black, thickness=3):\nb2 := plot([[a1,a2],[a2,a3]],color =red):\nb3 := plot([a4,a5],color=blue):\nb4 := disk(a6,.1,color=black) :\nb5 := textplot(\{[1,4.5,`p0`], [4,6.5,`p1`], [5,12.5,`p2`], [9,3.5, `p3`]\}):\nb6 := textplot(\{[2.2,5,`Q1`], [4,9,`Q2`], [7.1,8.8,`Q3`], \+ [2.6,7.2,`Q4`], [5.3,9.1,`Q5`]\}):\nf1 := display([d||(0..3),plot([R[1 ],R[2],u=0..1],color=cyan)]):\nf2:=display([b||(1..6),f1],view=[0..10, 3..13], xtickmarks=5, ytickmarks=5, labels=[x,`y `], labelfont=[TIMES ,ITALIC,12]):\nf3 := arrow([2.4,9],[3.8,8],.07,.2,.3,color=black):\nf4 := textplot([2.1,9.2,`Q6`]):\ndisplay([f||(1..4)]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "A nalytic representations of the line segments " }{TEXT 275 1 "Q" } {XPPEDIT 18 0 "``[k]" "6#&%!G6#%\"kG" }{XPPEDIT 18 0 "``(u)" "6#-%!G6# %\"uG" }{TEXT -1 3 " = " }{TEXT 310 1 "P" }{XPPEDIT 18 0 "``[k-1]+u" " 6#,&&%!G6#,&%\"kG\"\"\"F)!\"\"F)%\"uGF)" }{TEXT -1 2 " (" }{TEXT 311 1 "P" }{XPPEDIT 18 0 "``[k]-``" "6#,&&%!G6#%\"kG\"\"\"F%!\"\"" }{TEXT 312 1 "P" }{XPPEDIT 18 0 "``[k-1]" "6#&%!G6#,&%\"kG\"\"\"F(!\"\"" } {TEXT -1 3 "), " }{XPPEDIT 18 0 "k=1,2,3" "6%/%\"kG\"\"\"\"\"#\"\"$" } {TEXT -1 5 ", are" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 111 "Q[1] := evalm(p[0] + u*(p[1]-p[0]));\nQ[2] \+ := evalm(p[1] + u*(p[2]-p[1]));\nQ[3] := evalm(p[2] + u*(p[3]-p[2])); \n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 21 "where, in each case, " }{XPPEDIT 18 0 "0<=u" "6#1 \"\"!%\"uG" }{XPPEDIT 18 0 "``<=1" "6#1%!G\"\"\"" }{TEXT -1 48 ". Ana lytic representations of the line segments" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 267 "" 0 "" {TEXT -1 1 " " }{TEXT 276 1 "Q" }{XPPEDIT 18 0 "``[k]" "6#&%!G6#%\"kG" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" } {TEXT -1 3 " = " }{TEXT 313 1 "Q" }{XPPEDIT 18 0 "``[k-3]+u" "6#,&&%!G 6#,&%\"kG\"\"\"\"\"$!\"\"F)%\"uGF)" }{TEXT -1 2 " (" }{TEXT 314 1 "Q" }{XPPEDIT 18 0 "``[k-2]-``" "6#,&&%!G6#,&%\"kG\"\"\"\"\"#!\"\"F)F%F+" }{TEXT 315 1 "Q" }{XPPEDIT 18 0 "``[k-3]" "6#&%!G6#,&%\"kG\"\"\"\"\"$! \"\"" }{TEXT -1 3 "), " }{XPPEDIT 18 0 "k=4,5" "6$/%\"kG\"\"%\"\"&" } {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 4 "are " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 101 "Q[4] := ma p(simplify,evalm(Q[1] + u*(Q[2]-Q[1])));\nQ[5] := map(simplify,evalm(Q [2] + u*(Q[3]-Q[2])));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "Finally, the analytic represent ation of the line segment " }{TEXT 277 1 "Q" }{XPPEDIT 18 0 "``[6]" "6 #&%!G6#\"\"'" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 3 " = \+ " }{TEXT 316 1 "Q" }{XPPEDIT 18 0 "``[4]+u" "6#,&&%!G6#\"\"%\"\"\"%\"u GF(" }{TEXT -1 2 " (" }{TEXT 317 1 "Q" }{XPPEDIT 18 0 "``[5]-``" "6#,& &%!G6#\"\"&\"\"\"F%!\"\"" }{TEXT 318 1 "Q" }{XPPEDIT 18 0 "``[4]" "6#& %!G6#\"\"%" }{TEXT -1 4 ") is" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "Q[6] := map(simplify,evalm(Q [4] + u*(Q[5]-Q[4])));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "For each fixed value of " } {XPPEDIT 18 0 "u" "6#%\"uG" }{TEXT -1 17 " in the interval " } {XPPEDIT 18 0 "[0,1]" "6#7$\"\"!\"\"\"" }{TEXT -1 45 " there is a sing le point on the line segment " }{TEXT 278 1 "Q" }{XPPEDIT 18 0 "``[6] " "6#&%!G6#\"\"'" }{XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 73 ". That point is a point on the Bezier cubic, as we can see by compar ing " }{TEXT 279 1 "Q" }{XPPEDIT 18 0 "``[6]" "6#&%!G6#\"\"'" } {XPPEDIT 18 0 "``(u)" "6#-%!G6#%\"uG" }{TEXT -1 15 " to the vector " } {TEXT 280 1 "R" }{TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "print(R);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "whi ch gave the Bezier curve by its definition." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 587 "Consequently, we can now see h ow the Bezier curve might have been discovered. Idly drawing four poi nts on a scrap of paper, a doodler could have connected with solid lin es, the consecutive pairs of points, then connected with dashed lines, the midpoints of the black line segments, and connected, with dotted \+ lines, the midpoints of the dashed lines. If, say, the quarter points were similarly connected, and the one-third points likewise connected , etc., it is not hard to believe that the inspired doodler would have seen that the Bezier curve is the envelop of all the dotted lines." } }{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 114 "The fol lowing animation shows the succession of red and green line-segments w hich generate the cubic Bezier curve." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 460 "F1 := t -> plot(subs(u =t,[convert(Q[1],list),convert(Q[2],list)]), color=red):\nF2 := t -> p lot(subs(u=t,[convert(Q[2],list),convert(Q[3],list)]), color=red):\nF3 := t -> plot(subs(u=t,[convert(Q[4],list),convert(Q[5],list)]), color =red):\nF4 := t -> disk(subs(u=t,convert(R,list)),.1, color=black):\nF 5 := t -> plot([R[1],R[2],u=0..t], color=green):\nF6 := t -> display([ F||(1..5)(t)]):\nF7 := display([seq(F6(k/30),k=0..30)], insequence=tru e):\ndisplay([F7,b1,b5]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 23 "The Cubic Bezier Spline" } }{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "F rom Section 40.4, the natural cubic spline interpolating the " } {XPPEDIT 18 0 "n+1=4" "6#/,&%\"nG\"\"\"F&F&\"\"%" }{TEXT -1 8 " points " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "p[0] := [0,0];\np[3] := [4,7];\np[6] := [7,2];\np[9] \+ := [10,5];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 2 "is" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "Y := spline([0,4,7,10],[0,7, 2,5],x,3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 33 "with graph shown in Figure 40.13." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 121 "plot(Y,x=0..10, color=black, labels=[x,y], labelfont=[TIMES,ITA LIC,12], xtickmarks=6, ytickmarks=8, scaling=constrained);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 409 "Both from this graph, and from the theory developed in Section 40.4, we know this spline has a continuous second derivative. Howeve r, if we wish to change the shape near one of the four interpolated po ints, we would have to recompute the complete spline. A small local c hange in the shape of the curve requires the recalculation of all the \+ coefficients of all the component polynomials making up the spline." } }{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 114 "Alterna tively, we can interpolate the given points with three Bezier cubics b y introducting control points such as" }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "p[1] := [2,2];\np[2] := [1,6];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 8 "between " }{XPPEDIT 18 0 "p[0]" "6#&%\"pG6 #\"\"!" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "p[3]" "6#&%\"pG6#\"\"$" } {TEXT -1 36 "; introducing control points such as" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "p[4] := [5, 1];\np[5] := [8,-1];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 8 "between " }{XPPEDIT 18 0 "p[3]" "6 #&%\"pG6#\"\"$" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "p[6]" "6#&%\"pG6# \"\"'" }{TEXT -1 40 "; and introducing control points such as" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "p[7] := [8,5];\np[8] := [12,-3];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 8 "between " } {XPPEDIT 18 0 "p[6]" "6#&%\"pG6#\"\"'" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "p[9]" "6#&%\"pG6#\"\"*" }{TEXT -1 71 ". Then, three separate cu bic Bezier curves can be constructed between " }{XPPEDIT 18 0 "p[0]" " 6#&%\"pG6#\"\"!" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "p[3]" "6#&%\"pG6# \"\"$" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "p[3]" "6#&%\"pG6#\"\"$" } {TEXT -1 5 " and " }{XPPEDIT 18 0 "p[6]" "6#&%\"pG6#\"\"'" }{TEXT -1 14 ", and between " }{XPPEDIT 18 0 "p[6]" "6#&%\"pG6#\"\"'" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "p[9]" "6#&%\"pG6#\"\"*" }{TEXT -1 50 ". In \+ fact, these three Bezier curves are given by" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 228 "R1 := map(simpli fy,evalm(add(binomial(3,k)*(1-u)^(3-k)*u^k*p[k],k=0..3)));\nR2 := map( simplify,evalm(add(binomial(3,k)*(1-u)^(3-k)*u^k*p[k+3],k=0..3)));\nR3 := map(simplify,evalm(add(binomial(3,k)*(1-u)^(3-k)*u^k*p[k+6],k=0..3 )));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 118 "Each Bezier segment is independent from the othe rs. This is clear even from an attempt to graph them. The parameter \+ " }{XPPEDIT 18 0 "u" "6#%\"uG" }{TEXT -1 151 " ranges between 0 and 1 \+ for each of the curves. The location of the graphs of these three seg ments is \"built-into\" the representation of each segment." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 187 "Figure 40.14 s hows these three Bezier curves, along with the control points, and th e \"handles\" at the ends of the Bezier segments, is given below. The middle segment is graphed in cyan." }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 593 "F8 := plot([R1[1],R1[2], u=0..1],color=black):\nF9 := plot([R2[1],R2[2],u=0..1],color=cyan, li nestyle=2):\nF10 := plot([R3[1],R3[2],u=0..1],color=black):\nF11 := se q(disk(p[k],.15,color=black),k=0..9):\nF12 := plot([[p[0],p[1]], [p[2] ,p[3]], [p[3],p[4]], [p[5],p[6]], [p[6],p[7]], [p[8],p[9]]], color=red , linestyle=2):\npp:=textplot(\{[.5,-.5,`p0`],[2.1,1.5,`p1`],[1,6.4,`p 2`],[4.5,7,`p3`], [5,.5,`p4`],[8.5,-1,`p5`],[7.5,2,`p6`],[8,5.5,`p7`], [12.5,-3,`p8`], [10.5,5,`p9`]\}):\ndisplay([F||(8..12),pp], scaling=co nstrained, labels=[x,`y `], labelfont=[TIMES,ITALIC,12], xtickmarks=7 , ytickmarks=5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 234 "We have lost continuity of the de rivative. The three Bezier curves form a continuous spline, but not n ecessarily a differentiable one. We have lost some degree of smoothne ss, but have gained \"local control.\" Thus, if control point " } {XPPEDIT 18 0 "p[2]" "6#&%\"pG6#\"\"#" }{TEXT -1 184 " is changed, onl y the first segment would be affected. The remaining portion of the i nterpolating spline would not have to be recalculated. We can see thi s analytically if we change " }{XPPEDIT 18 0 "p[2]" "6#&%\"pG6#\"\"#" }{TEXT -1 3 " to" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "p[2] := [1,t];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "in an attempt to vary " }{XPPEDIT 18 0 "p[2]" "6#&%\"pG6#\"\"#" }{TEXT -1 46 " thro ugh a range of values. The influence of " }{XPPEDIT 18 0 "p[2]" "6#&% \"pG6#\"\"#" }{TEXT -1 17 " is felt only by " }{TEXT 281 1 "R" } {XPPEDIT 18 0 "``[1]" "6#&%!G6#\"\"\"" }{TEXT -1 21 ", which, in terms of " }{XPPEDIT 18 0 "t" "6#%\"tG" }{TEXT -1 9 ", becomes" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "Rt : = map(simplify,evalm(add(binomial(3,k)*(1-u)^(3-k)*u^k*p[k],k=0..3))); \n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 92 "The following animation shows the complete spline \+ responding to variations in control point " }{XPPEDIT 18 0 "p[2]" "6#& %\"pG6#\"\"#" }{TEXT -1 71 ". For maximal visual impact, set the anim ation control to \"oscillate.\"" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 567 "F13 := z->plot([Rt[1],subs( t=z,Rt[2]),u=0..1],color=red):\nF14 := seq(disk(p[k],.15,color=black), k=0..1):\nF15 := seq(disk(p[k],.15,color=black),k=3..9):\nF16 := z->di splay(disk(subs(t=z,p[2]),.15,color=black)):\nF17 := plot([[p[0],p[1]] , [p[3],p[4]], [p[5],p[6]], [p[6],p[7]], [p[8],p[9]]], color=magenta, \+ linestyle=2):\nF18 := z->plot([subs(t=z,p[2]),p[3]], color=magenta, li nestyle=2):\nF19 := z-> display([F13(z),F16(z),F18(z)]):\nF20 := displ ay([seq(F19(4+k/5),k=0..25),seq(F19(9-k/5),k=1..24)], insequence=true) :\ndisplay([F9,F10,F14,F15,F17,F20], scaling=constrained);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 208 "Clearly, the Bezier spline allows local control of the shape o f the interpolating funtion. Differentiability can be regained by cho osing control points for which the slopes of contiguous \"handles\" ar e equal." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 10 "References " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 117 "[1] \+ Richard L. Burden and J. Douglas Faires, Numerical Analysis, Sixth Edi tion, Brooks/Cole Publishing Company, 1997." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 129 "[2] Curtis F. Gerald and Patri ck O. Wheatley, Applied Numerical Analysis, Fifth Edition, Addison-Wes ley Publishing Company, 1994." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{MARK "1" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }