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:
在
times 中查找索引 i,使得参数
time 位于区间 [times[i], times[i + 1]] 内。
| Name | Type | Description |
|---|---|---|
time |
number | 时间。 |
Returns:
区间起始元素对应的索引。
Throws:
将给定时间环绕到样条覆盖的时间段。
| Name | Type | Description |
|---|---|---|
time |
number | 时间。 |
Returns:
环绕到更新动画后的时间。
