Skip to content

KBE3D / KBCore / Cesium / LinearSpline

类: LinearSpline

A spline that uses piecewise linear interpolation to create a curve.

示例

ts
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]);

参数

Object with the following properties:

参数

An array of strictly increasing, unit-less, floating-point times at each point. The values are in no way connected to the clock time. They are the parameterization for the curve.

参数

The array of control points.

属性

times

readonly times: number[]

An array of times for the control points.


points

readonly points: number[] | Cartesian3[]

An array of Cartesian3 control points.

方法

findTimeInterval()

findTimeInterval(time: number): number

Finds an index <code>i</code> in <code>times</code> such that the parameter <code>time</code> is in the interval <code>[times[i], times[i + 1]]</code>.

参数

time

number

The time.

返回

number

The index for the element at the start of the interval.


wrapTime()

wrapTime(time: number): number

Wraps the given time to the period covered by the spline.

参数

time

number

The time.

返回

number

The time, wrapped around to the updated animation.


clampTime()

clampTime(time: number): number

Clamps the given time to the period covered by the spline.

参数

time

number

The time.

返回

number

The time, clamped to the animation period.


evaluate()

evaluate(time: number, result?: Cartesian3): number | Cartesian3

Evaluates the curve at a given time.

参数

time

number

The time at which to evaluate the curve.

result?

Cartesian3

The object onto which to store the result.

返回

number | Cartesian3

The modified result parameter or a new instance of the point on the curve at the given time.

构造函数

构造函数

new LinearSpline(options: { times: number[]; points: number[] | Cartesian3[]; }): LinearSpline

参数

options
times

number[]

points

number[] | Cartesian3[]

返回

LinearSpline

KBE3D @3.0.0 Copyright © 2024-present KBE3D