@jsprismarine/math
Version:
JSPrismarine math utilities
64 lines • 1.87 kB
TypeScript
import { Vector2 } from './Vector2';
/**
* 3D Vector.
*/
export declare class Vector3 extends Vector2 {
protected y: number;
/**
* Returns a Vector3 with 0 on all axis.
*/
static get ZERO(): Vector3;
/**
* Create a new `Vector3` instance.
* @param {number} x - The X coordinate.
* @param {number} y - The Y coordinate.
* @param {number} z - The Z coordinate.
* @example
* ```typescript
* const vector = new Vector3(10, 20, 30);
* ```
*/
constructor(x: number, y: number, z: number);
toString(): string;
/**
* Creates a new Vector3 instance from an object with x, y, and z properties.
* @param obj - The object containing x, y, and z properties.
* @returns {Vector3} A new Vector3 instance.
*/
static fromObject({ x, y, z }: {
x: number;
y: number;
z: number;
}): Vector3;
/**
* Set the Y coordinate.
* @param {number} y - The Y coordinate.
* @example
* ```typescript
* entity.setY(10);
* ```
*/
setY(y: number): void;
/**
* Get the y coordinate.
* @returns {number} The y coordinate's value.
*/
getY(): number;
/**
* Returns a new Vector3 with each component rounded down to the nearest integer.
* @returns {Vector3} A new Vector3 with rounded down components.
*/
floor(): Vector3;
/**
* Returns a new Vector3 with each component truncated to the nearest integer.
* @returns {Vector3} A new Vector3 with truncated axis.
*/
trunc(): Vector3;
/**
* Compare an instance of `Vector3` with another.
* @param {Vector3} vector - The `Vector3` to compare to.
* @returns {boolean} `true` if they're equal otherwise `false`.
*/
equals(vector: typeof this): boolean;
}
//# sourceMappingURL=Vector3.d.ts.map