Skip to content

Commit

Permalink
Revamp array methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 committed Jul 23, 2024
1 parent 0f39c98 commit f71619c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
21 changes: 6 additions & 15 deletions types/three/src/math/Matrix3.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,15 @@ export class Matrix3 {
* @param array the source array or array-like.
* @param offset (optional) offset into the array-like. Default is 0.
*/
fromArray(array: number[] | ArrayLike<number>, offset?: number): this;
fromArray(array: ArrayLike<number>, offset?: number): this;

/**
* Returns an array with the values of this matrix, or copies them into the provided array.
* @param array (optional) array to store the matrix to. If this is not provided, a new array will be created.
* @param offset (optional) optional offset into the array.
* @return The created or provided array.
* Writes the elements of this matrix to an array in
* {@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major} format.
* @param array (optional) array to store the resulting vector in. If not given a new array will be created.
* @param offset (optional) offset in the array at which to put the result.
*/
toArray(array?: number[], offset?: number): number[];
toArray(array?: Matrix3Tuple, offset?: 0): Matrix3Tuple;

/**
* Copies he values of this matrix into the provided array-like.
* @param array array-like to store the matrix to.
* @param offset (optional) optional offset into the array-like.
* @return The provided array-like.
*/
toArray(array?: ArrayLike<number>, offset?: number): ArrayLike<number>;
toArray<TArray extends ArrayLike<number> = number[]>(array?: TArray, offset?: number): TArray;

clone(): this;
}
21 changes: 6 additions & 15 deletions types/three/src/math/Matrix4.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,22 +267,13 @@ export class Matrix4 {
* @param array the source array or array-like.
* @param offset (optional) offset into the array-like. Default is 0.
*/
fromArray(array: number[] | ArrayLike<number>, offset?: number): this;
fromArray(array: ArrayLike<number>, offset?: number): this;

/**
* Returns an array with the values of this matrix, or copies them into the provided array.
* @param array (optional) array to store the matrix to. If this is not provided, a new array will be created.
* @param offset (optional) optional offset into the array.
* @return The created or provided array.
* Writes the elements of this matrix to an array in
* {@link https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major} format.
* @param array (optional) array to store the resulting vector in.
* @param offset (optional) offset in the array at which to put the result.
*/
toArray(array?: number[], offset?: number): number[];
toArray(array?: Matrix4Tuple, offset?: 0): Matrix4Tuple;

/**
* Copies he values of this matrix into the provided array-like.
* @param array array-like to store the matrix to.
* @param offset (optional) optional offset into the array-like.
* @return The provided array-like.
*/
toArray(array?: ArrayLike<number>, offset?: number): ArrayLike<number>;
toArray<TArray extends ArrayLike<number> = number[]>(array?: TArray, offset?: number): TArray;
}

0 comments on commit f71619c

Please sign in to comment.