fromArray

fun fromArray(array: ReadonlyArray<Double>, startingIndex: Int? = definedExternally, result: Cartesian3? = definedExternally): Cartesian3(source)

Creates a Cartesian3 from three consecutive elements in an array.

// Create a Cartesian3 with (1.0, 2.0, 3.0)
const v = [1.0, 2.0, 3.0];
const p = Cartesian3.fromArray(v);

// Create a Cartesian3 with (1.0, 2.0, 3.0) using an offset into an array
const v2 = [0.0, 0.0, 1.0, 2.0, 3.0];
const p2 = Cartesian3.fromArray(v2, 2);

Return

The modified result parameter or a new Cartesian3 instance if one was not provided.

Parameters

array

The array whose three consecutive elements correspond to the x, y, and z components, respectively.

startingIndex

The offset into the array of the first element, which corresponds to the x component. Default value - 0

result

The object onto which to store the result.

See also