Vec3 extension

3-dimensional vector @example final v = new Vec3(1, 2, 3) console.log('x=' + v.x) // x=1

on
  • Vector3

Methods

add2(Vector3 vector, Vector3 target) → Vector3

Available on Vector3, provided by the Vec3 extension

Vector addition
addScaledVector(double scalar, Vector3 vector, [Vector3? target]) → Vector3

Available on Vector3, provided by the Vec3 extension

Scale a vector and add it to this vector. Save the result in "target". (target = this + vector * scalar) @param target The vector to save the result in.
almostEquals(Vector3 vector, [double? precision]) → bool

Available on Vector3, provided by the Vec3 extension

Check if a vector equals is almost equal to another one.
almostZero([double precision = 1e-6]) → bool

Available on Vector3, provided by the Vec3 extension

Check if a vector is almost zero
cross2(Vector3 vector, [Vector3? target]) → Vector3

Available on Vector3, provided by the Vec3 extension

Vector cross product @param target Optional target to save in.
distanceSquared(Vector3 p) → double

Available on Vector3, provided by the Vec3 extension

Get squared distance from this point to another point
distanceTo(Vector3 p) → double

Available on Vector3, provided by the Vec3 extension

Get distance from this point to another point
inverse() → Vector3

Available on Vector3, provided by the Vec3 extension

Vector cross product @param target Optional target to save in.
isZero() → bool

Available on Vector3, provided by the Vec3 extension

lerp(Vector3 vector, double t, Vector3 target) → void

Available on Vector3, provided by the Vec3 extension

Do a linear interpolation between two vectors @param t A number between 0 and 1. 0 will make this function return u, and 1 will make it return v. Numbers in between will generate a vector in between them.
multiply2(Vector3 vector, [Vector3? target]) → Vector3

Available on Vector3, provided by the Vec3 extension

Multiply the vector with an other vector, component-wise. @param target The vector to save the result in.
scale2(double scalar, [Vector3? target]) → Vector3

Available on Vector3, provided by the Vec3 extension

Multiply all the components of the vector with a scalar. @param target The vector to save the result in.
sub2(Vector3 vector, Vector3 target) → Vector3

Available on Vector3, provided by the Vec3 extension

Vector subtraction @param target Optional target to save in.
tangents(Vector3 t1, Vector3 t2) → void

Available on Vector3, provided by the Vec3 extension

Compute two artificial tangents to the vector @param t1 Vector object to save the first tangent in @param t2 Vector object to save the second tangent in
unit([Vector3? target]) → Vector3

Available on Vector3, provided by the Vec3 extension

Get the version of this vector that is of length 1. @param target Optional target to save in @return Returns the unit vector

Static Properties

unitX ↔ Vector3

Available on Vector3, provided by the Vec3 extension

getter/setter pair
unitY ↔ Vector3

Available on Vector3, provided by the Vec3 extension

getter/setter pair
unitZ ↔ Vector3

Available on Vector3, provided by the Vec3 extension

getter/setter pair