diff --git a/components/sections/splitting/content.zh-CN.md b/components/sections/splitting/content.zh-CN.md new file mode 100644 index 00000000..4682d647 --- /dev/null +++ b/components/sections/splitting/content.zh-CN.md @@ -0,0 +1,38 @@ +# 分割曲线 + +使用 de Casteljau 算法我们也可以将一条贝塞尔曲线分割成两条更小的曲线,二者拼接起来即可形成原来的曲线。当采用某个 `t` 值构造 de Casteljau 算法时,该过程会给到我们在 `t` 点分割曲线的所有点: 一条曲线包含该曲线上点之前的所有点,另一条曲线包含该曲线上点之后的所有点。 + + + +
+ +### 分割曲线的代码实习 + +通过在 de Casteljau 函数里插入一些额外的输出代码,我们就可以实现曲线的分割: + +``` +left=[] +right=[] +function drawCurve(points[], t): + if(points.length==1): + left.add(points[0]) + right.add(points[0]) + draw(points[0]) + else: + newpoints=array(points.size-1) + for(i=0; i + +以下是带动画效果的最好的演示(点击以播放/暂停): + +