modern-canvas 0.14.39 → 0.14.41

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,27 @@
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
+ _array: number[];
9
11
  dirtyId: number;
10
- get length(): number;
12
+ readonly length: number;
11
13
  constructor(rows: number, cols: number, array?: number[]);
12
14
  operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
13
15
  identity(): this;
14
- set(value: MatrixLike): this;
15
- copy(value: MatrixLike): this;
16
+ set(array: ArrayLike<number>): this;
17
+ copy(value: Matrix): this;
16
18
  clone(): this;
17
19
  multiply<T extends Vector>(value: T): T;
18
20
  multiply(value: MatrixLike): this;
19
21
  multiply<T extends MatrixOperateOutput>(value: MatrixLike, output: T): T;
20
22
  protected _onUpdate(_array: number[]): void;
21
23
  toArray(transpose?: boolean): number[];
22
- toFloat32Array(transpose?: boolean): Float32Array<ArrayBuffer>;
24
+ toTypedArray(): Float64Array<ArrayBuffer>;
23
25
  toName(): string;
24
26
  toJSON(): number[];
25
27
  }
@@ -1,12 +1,12 @@
1
+ import type { Matrix } from './Matrix';
1
2
  import { Observable } from 'modern-idoc';
2
- import { Matrix } from './Matrix';
3
3
  export type VectorLike = number | number[] | Matrix | Vector;
4
4
  export type VectorOperateOutput = number[] | Vector;
5
5
  export declare abstract class Vector extends Observable {
6
- readonly dim: number;
7
- protected _array: number[];
8
- get length(): number;
9
- constructor(dim: number);
6
+ readonly length: number;
7
+ readonly __vector = true;
8
+ _array: number[];
9
+ constructor(length: number);
10
10
  operate(operator: '+' | '-' | '*' | '/' | 'rot' | '==' | '=', target: VectorLike, output?: VectorOperateOutput): any;
11
11
  add(value: VectorLike, ...args: number[]): this;
12
12
  sub(value: VectorLike, ...args: number[]): this;
@@ -20,6 +20,6 @@ export declare abstract class Vector extends Observable {
20
20
  protected _onUpdate(_array: number[]): void;
21
21
  toName(): string;
22
22
  toArray(): number[];
23
- toFloat32Array(): Float32Array;
23
+ toTypedArray(): Float64Array<ArrayBuffer>;
24
24
  toJSON(): number[];
25
25
  }
@@ -2,7 +2,6 @@ export * from './Aabb2D';
2
2
  export * from './Color';
3
3
  export * from './ColorMatrix';
4
4
  export * from './Matrix';
5
- export * from './Matrix2';
6
5
  export * from './Matrix3';
7
6
  export * from './Matrix4';
8
7
  export * from './Obb2D';
@@ -11,5 +10,4 @@ export * from './Transform2D';
11
10
  export * from './utils';
12
11
  export * from './Vector';
13
12
  export * from './Vector2';
14
- export * from './Vector3';
15
13
  export * from './Vector4';