LinearSpline

new Cesium.LinearSpline(options)

使用分段线性插值来创建曲线的样条。
Name Type Description
options object 包含以下属性的对象:
Name Type Description
times Array.<number> 在每个点处严格递增、无单位、浮点格式的时间数组。 这些值与时钟时间没有任何关联。它们是曲线的参数化。
points Array.<number> | Array.<Cartesian3> 控制点数组。
Throws:
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 控制点数组。

readonly times : Array.<number>

控制点的时间数组。

Methods

clampTime(time)number

将给定的时间限制在样条所覆盖的时段内。
Name Type Description
time number 时间。
Returns:
被限制在动画时段内的时间。

evaluate(time, result)number|Cartesian3

在给定时间处计算曲线的值。
Name Type Description
time number 要计算曲线值的时间。
result Cartesian3 optional 用于存储结果的物体。
Returns:
修改后的结果参数,或给定时间处曲线上点的新实例。
Throws:
  • DeveloperError : 时间必须在范围 [t0, tn] 内,其中 t0 是数组 times 的第一个元素,tn 是数组 times 的最后一个元素。

findTimeInterval(time)number

times 中查找索引 i,使得参数 time 位于区间 [times[i], times[i + 1]] 内。
Name Type Description
time number 时间。
Returns:
区间起始处元素的索引。
Throws:
  • DeveloperError : 时间必须在范围 [t0, tn] 内,其中 t0 是数组 times 的第一个元素,tn 是数组 times 的最后一个元素。

wrapTime(time)number

将给定的时间环绕到样条所覆盖的时段内。
Name Type Description
time number 时间。
Returns:
环绕到更新后动画的时间。
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。