41 lines
1.6 KiB
TypeScript
41 lines
1.6 KiB
TypeScript
|
import mat2 from './mat2';
|
||
|
import mat3 from './mat3';
|
||
|
import vec3 from './vec3';
|
||
|
export default class vec2 {
|
||
|
get x(): number;
|
||
|
get y(): number;
|
||
|
get xy(): [number, number];
|
||
|
set x(value: number);
|
||
|
set y(value: number);
|
||
|
set xy(values: [number, number]);
|
||
|
constructor(values?: [number, number]);
|
||
|
private values;
|
||
|
static readonly zero: vec2;
|
||
|
static readonly one: vec2;
|
||
|
at(index: number): number;
|
||
|
reset(): void;
|
||
|
copy(dest?: vec2): vec2;
|
||
|
negate(dest?: vec2): vec2;
|
||
|
equals(vector: vec2, threshold?: number): boolean;
|
||
|
length(): number;
|
||
|
squaredLength(): number;
|
||
|
add(vector: vec2): vec2;
|
||
|
subtract(vector: vec2): vec2;
|
||
|
multiply(vector: vec2): vec2;
|
||
|
divide(vector: vec2): vec2;
|
||
|
scale(value: number, dest?: vec2): vec2;
|
||
|
normalize(dest?: vec2): vec2;
|
||
|
multiplyMat2(matrix: mat2, dest?: vec2): vec2;
|
||
|
multiplyMat3(matrix: mat3, dest?: vec2): vec2;
|
||
|
static cross(vector: vec2, vector2: vec2, dest?: vec3): vec3;
|
||
|
static dot(vector: vec2, vector2: vec2): number;
|
||
|
static distance(vector: vec2, vector2: vec2): number;
|
||
|
static squaredDistance(vector: vec2, vector2: vec2): number;
|
||
|
static direction(vector: vec2, vector2: vec2, dest?: vec2): vec2;
|
||
|
static mix(vector: vec2, vector2: vec2, time: number, dest?: vec2): vec2;
|
||
|
static sum(vector: vec2, vector2: vec2, dest?: vec2): vec2;
|
||
|
static difference(vector: vec2, vector2: vec2, dest?: vec2): vec2;
|
||
|
static product(vector: vec2, vector2: vec2, dest?: vec2): vec2;
|
||
|
static quotient(vector: vec2, vector2: vec2, dest?: vec2): vec2;
|
||
|
}
|