import { Point } from "../geometries/point.ts"; import { Vector2d } from "./vector2d"; import { Vector3d } from "./vector3d"; /** * Represents a point in a 3D coordinate vector that can be observed for changes. * @category Math */ export declare class ObservableVector3d { private _callback; private _vector3d; private _revoke; private callBackEnabled; /** * Creates a new ObservableVector3d instance. * @param x - The x-coordinate of the vector. Default is 0. * @param y - The y-coordinate of the vector. Default is 0. * @param z - The z-coordinate of the vector. Default is 0. * @param callback - The callback function to be called when the point changes. Default is undefined. */ constructor(x?: number, y?: number, z?: number, callback?: () => void); /** * Sets the x and y coordinates of the point. * @param x - The new x-coordinate value. * @param y - The new y-coordinate value. * @param z - The new z-coordinate value. * @returns Reference to this object for method chaining. */ set(x?: number, y?: number, z?: number): this; /** * Sets the x and y coordinates of the point without triggering the callback. * @param x - The new x-coordinate value. * @param y - The new y-coordinate value. * @param z - * @returns Reference to this object for method chaining. */ setMuted(x?: number, y?: number, z?: number): this; /** * Gets the x-coordinate of the point. */ get x(): number; /** * Sets the x-coordinate of the point. * @param value - The new x-coordinate value. */ set x(value: number); /** * Gets the y-coordinate of the point. */ get y(): number; /** * Sets the y-coordinate of the point. * @param value - The new y-coordinate value. */ set y(value: number); get z(): number; set z(value: number); /** * Sets the callback function to be called when the point changes. * @param callback - The callback function. */ setCallback(callback: () => void): void; /** * set the Vector x and y properties to 0 * @returns Reference to this object for method chaining */ setZero(): this; /** * set the Vector x and y properties using the passed vector * @param v other vector * @returns Reference to this object for method chaining */ setV(v: Vector2d | Vector3d | ObservableVector3d): this; /** * Add the passed vector to this vector * @param v other vector * @returns Reference to this object for method chaining */ add(v: Vector2d | Vector3d | ObservableVector3d): this; /** * Subtract the passed vector from this vector * @param v other vector * @returns Reference to this object for method chaining */ sub(v: Vector2d | Vector3d | ObservableVector3d): this; /** * Multiply this vector values by the given scalar * @param x x component * @param [y] y component * @param [z] z component * @returns Reference to this object for method chaining */ scale(x: number, y?: number, z?: number): this; /** * Multiply this vector values by the passed vector * @param v other vector * @returns Reference to this object for method chaining */ scaleV(v: Vector3d | ObservableVector3d): this; /** * Convert this vector into isometric coordinate space * @returns Reference to this object for method chaining */ toIso(): this; /** * Convert this vector into 2d coordinate space * @returns Reference to this object for method chaining */ to2d(): this; /** * Divide this vector values by the passed value * @param n - the value to divide the vector by * @returns Reference to this object for method chaining */ div(n: number): this; /** * Update this vector values to absolute values * @returns Reference to this object for method chaining */ abs(): this; /** * Clamp the vector value within the specified value range * @param low lower bound * @param high upper bound * @returns new Vector3d */ clamp(low: number, high: number): Vector3d; /** * Clamp this vector value within the specified value range * @param low lower bound * @param high upper bound * @returns Reference to this object for method chaining */ clampSelf(low: number, high: number): Vector3d; /** * Update this vector with the minimum value between this and the passed vector * @param v other vector * @returns Reference to this object for method chaining */ minV(v: Vector2d | Vector3d | ObservableVector3d): this; /** * Update this vector with the maximum value between this and the passed vector * @param v other vector * @returns Reference to this object for method chaining */ maxV(v: Vector2d | Vector3d | ObservableVector3d): this; /** * Floor the vector values * @returns new Vector3d */ floor(): Vector3d; /** * Floor this vector values * @returns Reference to this object for method chaining */ floorSelf(): Vector3d; /** * Ceil the vector values * @returns new Vector3d */ ceil(): Vector3d; /** * Ceil this vector values * @returns Reference to this object for method chaining */ ceilSelf(): Vector3d; /** * Negate the vector values * @returns new Vector3d */ negate(): Vector3d; /** * Negate this vector values * @returns Reference to this object for method chaining */ negateSelf(): Vector3d; /** * Copy the components of the given vector into this one * @param v other vector * @returns Reference to this object for method chaining */ copy(v: Vector2d | Vector3d | ObservableVector3d): this; /** * return true if this vector is equal to the given values or vector * @param args other vector or vector components * @returns true if both vectors are equal */ equals(...args: [number] | [Vector2d] | [Vector3d] | [ObservableVector3d] | [number, number] | [number, number, number]): boolean; /** * normalize this vector (scale the vector so that its magnitude is 1) * @returns Reference to this object for method chaining */ normalize(): Vector3d; /** * change this vector to be perpendicular to what it was before.
* (Effectively rotates it 90 degrees in a clockwise direction around the z axis) * @returns Reference to this object for method chaining */ perp(): Vector3d; /** * Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis * @param angle - The angle to rotate (in radians) * @param [v] - an optional point to rotate around * @returns Reference to this object for method chaining */ rotate(angle: number, v?: Vector2d | Point | Vector3d): this; /** * return the dot product of this vector and the passed one * @param v other vector * @returns The dot product. */ dot(v: Vector2d | Vector3d | ObservableVector3d): number; /** * calculate the cross product of this vector and the passed one * @param v other vector * @returns Reference to this object for method chaining */ cross(v: Vector3d | ObservableVector3d): this; /** * return the square length of this vector * @returns The length^2 of this vector. */ length2(): number; /** * return the length (magnitude) of this vector * @returns the length of this vector */ length(): number; /** * Linearly interpolate between this vector and the given one. * @param v other vector * @param alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one). * @returns Reference to this object for method chaining */ lerp(v: Vector3d | ObservableVector3d, alpha: number): this; /** * interpolate the position of this vector on the x and y axis towards the given one by the given maximum step. * @param target other vector * @param step - the maximum step per iteration (Negative values will push the vector away from the target) * @returns Reference to this object for method chaining */ moveTowards(target: Vector2d | Vector3d | ObservableVector3d, step: number): Vector2d | Vector3d | ObservableVector3d; /** * return the distance between this vector and the passed one * @param v other vector * @returns distance */ distance(v: Vector2d | Vector3d | ObservableVector3d): number; /** * return the angle between this vector and the passed one * @param v other vector * @returns angle in radians */ angle(v: Vector2d | Vector3d | ObservableVector3d): number; /** * project this vector on to another vector. * @param v - The vector to project onto. * @returns Reference to this object for method chaining */ project(v: Vector2d | Vector3d | ObservableVector3d): this; /** * Project this vector onto a vector of unit length.
* This is slightly more efficient than `project` when dealing with unit vectors. * @param v - The unit vector to project onto. * @returns Reference to this object for method chaining */ projectN(v: Vector2d | Vector3d | ObservableVector3d): this; /** * return a clone copy of this vector * @param [cb] callback function to override the clone values * @returns new Vector3d */ clone(cb?: () => void): ObservableVector3d; /** * convert the object to a string representation * @returns stringified representation */ toString(): `x:${number},y:${number},z:${number}`; /** * Revokes the proxy object, preventing further access to the ObservablePoint instance. */ revoke(): void; } export declare const observableVector3dPool: import("../system/pool.ts").Pool void]>; //# sourceMappingURL=observableVector3d.d.ts.map