import{_ as l,c as n,b as a,a as s,d as Q,o as T}from"./app-CNQ1C_0h.js";const o="/images/2025/03/bezier_2_big.gif",e={},m={class:"MathJax",jax:"SVG",style:{position:"relative"}},p={style:{"vertical-align":"-0.375ex"},xmlns:"http://www.w3.org/2000/svg",width:"2.44ex",height:"1.92ex",role:"img",focusable:"false",viewBox:"0 -683 1078.6 848.6","aria-hidden":"true"},r={class:"MathJax",jax:"SVG",style:{position:"relative"}},d={style:{"vertical-align":"-0.339ex"},xmlns:"http://www.w3.org/2000/svg",width:"2.44ex",height:"1.885ex",role:"img",focusable:"false",viewBox:"0 -683 1078.6 833","aria-hidden":"true"},i={class:"MathJax",jax:"SVG",style:{position:"relative"}},c={style:{"vertical-align":"-0.339ex"},xmlns:"http://www.w3.org/2000/svg",width:"2.44ex",height:"1.885ex",role:"img",focusable:"false",viewBox:"0 -683 1078.6 833","aria-hidden":"true"},g={class:"MathJax",jax:"SVG",style:{position:"relative"}},H={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"4.294ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 1898 1000","aria-hidden":"true"},u={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},h={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"48.118ex",height:"2.565ex",role:"img",focusable:"false",viewBox:"0 -883.9 21268.1 1133.9","aria-hidden":"true"},L={class:"MathJax",jax:"SVG",style:{position:"relative"}},k={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"0.817ex",height:"1.441ex",role:"img",focusable:"false",viewBox:"0 -626 361 637","aria-hidden":"true"},f={class:"MathJax",jax:"SVG",style:{position:"relative"}},M={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"4.294ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 1898 1000","aria-hidden":"true"},w={class:"MathJax",jax:"SVG",style:{position:"relative"}},Z={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"0.817ex",height:"1.441ex",role:"img",focusable:"false",viewBox:"0 -626 361 637","aria-hidden":"true"},x={class:"MathJax",jax:"SVG",style:{position:"relative"}},V={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.638ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 1608 1000","aria-hidden":"true"},y={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},b={style:{"vertical-align":"-1.344ex"},xmlns:"http://www.w3.org/2000/svg",width:"24.367ex",height:"4.208ex",role:"img",focusable:"false",viewBox:"0 -1265.9 10770.1 1860","aria-hidden":"true"},v={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},D={style:{"vertical-align":"-7.123ex"},xmlns:"http://www.w3.org/2000/svg",width:"19.629ex",height:"15.377ex",role:"img",focusable:"false",viewBox:"0 -3648.4 8676.2 6796.7","aria-hidden":"true"},j={class:"MathJax",jax:"SVG",style:{position:"relative"}},B={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.638ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 1608 1000","aria-hidden":"true"},C={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},S={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"22.249ex",height:"3.086ex",role:"img",focusable:"false",viewBox:"0 -1114.2 9834 1364.2","aria-hidden":"true"},A={class:"MathJax",jax:"SVG",style:{position:"relative"}},q={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"4.118ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 1820 1000","aria-hidden":"true"},J={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},G={style:{"vertical-align":"-8.304ex"},xmlns:"http://www.w3.org/2000/svg",width:"77.97ex",height:"17.739ex",role:"img",focusable:"false",viewBox:"0 -4170.3 34462.6 7840.6","aria-hidden":"true"},E={class:"MathJax",jax:"SVG",style:{position:"relative"}},O={style:{"vertical-align":"-0.186ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.725ex",height:"1.692ex",role:"img",focusable:"false",viewBox:"0 -666 2972.6 748","aria-hidden":"true"},F={class:"MathJax",jax:"SVG",style:{position:"relative"}},R={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.192ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 2737 1000","aria-hidden":"true"},P={class:"MathJax",jax:"SVG",style:{position:"relative"}},N={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},z={class:"MathJax",jax:"SVG",style:{position:"relative"}},X={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"4.595ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 2031 1000","aria-hidden":"true"},I={class:"MathJax",jax:"SVG",style:{position:"relative"}},Y={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"0.817ex",height:"1.441ex",role:"img",focusable:"false",viewBox:"0 -626 361 637","aria-hidden":"true"},K={class:"MathJax",jax:"SVG",display:"true",width:"full",style:{"min-width":"24.024ex",position:"relative"}},U={style:{"vertical-align":"-0.566ex","min-width":"24.024ex"},xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"2.262ex",role:"img",focusable:"false","aria-hidden":"true"},W={class:"MathJax",jax:"SVG",style:{position:"relative"}},$={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"16.853ex",height:"2.452ex",role:"img",focusable:"false",viewBox:"0 -833.9 7449.2 1083.9","aria-hidden":"true"},_={class:"MathJax",jax:"SVG",style:{position:"relative"}},a2={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"4.118ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 1820 1000","aria-hidden":"true"},t2={class:"MathJax",jax:"SVG",style:{position:"relative"}},Q2={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"3.638ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 1608 1000","aria-hidden":"true"},n2={class:"MathJax",jax:"SVG",style:{position:"relative"}},T2={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},s2={class:"MathJax",jax:"SVG",style:{position:"relative"}},l2={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},o2={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},e2={style:{"vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"26.284ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 11617.6 1000","aria-hidden":"true"},m2={class:"MathJax",jax:"SVG",style:{position:"relative"}},p2={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},r2={class:"MathJax",jax:"SVG",display:"true",style:{position:"relative"}},d2={style:{"vertical-align":"-5.249ex"},xmlns:"http://www.w3.org/2000/svg",width:"29.224ex",height:"11.629ex",role:"img",focusable:"false",viewBox:"0 -2820 12916.9 5140","aria-hidden":"true"},i2={class:"MathJax",jax:"SVG",style:{position:"relative"}},c2={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"0.817ex",height:"1.441ex",role:"img",focusable:"false",viewBox:"0 -626 361 637","aria-hidden":"true"},g2={class:"MathJax",jax:"SVG",style:{position:"relative"}},H2={style:{"vertical-align":"-0.025ex"},xmlns:"http://www.w3.org/2000/svg",width:"1.294ex",height:"1.025ex",role:"img",focusable:"false",viewBox:"0 -442 572 453","aria-hidden":"true"},u2={class:"MathJax",jax:"SVG",style:{position:"relative"}},h2={style:{"vertical-align":"-0.375ex"},xmlns:"http://www.w3.org/2000/svg",width:"6.116ex",height:"1.791ex",role:"img",focusable:"false",viewBox:"0 -626 2703.1 791.6","aria-hidden":"true"};function L2(k2,t){return T(),n("div",null,[t[104]||(t[104]=a("h1",{id:"匀速贝塞尔曲线运动的实现-一",tabindex:"-1"},[a("a",{class:"header-anchor",href:"#匀速贝塞尔曲线运动的实现-一"},[a("span",null,"匀速贝塞尔曲线运动的实现(一)")])],-1)),a("p",null,[t[8]||(t[8]=Q("贝塞尔曲线(")),t[9]||(t[9]=a("a",{href:"https://en.wikipedia.org/wiki/B%C3%A9zier_curve",target:"_blank",rel:"noopener noreferrer"},"Bézier curve",-1)),t[10]||(t[10]=Q(")是一种常用的曲线,以最简单的二次贝塞尔曲线为例,通常以如下方式构建,给定二维平面上的固定点")),a("mjx-container",m,[(T(),n("svg",p,t[0]||(t[0]=[s(' ',1)]))),t[1]||(t[1]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("msub",null,[a("mi",null,"P"),a("mn",null,"0")])])],-1))]),t[11]||(t[11]=Q(", ")),a("mjx-container",r,[(T(),n("svg",d,t[2]||(t[2]=[s(' ',1)]))),t[3]||(t[3]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("msub",null,[a("mi",null,"P"),a("mn",null,"1")])])],-1))]),t[12]||(t[12]=Q(", ")),a("mjx-container",i,[(T(),n("svg",c,t[4]||(t[4]=[s(' ',1)]))),t[5]||(t[5]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("msub",null,[a("mi",null,"P"),a("mn",null,"2")])])],-1))]),t[13]||(t[13]=Q(",用")),a("mjx-container",g,[(T(),n("svg",H,t[6]||(t[6]=[s(' ',1)]))),t[7]||(t[7]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"B"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))]),t[14]||(t[14]=Q("表示该条曲线"))]),a("mjx-container",u,[(T(),n("svg",h,t[15]||(t[15]=[s(' ',1)]))),t[16]||(t[16]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mi",{mathvariant:"bold-italic"},"B"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")"),a("mo",null,"="),a("mo",{stretchy:"false"},"("),a("mn",null,"1"),a("mo",null,"−"),a("mi",null,"t"),a("msup",null,[a("mo",{stretchy:"false"},")"),a("mn",null,"2")]),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"0")]),a("mo",null,"+"),a("mn",null,"2"),a("mi",null,"t"),a("mo",{stretchy:"false"},"("),a("mn",null,"1"),a("mo",null,"−"),a("mi",null,"t"),a("mo",{stretchy:"false"},")"),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"1")]),a("mo",null,"+"),a("msup",null,[a("mi",null,"t"),a("mn",null,"2")]),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"2")]),a("mo",null,","),a("mi",null,"t"),a("mo",null,"∈"),a("mo",{stretchy:"false"},"["),a("mn",null,"0"),a("mo",null,","),a("mn",null,"1"),a("mo",{stretchy:"false"},"]")])],-1))]),t[105]||(t[105]=a("p",null,"用一个动画来演示,可以更加清楚的表明这条曲线的构建过程",-1)),t[106]||(t[106]=a("figure",null,[a("img",{src:o,alt:"",tabindex:"0",loading:"lazy"}),a("figcaption")],-1)),a("p",null,[t[19]||(t[19]=Q("如果")),a("mjx-container",L,[(T(),n("svg",k,t[17]||(t[17]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D461",d:"M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"})])])],-1)]))),t[18]||(t[18]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"t")])],-1))]),t[20]||(t[20]=Q("变量本身是线性变化的话,这条贝塞尔曲线的生成过程是并不是匀速的,通常都是两头快中间慢。"))]),t[107]||(t[107]=a("iframe",{width:"100%",height:"270",frameborder:"0",src:"/html/bezier01.html?uniformSpeed=0"},null,-1)),a("p",null,[t[27]||(t[27]=Q("可以看出中间的点较为密集,而两边则较为稀疏。 如何得到匀速的贝塞尔曲线运动呢?比如我们在某款游戏中设计了一条贝塞尔曲线的路径,如何实现NPC匀速在这条路径上运动? 首先需要求得")),a("mjx-container",f,[(T(),n("svg",M,t[21]||(t[21]=[s(' ',1)]))),t[22]||(t[22]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"B"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))]),t[28]||(t[28]=Q("相对于")),a("mjx-container",w,[(T(),n("svg",Z,t[23]||(t[23]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D461",d:"M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"})])])],-1)]))),t[24]||(t[24]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"t")])],-1))]),t[29]||(t[29]=Q("的速度公式")),a("mjx-container",x,[(T(),n("svg",V,t[25]||(t[25]=[s(' ',1)]))),t[26]||(t[26]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"s"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))])]),a("mjx-container",y,[(T(),n("svg",b,t[30]||(t[30]=[s(' ',1)]))),t[31]||(t[31]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mi",null,"s"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")"),a("mo",null,"="),a("msqrt",null,[a("msubsup",null,[a("mi",null,"B"),a("mrow",{"data-mjx-texclass":"ORD"},[a("mi",null,"x")]),a("mrow",{"data-mjx-texclass":"ORD"},[a("msup",null,[a("mi"),a("mo",{"data-mjx-alternate":"1"},"′")])])]),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("msup",null,[a("mo",{stretchy:"false"},")"),a("mn",null,"2")]),a("mo",null,"+"),a("msubsup",null,[a("mi",null,"B"),a("mrow",{"data-mjx-texclass":"ORD"},[a("mi",null,"y")]),a("mrow",{"data-mjx-texclass":"ORD"},[a("msup",null,[a("mi"),a("mo",{"data-mjx-alternate":"1"},"′")])])]),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("msup",null,[a("mo",{stretchy:"false"},")"),a("mn",null,"2")])])])],-1))]),t[108]||(t[108]=a("p",null,"为了简化公式,定义如下变量",-1)),a("mjx-container",v,[(T(),n("svg",D,t[32]||(t[32]=[s(' ',1)]))),t[33]||(t[33]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mtable",{displaystyle:"true",columnalign:"right left",columnspacing:"0em",rowspacing:"3pt"},[a("mtr",null,[a("mtd",null,[a("mi",{mathvariant:"bold-italic"},"a")]),a("mtd",null,[a("mi"),a("mo",null,"="),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"0")]),a("mo",null,"−"),a("mn",null,"2"),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"1")]),a("mo",null,"+"),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"2")])])]),a("mtr",null,[a("mtd",null,[a("mi",{mathvariant:"bold-italic"},"b")]),a("mtd",null,[a("mi"),a("mo",null,"="),a("mn",null,"2"),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"1")]),a("mo",null,"−"),a("mn",null,"2"),a("msub",null,[a("mi",{mathvariant:"bold-italic"},"P"),a("mn",{mathvariant:"bold"},"0")])])]),a("mtr",null,[a("mtd",null,[a("mi",null,"A")]),a("mtd",null,[a("mi"),a("mo",null,"="),a("mn",null,"4"),a("mo",{stretchy:"false"},"("),a("msubsup",null,[a("mi",null,"a"),a("mi",null,"x"),a("mn",null,"2")]),a("mo",null,"+"),a("msubsup",null,[a("mi",null,"a"),a("mi",null,"y"),a("mn",null,"2")]),a("mo",{stretchy:"false"},")")])]),a("mtr",null,[a("mtd",null,[a("mi",null,"B")]),a("mtd",null,[a("mi"),a("mo",null,"="),a("mn",null,"4"),a("mo",{stretchy:"false"},"("),a("msub",null,[a("mi",null,"a"),a("mi",null,"x")]),a("msub",null,[a("mi",null,"b"),a("mi",null,"x")]),a("mo",null,"+"),a("msub",null,[a("mi",null,"a"),a("mi",null,"y")]),a("msub",null,[a("mi",null,"b"),a("mi",null,"y")]),a("mo",{stretchy:"false"},")")])]),a("mtr",null,[a("mtd",null,[a("mi",null,"C")]),a("mtd",null,[a("mi"),a("mo",null,"="),a("msubsup",null,[a("mi",null,"b"),a("mi",null,"x"),a("mn",null,"2")]),a("mo",null,"+"),a("msubsup",null,[a("mi",null,"b"),a("mi",null,"y"),a("mn",null,"2")])])])])])],-1))]),a("p",null,[t[36]||(t[36]=Q("计算出")),a("mjx-container",j,[(T(),n("svg",B,t[34]||(t[34]=[s(' ',1)]))),t[35]||(t[35]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"s"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))]),t[37]||(t[37]=Q("可以表达为"))]),a("mjx-container",C,[(T(),n("svg",S,t[38]||(t[38]=[s(' ',1)]))),t[39]||(t[39]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mi",null,"s"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")"),a("mo",null,"="),a("msqrt",null,[a("mi",null,"A"),a("msup",null,[a("mi",null,"t"),a("mn",null,"2")]),a("mo",null,"+"),a("mi",null,"B"),a("mi",null,"t"),a("mo",null,"+"),a("mi",null,"C")])])],-1))]),a("p",null,[t[42]||(t[42]=Q("根据这个公式,求得贝塞尔曲线的长度公式")),a("mjx-container",A,[(T(),n("svg",q,t[40]||(t[40]=[s(' ',1)]))),t[41]||(t[41]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))]),t[43]||(t[43]=Q("为"))]),a("mjx-container",J,[(T(),n("svg",G,t[44]||(t[44]=[s(' ',1)]))),t[45]||(t[45]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mtable",{displaystyle:"true",columnalign:"right left",columnspacing:"0em",rowspacing:"3pt"},[a("mtr",null,[a("mtd",null,[a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")]),a("mtd",null,[a("mi"),a("mo",null,"="),a("msubsup",null,[a("mo",{"data-mjx-texclass":"OP"},"∫"),a("mn",null,"0"),a("mi",null,"t")]),a("msqrt",null,[a("mi",null,"A"),a("msup",null,[a("mi",null,"x"),a("mn",null,"2")]),a("mo",null,"+"),a("mi",null,"B"),a("mi",null,"x"),a("mo",null,"+"),a("mi",null,"C")]),a("mi",null,"d"),a("mi",null,"x")])]),a("mtr",null,[a("mtd"),a("mtd",null,[a("mi"),a("mo",null,"="),a("mfrac",null,[a("mn",null,"1"),a("mrow",null,[a("mn",null,"8"),a("msup",null,[a("mi",null,"A"),a("mrow",{"data-mjx-texclass":"ORD"},[a("mn",null,"3"),a("mrow",{"data-mjx-texclass":"ORD"},[a("mo",null,"/")]),a("mn",null,"2")])])])]),a("mrow",{"data-mjx-texclass":"OPEN"},[a("mo",{minsize:"2.047em",maxsize:"2.047em"},"(")]),a("mn",null,"2"),a("msqrt",null,[a("mi",null,"A")]),a("mrow",{"data-mjx-texclass":"INNER"},[a("mo",{"data-mjx-texclass":"OPEN"},"["),a("mo",{stretchy:"false"},"("),a("mn",null,"2"),a("mi",null,"A"),a("mi",null,"t"),a("mo",null,"+"),a("mi",null,"B"),a("mo",{stretchy:"false"},")"),a("msqrt",null,[a("mi",null,"A"),a("msup",null,[a("mi",null,"t"),a("mn",null,"2")]),a("mo",null,"+"),a("mi",null,"B"),a("mi",null,"t"),a("mo",null,"+"),a("mi",null,"C")]),a("mo",null,"−"),a("mi",null,"B"),a("msqrt",null,[a("mi",null,"C")]),a("mo",{"data-mjx-texclass":"CLOSE"},"]")])])]),a("mtr",null,[a("mtd"),a("mtd",null,[a("mstyle",{scriptlevel:"0"},[a("mspace",{width:"1em"})]),a("mo",null,"+"),a("mo",{stretchy:"false"},"("),a("msup",null,[a("mi",null,"B"),a("mn",null,"2")]),a("mo",null,"−"),a("mn",null,"4"),a("mi",null,"A"),a("mi",null,"C"),a("mo",{stretchy:"false"},")"),a("mrow",{"data-mjx-texclass":"INNER"},[a("mo",{"data-mjx-texclass":"OPEN"},"["),a("mi",null,"l"),a("mi",null,"n"),a("mo",{stretchy:"false"},"("),a("mi",null,"B"),a("mo",null,"+"),a("mn",null,"2"),a("msqrt",null,[a("mi",null,"A"),a("mi",null,"C")]),a("mo",{stretchy:"false"},")"),a("mo",null,"−"),a("mi",null,"l"),a("mi",null,"n"),a("mrow",{"data-mjx-texclass":"INNER"},[a("mo",{"data-mjx-texclass":"OPEN"},"("),a("mi",null,"B"),a("mo",null,"+"),a("mn",null,"2"),a("mi",null,"A"),a("mi",null,"t"),a("mo",null,"+"),a("mn",null,"2"),a("msqrt",null,[a("mi",null,"A")]),a("msqrt",null,[a("mi",null,"A"),a("msup",null,[a("mi",null,"t"),a("mn",null,"2")]),a("mo",null,"+"),a("mi",null,"B"),a("mi",null,"t"),a("mo",null,"+"),a("mi",null,"C")]),a("mo",{"data-mjx-texclass":"CLOSE"},")")]),a("mo",{"data-mjx-texclass":"CLOSE"},"]")]),a("mrow",{"data-mjx-texclass":"CLOSE"},[a("mo",{minsize:"2.047em",maxsize:"2.047em"},")")])])])])])],-1))]),a("p",null,[t[56]||(t[56]=Q("特别当")),a("mjx-container",E,[(T(),n("svg",O,t[46]||(t[46]=[s(' ',1)]))),t[47]||(t[47]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"t"),a("mo",null,"="),a("mn",null,"1.0")])],-1))]),t[57]||(t[57]=Q("时,")),a("mjx-container",F,[(T(),n("svg",R,t[48]||(t[48]=[s(' ',1)]))),t[49]||(t[49]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mn",null,"1.0"),a("mo",{stretchy:"false"},")")])],-1))]),t[58]||(t[58]=Q("就是这条曲线的总长度。")),t[59]||(t[59]=a("br",null,null,-1)),t[60]||(t[60]=Q(" 设")),a("mjx-container",P,[(T(),n("svg",N,t[50]||(t[50]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D462",d:"M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),t[51]||(t[51]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"u")])],-1))]),t[61]||(t[61]=Q("是能够使")),a("mjx-container",z,[(T(),n("svg",X,t[52]||(t[52]=[s(' ',1)]))),t[53]||(t[53]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mi",null,"u"),a("mo",{stretchy:"false"},")")])],-1))]),t[62]||(t[62]=Q("实现匀速运动的自变量,那么此时曲线长度应该满足随着时间")),a("mjx-container",I,[(T(),n("svg",Y,t[54]||(t[54]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D461",d:"M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"})])])],-1)]))),t[55]||(t[55]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"t")])],-1))]),t[63]||(t[63]=Q("线性增长,也就是"))]),a("mjx-container",K,[(T(),n("svg",U,t[64]||(t[64]=[s(' ',1)]))),t[65]||(t[65]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mtable",{displaystyle:"true"},[a("mlabeledtr",null,[a("mtd",null,[a("mtext",null,"(1)")]),a("mtd",null,[a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mi",null,"u"),a("mo",{stretchy:"false"},")"),a("mo",null,"="),a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mn",null,"1.0"),a("mo",{stretchy:"false"},")"),a("mi",null,"t")])])])])],-1))]),a("p",null,[t[76]||(t[76]=Q("也就是")),a("mjx-container",W,[(T(),n("svg",$,t[66]||(t[66]=[s(' ',1)]))),t[67]||(t[67]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"u"),a("mo",null,"="),a("msup",null,[a("mi",null,"L"),a("mrow",{"data-mjx-texclass":"ORD"},[a("mo",null,"−"),a("mn",null,"1")])]),a("mo",{stretchy:"false"},"("),a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mn",null,"1.0"),a("mo",{stretchy:"false"},")"),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))]),t[77]||(t[77]=Q(",由于")),a("mjx-container",_,[(T(),n("svg",a2,t[68]||(t[68]=[s(' ',1)]))),t[69]||(t[69]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))]),t[78]||(t[78]=Q("函数非常复杂,直接求其逆函数的解析解几乎不可能,还好我们知道它的导数为")),a("mjx-container",t2,[(T(),n("svg",Q2,t[70]||(t[70]=[s(' ',1)]))),t[71]||(t[71]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"s"),a("mo",{stretchy:"false"},"("),a("mi",null,"t"),a("mo",{stretchy:"false"},")")])],-1))]),t[79]||(t[79]=Q(",在实际使用中,可以使用")),t[80]||(t[80]=a("a",{href:"https://en.wikipedia.org/wiki/Newton%27s_method",target:"_blank",rel:"noopener noreferrer"},"牛顿切线法",-1)),t[81]||(t[81]=Q("获得")),a("mjx-container",n2,[(T(),n("svg",T2,t[72]||(t[72]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D462",d:"M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),t[73]||(t[73]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"u")])],-1))]),t[82]||(t[82]=Q("的数值解。")),t[83]||(t[83]=a("br",null,null,-1)),t[84]||(t[84]=Q(" 视")),a("mjx-container",s2,[(T(),n("svg",l2,t[74]||(t[74]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D462",d:"M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),t[75]||(t[75]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"u")])],-1))]),t[85]||(t[85]=Q("为未知数,根据公式1有以下方程"))]),a("mjx-container",o2,[(T(),n("svg",e2,t[86]||(t[86]=[s(' ',1)]))),t[87]||(t[87]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mi",null,"F"),a("mo",{stretchy:"false"},"("),a("mi",null,"u"),a("mo",{stretchy:"false"},")"),a("mo",null,"="),a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mi",null,"u"),a("mo",{stretchy:"false"},")"),a("mo",null,"−"),a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mn",null,"1.0"),a("mo",{stretchy:"false"},")"),a("mi",null,"t"),a("mo",null,"="),a("mn",null,"0")])],-1))]),a("p",null,[t[90]||(t[90]=Q("根据牛顿切线法,求解")),a("mjx-container",m2,[(T(),n("svg",p2,t[88]||(t[88]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D462",d:"M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),t[89]||(t[89]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"u")])],-1))]),t[91]||(t[91]=Q("的迭代公式为:"))]),a("mjx-container",r2,[(T(),n("svg",d2,t[92]||(t[92]=[s(' ',1)]))),t[93]||(t[93]=a("mjx-assistive-mml",{unselectable:"on",display:"block"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML",display:"block"},[a("mtable",{displaystyle:"true",columnalign:"right left",columnspacing:"0em",rowspacing:"3pt"},[a("mtr",null,[a("mtd",null,[a("msub",null,[a("mi",null,"u"),a("mrow",{"data-mjx-texclass":"ORD"},[a("mi",null,"n"),a("mo",null,"+"),a("mn",null,"1")])])]),a("mtd",null,[a("mi"),a("mo",null,"="),a("msub",null,[a("mi",null,"u"),a("mi",null,"n")]),a("mo",null,"−"),a("mfrac",null,[a("mrow",null,[a("mi",null,"F"),a("mo",{stretchy:"false"},"("),a("msub",null,[a("mi",null,"u"),a("mi",null,"n")]),a("mo",{stretchy:"false"},")")]),a("mrow",null,[a("msup",null,[a("mi",null,"F"),a("mo",{"data-mjx-alternate":"1"},"′")]),a("mo",{stretchy:"false"},"("),a("msub",null,[a("mi",null,"u"),a("mi",null,"n")]),a("mo",{stretchy:"false"},")")])])])]),a("mtr",null,[a("mtd"),a("mtd",null,[a("mi"),a("mo",null,"="),a("msub",null,[a("mi",null,"u"),a("mi",null,"n")]),a("mo",null,"−"),a("mfrac",null,[a("mrow",null,[a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("msub",null,[a("mi",null,"u"),a("mi",null,"n")]),a("mo",{stretchy:"false"},")"),a("mo",null,"−"),a("mi",null,"L"),a("mo",{stretchy:"false"},"("),a("mn",null,"1.0"),a("mo",{stretchy:"false"},")"),a("mi",null,"t")]),a("mrow",null,[a("mi",null,"s"),a("mo",{stretchy:"false"},"("),a("msub",null,[a("mi",null,"u"),a("mi",null,"n")]),a("mo",{stretchy:"false"},")")])])])])])])],-1))]),a("p",null,[t[100]||(t[100]=Q("由于")),a("mjx-container",i2,[(T(),n("svg",c2,t[94]||(t[94]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D461",d:"M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"})])])],-1)]))),t[95]||(t[95]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"t")])],-1))]),t[101]||(t[101]=Q("和")),a("mjx-container",g2,[(T(),n("svg",H2,t[96]||(t[96]=[a("g",{stroke:"currentColor",fill:"currentColor","stroke-width":"0",transform:"scale(1,-1)"},[a("g",{"data-mml-node":"math"},[a("g",{"data-mml-node":"mi"},[a("path",{"data-c":"1D462",d:"M21 287Q21 295 30 318T55 370T99 420T158 442Q204 442 227 417T250 358Q250 340 216 246T182 105Q182 62 196 45T238 27T291 44T328 78L339 95Q341 99 377 247Q407 367 413 387T427 416Q444 431 463 431Q480 431 488 421T496 402L420 84Q419 79 419 68Q419 43 426 35T447 26Q469 29 482 57T512 145Q514 153 532 153Q551 153 551 144Q550 139 549 130T540 98T523 55T498 17T462 -8Q454 -10 438 -10Q372 -10 347 46Q345 45 336 36T318 21T296 6T267 -6T233 -11Q189 -11 155 7Q103 38 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"})])])],-1)]))),t[97]||(t[97]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"u")])],-1))]),t[102]||(t[102]=Q("相差不大,可以设")),a("mjx-container",u2,[(T(),n("svg",h2,t[98]||(t[98]=[s(' ',1)]))),t[99]||(t[99]=a("mjx-assistive-mml",{unselectable:"on",display:"inline"},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("msub",null,[a("mi",null,"u"),a("mn",null,"0")]),a("mo",null,"="),a("mi",null,"t")])],-1))]),t[103]||(t[103]=Q("来开始求解,以下是修正后的匀速贝塞尔曲线"))]),t[109]||(t[109]=a("iframe",{width:"100%",height:"270",frameborder:"0",src:"/html/bezier01.html?uniformSpeed=1"},null,-1)),t[110]||(t[110]=s(`
上面是使用javascript实现的互动曲线,核心代码如下
class QuadBezierLine {
constructor ( _p0, _p1, _p2, _step, _uniformSpeedMode ) {
this . step= _step;
this . points= [ ] ;
this . uniformSpeedMode= _uniformSpeedMode;
this . updatePoints ( _p0, _p1, _p2) ;
}
speed ( t ) {
return Math. sqrt ( this . A * t * t + this . B * t + this . C ) ;
}
length ( t ) {
let temp1 = Math. sqrt ( this . C + t * ( this . B + this . A * t) ) ;
let temp2 = ( 2 * this . A * t + this . B ) * temp1 - this . B * Math. sqrt ( this . C ) ;
let temp3 = Math. log ( this . B + 2 * Math. sqrt ( this . A * this . C ) ) ;
let temp4 = Math. log ( this . B + 2 * this . A * t + 2 * Math. sqrt ( this . A ) * temp1) ;
let temp5 = 2 * Math. sqrt ( this . A ) * temp2;
let temp6 = ( this . B * this . B - 4 * this . A * this . C ) * ( temp3 - temp4) ;
return ( temp5 + temp6) / ( 8 * Math. pow ( this . A , 1.5 ) ) ;
}
invertLength ( u0, len ) {
let u1 = u0, u2;
do {
u2 = u1 - ( this . length ( u1) - len) / this . speed ( u1) ;
if ( Math. abs ( u1 - u2) < 0.000001 )
break ;
u1 = u2;
} while ( true ) ;
return u2;
}
updatePoints ( _p0, _p1, _p2 ) {
this . p0= _p0;
this . p1= _p1;
this . p2= _p2;
let ax = this . p0. x - 2 * this . p1. x + this . p2. x;
let ay = this . p0. y - 2 * this . p1. y + this . p2. y;
let bx = 2 * this . p1. x - 2 * this . p0. x;
let by = 2 * this . p1. y - 2 * this . p0. y;
this . A = 4 * ( ax * ax + ay * ay) ;
this . B = 4 * ( ax * bx + ay * by) ;
this . C = bx * bx + by * by;
this . points. length = 0 ;
let totalLength = this . length ( 1 ) ;
for ( let index = 1 ; index < this . step; index++ ) {
let t = index / this . step;
if ( this . uniformSpeedMode) {
t = this . invertLength ( t, totalLength* t) ;
}
let x = ( 1 - t) * ( 1 - t) * this . p0. x+ 2 * ( 1 - t) * t* this . p1. x+ t* t* this . p2. x;
let y = ( 1 - t) * ( 1 - t) * this . p0. y+ 2 * ( 1 - t) * t* this . p1. y+ t* t* this . p2. y;
this . points. push ( { x : x, y : y} ) ;
}
}
draw ( ) {
this . points. forEach ( pt => {
fill ( 'green' ) ;
ellipse ( pt. x, pt. y, 5 , 5 ) ;
} ) ;
}
}
`,2))])}const M2=l(e,[["render",L2],["__file","BezierLine01.html.vue"]]),w2=JSON.parse('{"path":"/blog/2025/03/BezierLine01.html","title":"匀速贝塞尔曲线运动的实现(一)","lang":"zh-CN","frontmatter":{"title":"匀速贝塞尔曲线运动的实现(一)","tags":"程序 算法"},"headers":[],"git":{},"filePathRelative":"blog/2025/03/BezierLine01.md"}');export{M2 as comp,w2 as data};