new Cesium.HermiteSpline(options)

一个赫米特示意图是一个立方插图示意图. 点数、来切数、出切数和时间 must be defined for each control point. The outgoing tangents are defined for points [0, n - 2] and the incoming 对[1,n-1]点定义正切值。 例如,当将曲线的某一段插到 NT 0 点[i] NT 1 和 points[i + 1], the tangents at the points will be outTangents[i] and inTangents[i], respectively.
Name Type Description
options object 下列属性的对象 :
Name Type Description
times Array.<number> 每个点都有严格递增的,无单位的,浮点时间的阵列. 数值与时钟时间绝无关联. 它们是曲线的参数化.
points Array.<Cartesian3> 控制点的数组.
inTangents Array.<Cartesian3> 每个控制点的切入数组.
outTangents Array.<Cartesian3> 每个控制点的输出正切数组.
Throws:
  • DeveloperError : points.length must be greater than or equal to 2.
  • DeveloperError : times.length must be equal to points.length.
  • DeveloperError : inTangents and outTangents must have a length equal to points.length - 1.
  • DeveloperError : inTangents and outTangents must be of the same type as points.
Example:
// Create a G<sup>1</sup> continuous Hermite spline
const times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
const spline = new Cesium.HermiteSpline({
    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)
    ],
    outTangents : [
        new Cesium.Cartesian3(1125196, -161816, 270551),
        new Cesium.Cartesian3(-996690.5, -365906.5, 184028.5),
        new Cesium.Cartesian3(-2096917, 48379.5, -292683.5),
        new Cesium.Cartesian3(-890902.5, 408999.5, -447115)
    ],
    inTangents : [
        new Cesium.Cartesian3(-1993381, -731813, 368057),
        new Cesium.Cartesian3(-4193834, 96759, -585367),
        new Cesium.Cartesian3(-1781805, 817999, -894230),
        new Cesium.Cartesian3(1165345, 112641, 47281)
    ]
});

const p0 = spline.evaluate(times[0]);
See:

Members

readonly inTangents : Array.<Cartesian3>

每个控制点的一组来电正切.

readonly outTangents : Array.<Cartesian3>

每个控制点都有一系列正切值.

readonly points : Array.<Cartesian3>

一系列控制点.

readonly times : Array.<number>

用于控制点的一系列次数.

Methods

static Cesium.HermiteSpline.createC1(options)HermiteSpline

在每个控制点的正切值相同的地方创建示意图. The curves are guaranteed to be at least in the class C1.
Name Type Description
options object 下列属性的对象 :
Name Type Description
times Array.<number> 控制点时间的数组 .
points Array.<Cartesian3> 控制点的数组.
tangents Array.<Cartesian3> 控制点的正切数组.
Returns:
草药斑纹.
Throws:
Example:
const 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)
];

// Add tangents
const tangents = new Array(points.length);
tangents[0] = new Cesium.Cartesian3(1125196, -161816, 270551);
const temp = new Cesium.Cartesian3();
for (let i = 1; i < tangents.length - 1; ++i) {
    tangents[i] = Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.subtract(points[i + 1], points[i - 1], temp), 0.5, new Cesium.Cartesian3());
}
tangents[tangents.length - 1] = new Cesium.Cartesian3(1165345, 112641, 47281);

const spline = Cesium.HermiteSpline.createC1({
    times : times,
    points : points,
    tangents : tangents
});

static Cesium.HermiteSpline.createClampedCubic(options)HermiteSpline|LinearSpline

创建被夹住的立方条。 内部控制点的正切值生成 to create a curve in the class C2.
Name Type Description
options object 下列属性的对象 :
Name Type Description
times Array.<number> 控制点时间的数组 .
points Array.<number> | Array.<Cartesian3> 控制点的数组.
firstTangent Cartesian3 第一个控制点的正切值 .
lastTangent Cartesian3 最后一个控制点的切值 .
Returns:
如果给出了小于3个控制点, 则使用母体示意图, 或是线性示意图 .
Throws:
  • DeveloperError : points, times, firstTangent and lastTangent are required.
  • DeveloperError : points.length must be greater than or equal to 2.
  • DeveloperError : times.length must be equal to points.length.
  • DeveloperError : firstTangent and lastTangent must be of the same type as points.
Example:
// Create a clamped cubic spline above the earth from Philadelphia to Los Angeles.
const spline = Cesium.HermiteSpline.createClampedCubic({
    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)
    ],
    firstTangent : new Cesium.Cartesian3(1125196, -161816, 270551),
    lastTangent : new Cesium.Cartesian3(1165345, 112641, 47281)
});

static Cesium.HermiteSpline.createNaturalCubic(options)HermiteSpline|LinearSpline

创建一个天然的立方形示意图。 控制点的正切值生成 to create a curve in the class C2.
Name Type Description
options object 下列属性的对象 :
Name Type Description
times Array.<number> 控制点时间的数组 .
points Array.<Cartesian3> 控制点的数组.
Returns:
如果给出了小于3个控制点, 则使用母体示意图, 或是线性示意图 .
Throws:
Example:
// Create a natural cubic spline above the earth from Philadelphia to Los Angeles.
const spline = Cesium.HermiteSpline.createNaturalCubic({
    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)
    ]
});

clampTime(time)number

将给定的时间压缩到线条覆盖的期间.
Name Type Description
time number The time.
Returns:
时间,夹在动画时期.

evaluate(time, result)Cartesian3

在特定时间评估曲线.
Name Type Description
time number 评估曲线的时间.
result Cartesian3 optional 存储结果的对象 .
Returns:
修改后的结果参数或给定时间曲线上点的新实例.
Throws:
  • DeveloperError : time must be in the range [t0, tn], where t0 is the first element in the array times and tn is the last element in the array times.

findTimeInterval(time)number

在 NT 2 times NT 3 中查找索引 NT 0 i NT 1 ,使参数如此 -NT+0 时间 NT+1 时间间隔 NT+2 [时间[i],时间[i+1]] NT+3 .
Name Type Description
time number The time.
Returns:
间隔开始时元素的索引.
Throws:
  • DeveloperError : time must be in the range [t0, tn], where t0 is the first element in the array times and tn is the last element in the array times.

wrapTime(time)number

将给定的时间包到线条覆盖的期间.
Name Type Description
time number The time.
Returns:
时间,包裹在更新的动画.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.