Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/caviar/src/math/mod.ts>Vector

⚡ Blazing fast, modern, Game Engine powered by WebGPU for Deno and the browser
Go to Latest
class Vector
implements IVector
import { Vector } from "https://deno.land/x/caviar@2.0.0/src/math/mod.ts";

Constructors

new
Vector(x?: number, y?: number)

Methods

add(src: IVector | IVectorLike | Vector): Vector
angle(): number
copy(src: IVector | IVectorLike | Vector): Vector
cross(src: IVector | IVectorLike | Vector): number
distance(src: IVector | IVectorLike | Vector): number
distanceSq(src: IVector | IVectorLike | Vector): number
divide(src: IVector | IVectorLike | Vector): Vector
dot(src: IVector | IVectorLike | Vector): number
equals(v: IVector | IVectorLike | Vector): boolean
fuzzyEquals(v: IVector | IVectorLike, epsilon?): boolean
length(): number
lengthSq(): number
lerp(src: IVector | IVectorLike | Vector, t?): Vector
limit(max: number): Vector
multiply(src: IVector | IVectorLike | Vector): Vector
rotate(delta: number): Vector
scale(value: number): Vector
set(x: number, y?: number): Vector
setAngle(angle: number)
setLength(length: number): Vector
setToPolar(azimuth: number, radius?): Vector
subtract(src: IVector | IVectorLike | Vector): Vector