使用分段线性插值创建曲线的样条曲线。
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
对象,具有以下属性:
|
Throws:
-
DeveloperError : points.length must be greater than or equal to 2.
-
DeveloperError : times.length must be equal to points.length.
Example:
const times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
const spline = new Cesium.LinearSpline({
times : times,
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[0]);
See:
Members
readonly points : Array.<number>|Array.<Cartesian3>
Cartesian3
控制点数组。
控制点的时间数组。
Methods
将给定时间限制为样条所覆盖的时间段。
Name | Type | Description |
---|---|---|
time |
number | 时间。 |
Returns:
时间,固定到动画周期。
evaluate(time, result) → number|Cartesian3
在给定时间计算曲线。
Name | Type | Description |
---|---|---|
time |
number | 评估曲线的时间。 |
result |
Cartesian3 | optional 要在其上存储结果的对象。 |
Returns:
修改后的结果参数 或给定时间曲线上点的新实例。
Throws:
-
DeveloperError : time must be in the range
[t0, tn]
, wheret0
is the first element in the arraytimes
andtn
is the last element in the arraytimes
.
在
时间
中查找索引 i
,使得参数
时间
在区间 [times[i], times[i + 1]]
中。
Name | Type | Description |
---|---|---|
time |
number | 时间。 |
Returns:
区间开始时元素的索引。
Throws:
-
DeveloperError : time must be in the range
[t0, tn]
, wheret0
is the first element in the arraytimes
andtn
is the last element in the arraytimes
.
将给定时间环绕到样条所覆盖的时间段。
Name | Type | Description |
---|---|---|
time |
number | 时间。 |
Returns:
时间,环绕到更新的动画。