fromArray

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

Creates a Cartesian2 from two consecutive elements in an array.

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

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

Return

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

Parameters

array

The array whose two consecutive elements correspond to the x and y 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