Skip to content

KBE3D / KBCore / Cesium / SteppedSpline

类: SteppedSpline

A spline that is composed of piecewise constants representing a step function.

示例

ts
const times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
const spline = new Cesium.SteppedSpline({
    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[] | Quaternion[]

An array of control points.

方法

findTimeInterval()

findTimeInterval(time: number, startIndex: 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.

startIndex

number

The index from which to start the search.

返回

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 | Quaternion): number | Cartesian3 | Quaternion

Evaluates the curve at a given time.

参数

time

number

The time at which to evaluate the curve.

result?

The object onto which to store the result.

Cartesian3 | Quaternion

返回

number | Cartesian3 | Quaternion

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

构造函数

构造函数

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

参数

options
times

number[]

points

number[] | Cartesian3[] | Quaternion[]

返回

SteppedSpline

KBE3D @3.0.0 Copyright © 2024-present KBE3D