Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Vec3 {
- /**
- * Represents a vector in 3D space
- */
- declare class Vec3 {
- constructor(x: number, y: number, z: number);
- x: number;
- y: number;
- z: number;
- set(x: number, y: number, z: number): this;
- update(other: Vec3): this;
- floored(): Vec3;
- floor(): this;
- offset(dx: number, dy: number, dz: number): Vec3;
- translate(dx: number, dy: number, dz: number): this;
- add(other: Vec3): this;
- subtract(other: Vec3): this;
- plus(other: Vec3): Vec3;
- minus(other: Vec3): Vec3;
- scaled(scalar: number): Vec3;
- abs(): Vec3;
- volume(): number;
- modulus(other: Vec3): Vec3;
- distanceTo(other: Vec3): number;
- equals(other: Vec3): boolean;
- toString(): string;
- clone(): Vec3;
- min(other: Vec3): Vec3;
- max(other: Vec3): Vec3;
- dot(other: Vec3): number;
- cross(other: Vec3): Vec3;
- norm(): number;
- unit(): Vec3;
- normalize(): Vec3;
- scale(scalar): this;
- xyDistanceTo(other: Vec3): number;
- xzDistanceTo(other: Vec3): number;
- yzDistanceTo(other: Vec3): number;
- innerProduct(other: Vec3): number;
- manhattanDistanceTo(other: Vec3): number;
- toArray(): Array<number>;
- }
- }
- /**
- * Creates a vector at 0, 0, 0
- */
- declare function Vec3(): Vec3.Vec3;
- /**
- * Creates a vector from a string in the format "(x, y, z)"
- */
- declare function Vec3(str: string): Vec3.Vec3;
- /**
- * Creates a vector from the given x, y, and z values
- */
- declare function Vec3(x: number | number, y: number | number, z: number | number): Vec3.Vec3;
- /**
- * Creates a vector from the values in the given array as [x, y, z]
- */
- declare function Vec3(point: [number | number, number | number, number | number]): Vec3.Vec3;
- /**
- * Creates a vector by taking the x, y, z values from an object
- */
- declare function Vec3(point: { x: string | number, y: string | number, z: string | number }): Vec3.Vec3;
- export = Vec3;
Advertisement
Add Comment
Please, Sign In to add comment