Catmull-Rom样条曲线是三次样条曲线,其中控制点处的切线,
除第一个和最后一个外,使用上一个和下一个控制点进行计算。
Catmull-Rom花键属于C1类。
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 具有以下属性的对象:
|
Throws:
-
DeveloperError : 点.长度必须大于或等于2。
-
DeveloperError : 时间长度必须等于点.长度.
Example:
// spline above the earth from Philadelphia to Los Angeles
var 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)
]
});
var p0 = spline.evaluate(times[i]); // equal to positions[i]
var 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:
f
i
将索引i放入times
中,使参数
time
在[times[i], times[i + 1]]
区间。Name | Type | Description |
---|---|---|
time |
Number | 时间。 |
Returns:
间隔开始时元素的索引。
Throws:
将给定时间包装为样条曲线覆盖的周期。
Name | Type | Description |
---|---|---|
time |
Number | 时间。 |
Returns:
时间,绕到更新的动画。