@osbjs/osbjs
Version:
a minimalist osu! storyboarding framework
110 lines (109 loc) • 3.66 kB
TypeScript
import { Quaternion } from '.';
import { Matrix4 } from './Matrix4';
export declare class Vector4 {
x: number;
y: number;
z: number;
w: number;
static One: Vector4;
static UnitX: Vector4;
static UnitY: Vector4;
static UnitZ: Vector4;
static UnitW: Vector4;
static Zero: Vector4;
constructor(x?: number, y?: number, z?: number, w?: number);
/**
* Returns true if the components of this vector and v are strictly equal; false otherwise.
*/
equals(v: Vector4): boolean;
/**
* Returns a new Vector4 with the same x, y, z, w values as this one.
*/
clone(): Vector4;
/**
* Returns the length of the vector.
*/
length(): number;
/**
* Returns the length of the vector squared.
*/
lengthSqr(): number;
/**
* Computes the Euclidean distance between the two given points.
*/
distanceTo(v: Vector4): number;
/**
* Computes the Euclidean distance squared between the two given points.
*/
distanceToSqr(v: Vector4): number;
/**
* Adds two vectors together.
*/
static add(v1: Vector4, v2: Vector4): Vector4;
/**
* Subtracts the second vector from the first.
*/
static sub(v1: Vector4, v2: Vector4): Vector4;
/**
* Returns a new vector whose values are the product of each pair of elements in two specified vectors.
*/
static multiply(v1: Vector4, v2: Vector4): Vector4;
/**
* Divides the first vector by the second.
*/
static divide(v1: Vector4, v2: Vector4): Vector4;
/**
* Adds the scalar value s to this vector's x, y values.
*/
static addScalar(v: Vector4, s: number): Vector4;
/**
* Subtracts the scalar value s to this vector's x, y values.
*/
static subScalar(v: Vector4, s: number): Vector4;
/**
* Multiplies a vector by a specified scalar.
*/
static multiplyScalar(v: Vector4, s: number): Vector4;
/**
* Divides the specified vector by a specified scalar value.
*/
static divideScalar(v: Vector4, s: number): Vector4;
/**
* Linearly interpolate between v1 and v2,
* where alpha is the percent distance along the line - alpha = 0 will be this vector,
* and alpha = 1 will be v.
*/
static lerp(v1: Vector4, v2: Vector4, alpha: number): Vector4;
/**
* Returns a vector whose elements are the absolute values of each of the specified vector's elements.
*/
static abs(v: Vector4): Vector4;
/**
* Restricts a vector between a minimum and a maximum value.
*/
static clamp(v: Vector4, min: Vector4, max: Vector4): Vector4;
/**
* Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.
*/
static max(v1: Vector4, v2: Vector4): Vector4;
/**
* Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.
*/
static min(v1: Vector4, v2: Vector4): Vector4;
/**
* Negates a specified vector.
*/
static negate(v: Vector4): Vector4;
/**
* Returns a vector with the same direction as the specified vector, but with a length of one.
*/
static normalize(v: Vector4): Vector4;
/**
* Transforms a vector by the specified Quaternion rotation value.
*/
static applyQuat(v: Vector4, q: Quaternion): Vector4;
/**
* Transforms a vector by a specified 4x4 matrix.
*/
static applyMat4(v: Vector4, m: Matrix4): Vector4;
}