@fdx/fxmath
Version:
A helper library for vector math and generative art
69 lines (68 loc) • 2.86 kB
TypeScript
export declare const v3: (x?: number, y?: number, z?: number) => V3;
export declare class V3 {
x: number;
y: number;
z: number;
constructor(x: number, y: number, z: number);
static lerp(v1: V3, v2: V3, amt: number): V3;
static clone(v: V3): V3;
static zero(): V3;
static up(): V3;
static add(a: V3, b: V3): V3;
static sub(a: V3, b: V3): V3;
static mult(v: V3, factor: number): V3;
static multiply(v: V3, factor: number): V3;
static divide(v: V3, n0: number): V3;
static cross(a: V3, b: V3): V3;
static dot(a: V3, b: V3): number;
static abs(v: V3): V3;
static max(v1: V3, v2: V3): V3;
zero(): V3;
clone(): V3;
abs(): this;
add(v: V3): V3;
max(v2: V3): void;
sub(v: V3): V3;
mult(n: number): V3;
multiply(n: number): V3;
divide(n0: number): V3;
dot(v: V3): number;
dotProd(v: V3): number;
cross(b: V3): V3;
crossProd(b: V3): V3;
lengthSq(): number;
length(): number;
magnitude(): number;
normalize(): V3;
unitVector(): V3;
static transformCoordinates(v: V3, mat: Matrix4): V3;
static multiplyWithMatrix(v: V3, mat: Matrix4): V3;
floorValues(): this;
angleXY(): number;
toArray(): number[];
}
export declare class Matrix4 {
m: number[];
constructor();
determinant(): number;
toArray(): any[];
invert(): void;
multiply(other: Matrix4): Matrix4;
equals(value: Matrix4): boolean;
static fromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix4;
static identity(): Matrix4;
static zero(): Matrix4;
static copy(source: Matrix4): Matrix4;
static rotationX(angle: number): Matrix4;
static rotationY(angle: number): Matrix4;
static rotationZ(angle: number): Matrix4;
static rotationAxis(axis: V3, angle: number): Matrix4;
static rotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix4;
static scaling(x: number, y: number, z: number): Matrix4;
static translation(x: number, y: number, z: number): Matrix4;
static lookAtLH(eye: V3, target: V3, up: V3): Matrix4;
static orthoLH(left: number, right: number, top: number, bottom: number, znear: number, zfar: number): Matrix4;
static perspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix4;
static perspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, isVerticalFovFixed?: boolean, halfZRange?: boolean, projectionPlaneTilt?: number, reverseDepthBufferMode?: boolean): Matrix4;
static transpose(mat: Matrix4): Matrix4;
}