-
xnumber
-
-
ynumber
-
-
znumber
-
-
static,constantmodule:og/math/Vec3.Vec3.BACKWARD
-
-
static,constantmodule:og/math/Vec3.Vec3.DOWN
-
-
static,constantmodule:og/math/Vec3.Vec3.FORWARD
-
-
static,constantmodule:og/math/Vec3.Vec3.LEFT
-
-
static,constantmodule:og/math/Vec3.Vec3.RIGHT
-
-
static,constantmodule:og/math/Vec3.Vec3.UNIT_X
-
-
static,constantmodule:og/math/Vec3.Vec3.UNIT_Y
-
-
static,constantmodule:og/math/Vec3.Vec3.UNIT_Z
-
-
static,constantmodule:og/math/Vec3.Vec3.UP
-
-
static,constantmodule:og/math/Vec3.Vec3.ZERO
-
-
-
Gets two vectors summarization.
Name |
Type |
Description |
point3 |
Vec3
|
Vector to add. |
Returns:
Type |
Description |
Vec3
|
Returns a sum vector. |
-
-
Adds vector to the current.
Name |
Type |
Description |
point3 |
Vec3
|
Point to add. |
Returns:
-
-
Gets angle between two vectors.
Name |
Type |
Description |
a |
Vec3
|
Another vector. |
Returns:
Type |
Description |
number
|
- |
-
-
Sets vector to zero.
Returns:
-
-
Returns clone vector.
Returns:
-
-
Copy input vector's values.
Name |
Type |
Description |
point3 |
Vec3
|
Vector to copy. |
Returns:
-
-
Gets vectors cross production.
Name |
Type |
Description |
point3 |
Vec3
|
Another vector. |
Returns:
-
-
Gets distance to point.
Name |
Type |
Description |
point3 |
Vec3
|
Distant point. |
Returns:
Type |
Description |
number
|
- |
-
distance2(point3){number}
-
Gets square distance to point.
Name |
Type |
Description |
point3 |
Vec3
|
Distant point. |
Returns:
Type |
Description |
number
|
- |
-
-
Divide current vector's components to another and returns new vector instance.
Name |
Type |
Description |
vec |
Vec3
|
Div vector. |
Returns:
-
-
Divide current vector's components to another. Results stores in the current vector object.
Name |
Type |
Description |
vec |
Vec3
|
Div vector. |
Returns:
-
-
Gets vectors dot production.
Name |
Type |
Description |
point3 |
Vec3
|
Another vector. |
Returns:
Type |
Description |
number
|
- |
-
-
Gets vectors dot production.
Name |
Type |
Description |
arr |
Array.<number>
|
Array vector. (exactly 3 entries) |
Returns:
Type |
Description |
number
|
- |
-
-
Compares with vector. Returns true if it equals another.
Name |
Type |
Description |
p |
Vec3
|
Vector to compare. |
Returns:
Type |
Description |
boolean
|
- |
-
-
Returns normalized vector.
Returns:
-
-
Converts vector's values to a quaternion object.
Returns:
-
getRotationTo(dest, fallbackAxis){Quat}
-
Gets the shortest arc quaternion to rotate this vector to the destination vector.
Name |
Type |
Description |
dest |
Vec3
|
- |
fallbackAxis |
Vec3
|
- |
Returns:
-
-
Returns true if vector's values are zero.
Returns:
Type |
Description |
boolean
|
- |
-
-
Gets vector's length.
Returns:
Type |
Description |
number
|
- |
-
-
Returns squared vector's length.
Returns:
Type |
Description |
number
|
- |
-
-
Returns two vectors linear interpolation.
Name |
Type |
Description |
v2 |
Vec3
|
End vector. |
l |
number
|
Interpolate value. |
Returns:
-
-
Multiply current vector object to another and returns new vector instance.
Name |
Type |
Description |
vec |
Vec3
|
Multiply vector. |
Returns:
-
-
Multiply current vector object to another and store result in the current instance.
Name |
Type |
Description |
vec |
Vec3
|
Multiply vector. |
Returns:
-
-
Negate current vector.
Returns:
-
-
Negate current vector to another instance.
Returns:
-
-
Returns normalized vector.
- Deprecated
Returns:
-
-
Normalize current vector.
Returns:
-
-
Returns normalized negate vector.
Returns:
-
normalNegateScale(){Vec3}
-
Returns normalized negate scale vector.
Returns:
-
-
Returns normalized scale vector.
Returns:
-
projToRay(pos, direction){Vec3}
-
Gets projected point coordinates of the current vector on the ray.
Name |
Type |
Description |
pos |
Vec3
|
Ray position. |
direction |
Vec3
|
Ray direction. |
Returns:
-
-
Scale current vector.
Name |
Type |
Description |
scale |
number
|
Scale value. |
Returns:
-
-
Scale current vector to another instance.
Name |
Type |
Description |
scale |
number
|
Scale value. |
Returns:
-
-
Sets vector's values.
Name |
Type |
Description |
x |
number
|
Value X. |
y |
number
|
Value Y. |
z |
number
|
Value Z. |
Returns:
-
-
Spherically interpolates between two vectors.
Interpolates between current and v2 vector by amount t. The difference between this and linear interpolation (aka, "lerp") is that
the vectors are treated as directions rather than points in space. The direction of the returned vector is interpolated
by the angle and its magnitude is interpolated between the magnitudes of from and to.
Name |
Type |
Description |
v2 |
Vec3
|
- |
t |
number
|
The parameter t is clamped to the range [0, 1]. |
Returns:
-
-
Returns vector interpolation by v(t) = v1 * t + v2 * (1 - t)
Name |
Type |
Description |
v2 |
Vec3
|
End vector. |
t |
number
|
Interpolate value. |
Returns:
-
-
Gets vector subtraction.
Name |
Type |
Description |
point3 |
Vec3
|
Subtract vector. |
Returns:
Type |
Description |
Vec3
|
Returns new instance of a subtraction |
-
-
Subtract vector from the current.
Name |
Type |
Description |
point3 |
Vec3
|
Subtract vector. |
Returns:
-
toArray(){Array.<number>}
-
Converts vector to a number array.
Returns:
Type |
Description |
Array.<number>
|
- (exactly 3 entries) |
-
-
Converts vector to text string.
Returns:
Type |
Description |
string
|
- |
-
-
Converts vector to a number array.
- Deprecated
Returns:
Type |
Description |
Array.<number>
|
- (exactly 3 entries) |
-
-
Converts to 4d vector, Fourth value is 1.0.
Returns:
-
staticmodule:og/math/Vec3.Vec3.add(a, b){Vec3}
-
Returns summary vector.
Name |
Type |
Description |
a |
Vec3
|
First vector. |
b |
Vec3
|
Second vector. |
Returns:
Type |
Description |
Vec3
|
- Summary vector. |
-
staticmodule:og/math/Vec3.Vec3.angle(a, b){number}
-
Gets angle between two vectors.
Name |
Type |
Description |
a |
Vec3
|
First vector. |
b |
Vec3
|
Second vector. |
Returns:
Type |
Description |
number
|
- |
-
staticmodule:og/math/Vec3.Vec3.div(a, b){Vec3}
-
Returns vector components division product one to another.
Name |
Type |
Description |
a |
Vec3
|
First vector. |
b |
Vec3
|
Second vector. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.doubleToTwoFloat32Array(value, high, low){Array.<number>}
-
Separate 63 bit Vec3 to two Vec3 32 bit float values.
Name |
Type |
Description |
value |
number
|
Double type value. |
high |
Float32Array
|
Out vector high values. |
low |
Float32Array
|
Out vector low values. |
Returns:
Type |
Description |
Array.<number>
|
Encoded array. (exactly 2 entries) |
-
staticmodule:og/math/Vec3.Vec3.doubleToTwoFloats(value, high, low){Array.<number>}
-
Separate 63 bit Vec3 to two Vec3 32 bit float values.
Name |
Type |
Description |
value |
number
|
Double type value. |
high |
Vec3
|
Out vector high values. |
low |
Vec3
|
Out vector low values. |
Returns:
Type |
Description |
Array.<number>
|
Encoded array. (exactly 2 entries) |
-
staticmodule:og/math/Vec3.Vec3.fromVec(arr){Vec3}
-
Creates 3d vector from array.
Name |
Type |
Description |
arr |
Array.<number>
|
Input array (exactly 3 entries) |
Returns:
-
staticmodule:og/math/Vec3.Vec3.lerp(v1, v2, l){Vec3}
-
Returns two vectors linear interpolation.
Name |
Type |
Description |
v1 |
Vec3
|
Start vector. |
v2 |
Vec3
|
End vector. |
l |
number
|
Interpolate value. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.mul(a, b){Vec3}
-
Returns two vectors production.
Name |
Type |
Description |
a |
Vec3
|
First vector. |
b |
Vec3
|
Second vector. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.noncollinear(a, b){Vec3}
-
Returns true if two vectors are non collinear.
Name |
Type |
Description |
a |
Vec3
|
First vector. |
b |
Vec3
|
Second vector. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.orthoNormalize(normal, tangent){Vec3}
-
Makes vectors normalized and orthogonal to each other.
Normalizes normal. Normalizes tangent and makes sure it is orthogonal to normal (that is, angle between them is 90 degrees).
Name |
Type |
Description |
normal |
Vec3
|
Normal vector. |
tangent |
Vec3
|
Tangent vector. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.proj_b_to_a(b, a){Vec3}
-
Get projection of the first vector to the second.
Name |
Type |
Description |
b |
Vec3
|
First vector. |
a |
Vec3
|
Second vector. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.proj_b_to_plane(b, n, def){Vec3}
-
Get projection of the vector to plane where n - normal to the plane.
Name |
Type |
Description |
b |
Vec3
|
Vector to project. |
n |
Vec3
|
Plane normal. |
def |
Vec3
|
optional
Default value for non existed result. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.projToVec(a){Vec3}
-
Get projection of the first vector to the second.
Name |
Type |
Description |
a |
Vec3
|
Project vector. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.scale(a, scale){Vec3}
-
Returns scaled vector.
Name |
Type |
Description |
a |
Vec3
|
Input vector. |
scale |
number
|
Scale value. |
Returns:
-
staticmodule:og/math/Vec3.Vec3.sub(a, b){Vec3}
-
Returns two vectors subtraction.
Name |
Type |
Description |
a |
Vec3
|
First vector. |
b |
Vec3
|
Second vector. |
Returns:
Type |
Description |
Vec3
|
- Vectors subtraction. |