Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/threejs_4_deno/src/Three.d.ts>Vector4

A simple transformation of three.js for use within a Deno workflow
Go to Latest
class Vector4
implements Vector
Re-export
import { Vector4 } from "https://deno.land/x/threejs_4_deno@v121/src/Three.d.ts";

4D vector.

( class Vector4 implements Vector )

Constructors

new
Vector4(
x?: number,
y?: number,
z?: number,
w?: number,
)

Properties

height: number
readonly
isVector4: true
w: number
width: number
x: number
y: number
z: number

Methods

add(v: Vector4): this

Adds v to this vector.

addScalar(scalar: number): this
addScaledVector(v: Vector4, s: number): this
addVectors(a: Vector4, b: Vector4): this

Sets this vector to a + b.

ceil(): this
clamp(min: Vector4, max: Vector4): this
clampScalar(min: number, max: number): this
clone(): this

Clones this vector.

copy(v: Vector4): this

Copies value of v to this vector.

divideScalar(s: number): this

Divides this vector by scalar s. Set vector to ( 0, 0, 0 ) if s == 0.

dot(v: Vector4): number

Computes dot product of this vector and v.

equals(v: Vector4): boolean

Checks for strict equality of this vector and v.

floor(): this
fromArray(array: number[], offset?: number): this

Sets this vector's x, y, z and w value from the provided array.

fromArray(array: ArrayLike<number>, offset?: number): this

Sets this vector's x, y, z and w value from the provided array-like.

fromBufferAttribute(attribute: BufferAttribute, index: number): this
getComponent(index: number): number
length(): number

Computes length of this vector.

lengthSq(): number

Computes squared length of this vector.

lerp(v: Vector4, alpha: number): this

Linearly interpolate between this vector and v with alpha factor.

lerpVectors(
v1: Vector4,
v2: Vector4,
alpha: number,
): this
manhattanLength(): number

Computes the Manhattan length of this vector.

max(v: Vector4): this
min(v: Vector4): this
multiplyScalar(s: number): this

Multiplies this vector by scalar s.

negate(): this

Inverts this vector.

normalize(): this

Normalizes this vector.

random(): this

Sets this vector's x, y, z and w from Math.random

round(): this
roundToZero(): this
set(
x: number,
y: number,
z: number,
w: number,
): this

Sets value of this vector.

setComponent(index: number, value: number): this
setLength(length: number): this

Normalizes this vector and multiplies it by l.

setScalar(scalar: number): this

Sets all values of this vector.

setW(w: number): this

Sets w component of this vector.

setX(x: number): this

Sets X component of this vector.

setY(y: number): this

Sets Y component of this vector.

setZ(z: number): this

Sets Z component of this vector.

sub(v: Vector4): this

Subtracts v from this vector.

subScalar(s: number): this
subVectors(a: Vector4, b: Vector4): this

Sets this vector to a - b.

toArray(array?: number[], offset?: number): number[]

Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.

toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>

Copies x, y, z and w into the provided array-like.