@osbjs/osbjs
Version:
a minimalist osu! storyboarding framework
129 lines (128 loc) • 4.31 kB
TypeScript
import { Matrix3 } from './Matrix3';
import { Matrix4 } from './Matrix4';
import { Quaternion } from './Quaternion';
export declare class Vector3 {
x: number;
y: number;
z: number;
static One: Vector3;
static UnitX: Vector3;
static UnitY: Vector3;
static UnitZ: Vector3;
static Zero: Vector3;
constructor(x?: number, y?: number, z?: number);
/**
* Returns true if the components of this vector and v are strictly equal; false otherwise.
*/
equals(v: Vector3): boolean;
/**
* Returns a new Vector3 with the same x, y, z values as this one.
*/
clone(): Vector3;
/**
* Computes the Euclidean distance between the two given points.
*/
distanceTo(v: Vector3): number;
/**
* Computes the Euclidean distance squared between the two given points.
*/
distanceToSqr(v: Vector3): number;
/**
* Returns the length of the vector.
*/
length(): number;
/**
* Returns the length of the vector squared.
*/
lengthSqr(): number;
/**
* Returns the angle between this vector and vector v in radians.
*/
angleTo(v: Vector3): number;
/**
* Adds two vectors together.
*/
static add(v1: Vector3, v2: Vector3): Vector3;
/**
* Subtracts the second vector from the first.
*/
static sub(v1: Vector3, v2: Vector3): Vector3;
/**
* Returns a new vector whose values are the product of each pair of elements in two specified vectors.
*/
static multiply(v1: Vector3, v2: Vector3): Vector3;
/**
* Divides the first vector by the second.
*/
static divide(v1: Vector3, v2: Vector3): Vector3;
/**
* Adds the scalar value s to this vector's x, y values.
*/
static addScalar(v: Vector3, s: number): Vector3;
/**
* Subtracts the scalar value s to this vector's x, y values.
*/
static subScalar(v: Vector3, s: number): Vector3;
/**
* Multiplies a vector by a specified scalar.
*/
static multiplyScalar(v: Vector3, s: number): Vector3;
/**
* Divides the specified vector by a specified scalar value.
*/
static divideScalar(v: Vector3, s: number): Vector3;
/**
* Transforms a vector by the specified Quaternion rotation value.
*/
static applyQuat(v: Vector3, q: Quaternion): Vector3;
/**
* Transforms a vector by a specified 4x4 matrix.
*/
static applyMat4(v: Vector3, m: Matrix4): Vector3;
/**
* Transforms a vector by a specified 3x3 matrix.
*/
static applyMat3(v: Vector3, m: Matrix3): Vector3;
/**
* 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: Vector3, v2: Vector3, alpha: number): Vector3;
/**
* Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.
*/
static max(v1: Vector3, v2: Vector3): Vector3;
/**
* Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.
*/
static min(v1: Vector3, v2: Vector3): Vector3;
/**
* Returns the dot product of two vectors.
*/
static dot(v1: Vector3, v2: Vector3): number;
/**
* Returns the cross product of two vectors.
*/
static cross(v1: Vector3, v2: Vector3): Vector3;
/**
* Negates a specified vector.
*/
static negate(v: Vector3): Vector3;
/**
* Returns a vector with the same direction as the specified vector, but with a length of one.
*/
static normalize(v: Vector3): Vector3;
/**
* Returns a vector whose elements are the absolute values of each of the specified vector's elements.
*/
static abs(v: Vector3): Vector3;
/**
* Returns the reflection of a vector off a surface that has the specified normal.
*/
static reflect(v: Vector3, normal: Vector3): Vector3;
/**
* Restricts a vector between a minimum and a maximum value.
*/
static clamp(v: Vector3, min: Vector3, max: Vector3): Vector3;
}