From ebadc9cfecefb1f447380559ce4756caf814127e Mon Sep 17 00:00:00 2001 From: gchoqueux Date: Fri, 1 Sep 2023 15:26:55 +0200 Subject: [PATCH] feature(Coordinates): add toArray method. --- src/Core/Geographic/Coordinates.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Core/Geographic/Coordinates.js b/src/Core/Geographic/Coordinates.js index 7bc11907f7..aea1e0cd58 100644 --- a/src/Core/Geographic/Coordinates.js +++ b/src/Core/Geographic/Coordinates.js @@ -216,6 +216,20 @@ class Coordinates { return target.copy(this); } + /** + * Copy values coordinates to array + * + * @param {number[]} array - array to store this vector to. If this is not + * provided a new array will be created. + * @param {number} [offset=0] - optional offset into the array. + * + * @return {number[]} Returns an array [x, y, z], or copies x, y and z into + * the provided array. + */ + toArray(array = [], offset = 0) { + return THREE.Vector3.prototype.toArray.call(this, array, offset); + } + /** * Calculate planar distance between this coordinates and `coord`. * Planar distance is the straight-line euclidean distance calculated in a 2D cartesian coordinate system.