Vector3¶
Reference¶
- class Vector3¶
- module:
- x: number¶
- y: number¶
- z: number¶
- static fromData(data)¶
Create a vector object from data
- static new(x, y, z)¶
Create new vector
- set(x, y, z)¶
Set values of vector
- Parameters:¶
x (
number
) – x componenty (
number
) – y componentz (
number
) – z component
- static distance(va, vb)¶
Calculate distance between 2 vectors
- static dot(lhs, rhs)¶
Calculate dot product of 2 vectors
- static lerp(from, to, t)¶
Linear iterpolation between 2 vectors
- static max(lhs, rhs)¶
Return the maximum values from both vectors for each component
- static min(lhs, rhs)¶
Return the minimum values from both vectors for each component
- normalized()¶
Return the normalized version of the vector
- sqrMagnitude()¶
Return the squared magnitude of the vector
- static angle(from, to)¶
Calculate ange between vectors
- clampMagnitude(maxLength)¶
Checks the magnitude of the vector and if longer than maxLength, will clamp the vector
- static orthoNormalize(va, vb, vc)¶
Orthonormalize 3 vectors
- static scaled(a, b)¶
Scales vector by another vector
- scale(b)¶
Scales vector by another vector
- static cross(lhs, rhs)¶
Calculates cross product
- equals(other)¶
Checks if other vector is equal this one
- static reflect(inDirection, inNormal)¶
Reflects the inDirection vector at the plane defined by inNormal
- static project(vector, onNormal)¶
Project vector onto a normal vector
- static projectOnPlane(vector, planeNormal)¶
Project vector onto plane
- static slerp(from, to, t)¶
Perform spherical linear interpolation on vector
- mul(q)¶
Multiply vector with a scalar or quaternion
- div(d)¶
Divide vector by a scalar
- add(vb)¶
Adds a vector to this vector
- sub(vb)¶
Subtracts another vector from this vector
- mulQuat(quat)¶
Multiply quaternion with this vector
- Parameters:¶
quat (
Quaternion
) – input quaternion- Returns:¶
returns itself
- Return type:¶
- static createFrustumRays(viewDirection, fov, resX, resY)¶
Creates an array of Vector3 objects which are the direction vectors of the frustum as defined by the parameters
- Parameters:¶
viewDirection (
Vector3
) – a view vectorfov (
number
) – Field of view value in degreesresX (
number
) – resolution width. Needs to be at least 2resY (
number
) – resolution height Needs to be at least 2
- Returns:¶
Array of Vector3 objects which have the count width * height
- Return type:¶
Array