UNPKG

@fivem-ts/shared

Version:

FiveM Typescript wrapper shared part

123 lines (122 loc) 4.18 kB
/** * Abstract class representing a 2D vector. */ export declare abstract class Vector { private _x; private _y; protected constructor(_x: number, _y: number); /** * Retrieves the value of the private member variable _x. * * @return {number} The value of _x. */ get x(): number; /** * Sets the value of the property `x`. * * @param {number} value - The new value to set for the property. */ set x(value: number); /** * Gets the y-coordinate value. * * @return {number} The current value of the y-coordinate. */ get y(): number; /** * Sets the value of the y property. * * @param {number} value - The new value for the y property. */ set y(value: number); /** * Gets the length of the current object. * * @return {number} The length of the object. */ abstract get Length(): number; /** * The normalize method returns a normalized version of the current vector. * A normalized vector has a magnitude of 1 and points in the same direction as the original vector. * * @return {Vector} The normalized vector. */ abstract get normalize(): Vector; /** * Creates and returns a deep copy of the current Vector instance. * * @return {Vector} A new Vector instance that is a copy of the original. */ abstract clone(): Vector; /** * Calculates and returns the squared distance from this vector to another vector. * * @param {Vector} vector - The other vector to which the squared distance is calculated. * * @return {number} The squared distance between this vector and the specified vector. */ abstract distanceSquared(vector: Vector): number; /** * Calculates the distance from the current vector to the provided vector. * * @param {Vector} vector - The vector to which the distance is to be calculated. * * @return {number} - The distance between the current vector and the provided vector*/ abstract distance(vector: Vector): number; /** * Computes the cross product of the current vector and the provided vector. * * @param {Vector} vector - The vector to cross with the current vector. * * @return {Vector} The resulting vector from the cross product operation. */ abstract crossProduct(vector: Vector): Vector | number; /** * Calculates the dot product of the current vector with another vector. * * @param {Vector} vector - The vector to perform the dot product with. * * @return {number} The result of the dot product. */ abstract dotProduct(vector: Vector): number; /** * Adds a vector or a number to the current vector. * * @param {Vector | number} vector - The vector or number to add. * * @return {Vector} The resulting vector after the addition. */ abstract add(vector: Vector | number): Vector; /** * Subtracts a specified vector or number from the current vector. * * @param {Vector | number} vector - The vector or number to subtract from the current vector. * * @return {Vector} - The resulting vector after subtraction. */ abstract subtract(vector: Vector | number): Vector; /** * Multiplies the given vector or scalar by the current vector. * * @param {Vector | number} vector - The vector or scalar value to multiply with the current vector. * * @return {Vector} The result of the multiplication. */ abstract multiply(vector: Vector | number): Vector; /** * Divides the current vector by another vector or a scalar. * * @param {Vector | number} vector - The vector or scalar to divide by. * * @return {Vector} The result of the division as a new vector. */ abstract divide(vector: Vector | number): Vector; /** * Replaces the contents of the current vector with the provided vector. * * @param {Vector} vector - The vector to replace the current vector with. * * @return {void} */ abstract replace(vector: Vector): void; }