modern-canvas
Version:
A JavaScript WebGL rendering engine. only the ESM.
26 lines (25 loc) • 1.04 kB
TypeScript
import { Observable } from 'modern-idoc';
import { Matrix } from './Matrix';
export type VectorLike = number | number[] | Matrix | Vector;
export type VectorOperateOutput = number[] | Vector;
export declare abstract class Vector extends Observable {
readonly dim: number;
protected _array: number[];
get length(): number;
constructor(dim: number);
operate(operator: '+' | '-' | '*' | '/' | 'rot' | '==' | '=', target: VectorLike, output?: VectorOperateOutput): any;
add(value: VectorLike, ...args: number[]): this;
sub(value: VectorLike, ...args: number[]): this;
multiply(value: VectorLike, ...args: number[]): this;
divide(value: VectorLike, ...args: number[]): this;
rotate(angle: number): this;
set(value: VectorLike, ...args: number[]): this;
equals(value: VectorLike): boolean;
copy(value: VectorLike): this;
clone(): this;
protected _onUpdate(_array: number[]): void;
toName(): string;
toArray(): number[];
toFloat32Array(): Float32Array;
toJSON(): number[];
}