From fdc7c33fe876ca29b02e961e22d922154a7a163d Mon Sep 17 00:00:00 2001 From: thejinchao Date: Sat, 8 Mar 2025 19:15:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/public/html/bezier.html | 2 +- .../.vuepress/public/js/{bezier_app.js => bezier_quad.js} | 6 +++--- docs/blog/2025/03/BezierLine01.md | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename docs/.vuepress/public/js/{bezier_app.js => bezier_quad.js} (90%) diff --git a/docs/.vuepress/public/html/bezier.html b/docs/.vuepress/public/html/bezier.html index 314f0ef..82d97d9 100644 --- a/docs/.vuepress/public/html/bezier.html +++ b/docs/.vuepress/public/html/bezier.html @@ -1,7 +1,7 @@ - + diff --git a/docs/.vuepress/public/js/bezier_app.js b/docs/.vuepress/public/js/bezier_quad.js similarity index 90% rename from docs/.vuepress/public/js/bezier_app.js rename to docs/.vuepress/public/js/bezier_quad.js index b21cde1..60f875b 100644 --- a/docs/.vuepress/public/js/bezier_app.js +++ b/docs/.vuepress/public/js/bezier_quad.js @@ -12,9 +12,9 @@ class QuadBezierLine { } //Length(t) = Integrate[Speed[t], t] - //Length(t_)=((2*Sqrt[A]*(2*A*t*Sqrt[C+t*(B+A*t)]+B*(Sqrt[C + t*(B + A*t)]-Sqrt[C])) + - // (B^2-4*A*C)(Log[B+2*Sqrt[A]*Sqrt[C]]-Log[B+2*A*t+2*Sqrt[A]*Sqrt[C+t*(B+A*t)]]))/ - // (8* A^(3/2))); + //Length(t_) = ((2*Sqrt[A]*((2*A*t + B)*Sqrt[A*t^2 + B*t + C] - B*Sqrt[C]) + + // (B^2 - 4*A*C)*(Log[B + 2*Sqrt[A]*Sqrt[C]] - + // Log[B + 2*A*t + 2*Sqrt[A]*Sqrt[A*t^2 + B*t + C]]))/(8*A^(3/2))) length(t) { let temp1 = Math.sqrt(this.C + t * (this.B + this.A * t)); let temp2 = (2 * this.A * t * temp1 + this.B * (temp1 - Math.sqrt(this.C))); diff --git a/docs/blog/2025/03/BezierLine01.md b/docs/blog/2025/03/BezierLine01.md index afe75a5..8681941 100644 --- a/docs/blog/2025/03/BezierLine01.md +++ b/docs/blog/2025/03/BezierLine01.md @@ -1,8 +1,8 @@ --- -title: "匀速贝塞尔曲线运动的实现" +title: "匀速贝塞尔曲线运动的实现(一)" tags: 程序 算法 --- -# 匀速贝塞尔曲线运动的实现 +# 匀速贝塞尔曲线运动的实现(一) 贝塞尔曲线([Bézier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve))是一种常用的曲线,以最简单的二次贝塞尔曲线为例,通常以如下方式构建,给定二维平面上的固定点$P_0$, $P_1$, $P_2$,用$B(t)$表示该条曲线  $$ @@ -40,7 +40,7 @@ $$ $$ \begin{aligned} L(t)&=\int_0^t\sqrt{Ax^2+Bx+C}dx\\ -&=\frac{1}{8A^{3/2}}\biggl(2\sqrt{A}\left[2At\sqrt{At^2+Bt+C}+B\left(\sqrt{At^2+Bt+C}-\sqrt{C}\right)\right] \\ +&=\frac{1}{8A^{3/2}}\biggl(2\sqrt{A}\left[(2At+B)\sqrt{At^2+Bt+C}-B\sqrt{C}\right] \\ &\quad+(B^2-4AC)\left[ln(B+2\sqrt{AC})-ln\left(B+2At+2\sqrt{A}\sqrt{At^2+Bt+C}\right)\right]\biggr) \end{aligned} $$ @@ -66,4 +66,4 @@ $$ 上面是使用javascript实现的互动曲线,核心代码如下 -@[code js :no-line-numbers](@public/js/bezier_app.js) +@[code js :no-line-numbers](@public/js/bezier_quad.js)