the-world-engine
Version:
three.js based, unity like game engine for browser
65 lines (64 loc) • 1.86 kB
TypeScript
import type { Vector4, Vector4Tuple } from "three/src/Three";
export type ReadonlyVector4 = {
/**
* @default 0
*/
readonly x: number;
/**
* @default 0
*/
readonly y: number;
/**
* @default 0
*/
readonly z: number;
/**
* @default 0
*/
readonly w: number;
readonly width: number;
readonly height: number;
readonly isVector4: true;
getComponent(index: number): number;
/**
* Clones this vector.
*/
clone(): Vector4;
/**
* Computes dot product of this vector and v.
*/
dot(v: ReadonlyVector4): number;
/**
* Computes squared length of this vector.
*/
lengthSq(): number;
/**
* Computes length of this vector.
*/
length(): number;
/**
* Computes the Manhattan length of this vector.
*
* see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry}
*/
manhattanLength(): number;
/**
* Checks for strict equality of this vector and v.
*/
equals(v: ReadonlyVector4): boolean;
/**
* Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
* @param array (optional) array to store the vector to. If this is not provided, a new array will be created.
* @param offset (optional) optional offset into the array.
* @return The created or provided array.
*/
toArray(array?: number[], offset?: number): number[];
toArray(array?: Vector4Tuple, offset?: 0): Vector4Tuple;
/**
* Copies x, y, z and w into the provided array-like.
* @param array array-like to store the vector to.
* @param offset (optional) optional offset into the array-like.
* @return The provided array-like.
*/
toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>;
};