Catmull-Rom 样条曲线是一种立方样条曲线,在控制点处(除了第一个和最后一个控制点)的切线
是通过前一个和后一个控制点计算得出的。Catmull-Rom 样条曲线属于 C1 类。
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
包含以下属性的对象:
|
Throws:
-
DeveloperError : points.length 必须大于或等于 2。
-
DeveloperError : times.length 必须等于 points.length。
Example:
// spline above the earth from Philadelphia to Los Angeles
const spline = new Cesium.CatmullRomSpline({
times : [ 0.0, 1.5, 3.0, 4.5, 6.0 ],
points : [
new Cesium.Cartesian3(1235398.0, -4810983.0, 4146266.0),
new Cesium.Cartesian3(1372574.0, -5345182.0, 4606657.0),
new Cesium.Cartesian3(-757983.0, -5542796.0, 4514323.0),
new Cesium.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
new Cesium.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
]
});
const p0 = spline.evaluate(times[i]); // equal to positions[i]
const p1 = spline.evaluate(times[i] + delta); // interpolated value when delta < times[i + 1] - times[i]
See:
Members
readonly firstTangent : Cartesian3
第一个控制点处的切线。
readonly lastTangent : Cartesian3
最后一个控制点处的切线。
readonly points : Array.<Cartesian3>
一个
Cartesian3 控制点的数组。
控制点的时间数组。
Methods
将给定时间限制在样条曲线覆盖的周期内。
| Name | Type | Description |
|---|---|---|
time |
number | 时间。 |
Returns:
被限制在动画周期内的时间。
evaluate(time, result) → Cartesian3
在给定时间评估曲线。
| Name | Type | Description |
|---|---|---|
time |
number | 评估曲线的时间。 |
result |
Cartesian3 | optional 存储结果的对象。 |
Returns:
修改后的结果参数或该时间上曲线的点的新实例。
Throws:
查找索引
i,使得参数 time 在区间 [times[i], times[i + 1]] 内。
| Name | Type | Description |
|---|---|---|
time |
number | 时间。 |
Returns:
表示区间起始位置的元素索引。
Throws:
将给定时间包装到样条曲线覆盖的周期内。
| Name | Type | Description |
|---|---|---|
time |
number | 时间。 |
Returns:
包装后的时间,对应更新后的动画。
