modern-canvas 0.14.39 → 0.14.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,28 @@
1
+ import type { TypedArray } from '../renderers';
2
+ import type { Vector } from './Vector';
1
3
  import { Observable } from 'modern-idoc';
2
- import { Vector } from './Vector';
3
- export type MatrixLike = number | number[] | Matrix;
4
+ export type MatrixLike = number | number[] | TypedArray | Matrix;
4
5
  export type MatrixOperateOutput = number[] | Matrix | Vector;
5
6
  export declare abstract class Matrix extends Observable {
6
7
  readonly rows: number;
7
8
  readonly cols: number;
8
- protected _array: number[];
9
+ readonly __matrix = true;
10
+ protected _typedArray: Float64Array<ArrayBuffer>;
11
+ protected _identityArray: Float64Array<ArrayBuffer>;
9
12
  dirtyId: number;
10
- get length(): number;
13
+ readonly length: number;
11
14
  constructor(rows: number, cols: number, array?: number[]);
12
15
  operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
13
16
  identity(): this;
14
- set(value: MatrixLike): this;
15
- copy(value: MatrixLike): this;
17
+ set(array: ArrayLike<number>, offset?: number): this;
18
+ copy(value: Matrix): this;
16
19
  clone(): this;
17
20
  multiply<T extends Vector>(value: T): T;
18
21
  multiply(value: MatrixLike): this;
19
22
  multiply<T extends MatrixOperateOutput>(value: MatrixLike, output: T): T;
20
- protected _onUpdate(_array: number[]): void;
23
+ protected _onUpdate(_typedArray: Float64Array): void;
21
24
  toArray(transpose?: boolean): number[];
22
- toFloat32Array(transpose?: boolean): Float32Array<ArrayBuffer>;
25
+ toTypedArray(): Float64Array<ArrayBuffer>;
23
26
  toName(): string;
24
27
  toJSON(): number[];
25
28
  }
@@ -4,7 +4,8 @@ export type VectorLike = number | number[] | Matrix | Vector;
4
4
  export type VectorOperateOutput = number[] | Vector;
5
5
  export declare abstract class Vector extends Observable {
6
6
  readonly dim: number;
7
- protected _array: number[];
7
+ readonly __vector = true;
8
+ protected _typedArray: Float64Array<ArrayBuffer>;
8
9
  get length(): number;
9
10
  constructor(dim: number);
10
11
  operate(operator: '+' | '-' | '*' | '/' | 'rot' | '==' | '=', target: VectorLike, output?: VectorOperateOutput): any;
@@ -17,9 +18,9 @@ export declare abstract class Vector extends Observable {
17
18
  equals(value: VectorLike): boolean;
18
19
  copy(value: VectorLike): this;
19
20
  clone(): this;
20
- protected _onUpdate(_array: number[]): void;
21
+ protected _onUpdate(_array: Float64Array): void;
21
22
  toName(): string;
22
23
  toArray(): number[];
23
- toFloat32Array(): Float32Array;
24
+ toTypedArray(): Float64Array;
24
25
  toJSON(): number[];
25
26
  }