1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-09-02 21:02:49 +02:00

update drawCurve to drawCurvePoint to better reflect what it does

This commit is contained in:
Pomax
2021-08-30 07:44:49 -07:00
parent 316d82b107
commit 0bc057e811
6 changed files with 20 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ We can implement curve splitting by bolting some extra logging onto the de Caste
```
left=[]
right=[]
function drawCurve(points[], t):
function drawCurvePoint(points[], t):
if(points.length==1):
left.add(points[0])
right.add(points[0])
@@ -28,7 +28,7 @@ function drawCurve(points[], t):
if(i==newpoints.length-1):
right.add(points[i+1])
newpoints[i] = (1-t) * points[i] + t * points[i+1]
drawCurve(newpoints, t)
drawCurvePoint(newpoints, t)
```
After running this function for some value `t`, the `left` and `right` arrays will contain all the coordinates for two new curves - one to the "left" of our `t` value, the other on the "right". These new curves will have the same order as the original curve, and can be overlaid exactly on the original curve.

View File

@@ -15,7 +15,7 @@
```
left=[]
right=[]
function drawCurve(points[], t):
function drawCurvePoint(points[], t):
if(points.length==1):
left.add(points[0])
right.add(points[0])
@@ -28,7 +28,7 @@ function drawCurve(points[], t):
if(i==newpoints.length-1):
right.add(points[i+1])
newpoints[i] = (1-t) * points[i] + t * points[i+1]
drawCurve(newpoints, t)
drawCurvePoint(newpoints, t)
```
ある値`t`に対してこの関数を実行すると、`left``right`に新しい2曲線の座標が入ります。一方は`t`の「左」側、もう一方は「右」側の曲線です。この2曲線は元の曲線と同じ次数になり、また元の曲線とぴったり重なります。

View File

@@ -15,7 +15,7 @@
```
left=[]
right=[]
function drawCurve(points[], t):
function drawCurvePoint(points[], t):
if(points.length==1):
left.add(points[0])
right.add(points[0])
@@ -28,7 +28,7 @@ function drawCurve(points[], t):
if(i==newpoints.length-1):
right.add(points[i+1])
newpoints[i] = (1-t) * points[i] + t * points[i+1]
drawCurve(newpoints, t)
drawCurvePoint(newpoints, t)
```
对某个给定 `t` 值,该函数执行后,数组 `left``right` 将包含两条曲线的所有点的坐标 -- 一条是`t`值左侧的曲线,一条是`t`值右侧的曲线, 与原始曲线同序且完全重合。