首先让我为一个糟糕的英语和可能不是很直截了当的问题道歉,因为我不太确定如何称呼它。
我在 After Effects 中有一条多分段三次贝塞尔曲线,它由 5 个带有 IN 和 OUT 切线的顶点定义。我的任务是在 Java Script 中将其细分为 N 个小的线性块。
编辑提交了更多信息。 给定一个由 5 个点定义的多分段三次贝塞尔样条曲线,带有进出切线,我需要得到它的线性表示。其中 N 是用户定义的线性段数。
三次贝塞尔样条曲线:
Segment1: P0, P0out, P1in, P1;
Segment2: P1, P1out, P2in, P2;
Segment3: P2, P2out, P3in, P3;
Segment4: P3, P3out, P4in, P4;
预期输出:
N = 1: linear spline with 2 anchors representing entire shape;
N = 2: linear spline with 3 anchors representing entire shape;
N = 3: linear spline with 4 anchors representing entire shape;
N = 4: linear spline with 5 anchors representing entire shape;
...
N = 8: linear spline with 9 anchors representing entire shape;
distance(L0,L1) = distance(L1,L2) = distance(L2,L3) = ... = distance(L-n, Ln)
在示例图像中,我使用 4 段样条曲线,其中段长度彼此相等 - 这更容易绘制来解释我的任务。但在实际项目中,这些段不会相等,总共会有 4 个以上的段。
我看过de Casteljau方法,但据我所知,它适用于一段样条曲线。我的数学技能很糟糕,所以我不确定我是否可以在我的例子中使用 de Casteljau。