Catmull-Rom样条曲线是一个三次样条曲线(cubic spline),其中除了第一个和最后一个控制点外,
其他控制点的切线都是使用前一个和下一个控制点计算的。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
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
readonlyfirstTangent : Cartesian3
第一个控制点的切线(tangent)。
readonlylastTangent : Cartesian3
最后一个控制点的切线(tangent)。
readonlypoints : Array.<Cartesian3>
Cartesian3
控制点的数组。
控制点的时间数组。
Methods
将给定的时间固定(clamps)到样条曲线(spline)所覆盖的周期。
Name | Type | Description |
---|---|---|
time |
Number | 时间。 |
Returns:
时间,固定的动画的周期。
在给定时间对曲线求值。
Name | Type | Description |
---|---|---|
time |
Number | 对曲线求值的时间。 |
result |
Array.<Number> | optional 存储结果的对象。 |
Returns:
在给定时间的修改结果参数或曲线上点的新实例。
Throws:
在
times
中查找一个索引i
,使得参数time
在区间[times[i], times[i + 1]]
中。
Name | Type | Description |
---|---|---|
time |
Number | 时间。 |
Returns:
间隔开始时元素的索引。
Throws:
将给定的时间封装到样条曲线(spline)所覆盖的周期中。
Name | Type | Description |
---|---|---|
time |
Number | 时间。 |
Returns:
时间,环绕着动画的周期。