fromArray

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

Creates a Cartesian4 from four consecutive elements in an array.

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

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

Return

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

Parameters

array

The array whose four consecutive elements correspond to the x, y, z, and w 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