-
-
Summarize two vectors.
Name |
Type |
Description |
v |
math.Vec2
|
|
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Adds vector to the current.
Name |
Type |
Description |
v |
math.Vec2
|
|
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Gets angle between two vectors.
Name |
Type |
Description |
a |
math.Vec2
|
Another vector. |
Returns:
-
-
Sets vector to zero.
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Returns clone vector.
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Copy input vector's values.
Name |
Type |
Description |
point2 |
math.Vec2
|
Vector to copy. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Gets vectors cross production.
Name |
Type |
Description |
v |
math.Vec2
|
Another vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Gets distance to point.
Name |
Type |
Description |
p |
math.Vec2
|
Distant point. |
Returns:
-
-
Divide current vector's components to another. Results stores in the current vector object.
Name |
Type |
Description |
vec |
math.Vec2
|
|
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Gets vectors dot production.
Name |
Type |
Description |
v |
math.Vec2
|
Another vector. |
Returns:
-
-
Gets vectors dot production.
Name |
Type |
Description |
arr |
Array.<number>
|
Array vector. (exactly 2 entries) |
Returns:
-
-
Compares with vector. Returns true if it equals another.
Name |
Type |
Description |
p |
math.Vec2
|
Vector to compare. |
Returns:
-
-
Gets vector's length.
Returns:
-
-
Returns squared vector's length.
Returns:
-
-
Returns two vectors linear interpolation.
Name |
Type |
Description |
v2 |
math.Vec2
|
End vector. |
l |
number
|
Interpolate value. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Multiply current vector object to another and returns new vector instance.
Name |
Type |
Description |
vec |
math.Vec2
|
Multiply vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Multiply current vector object to another and store result in the current instance.
Name |
Type |
Description |
vec |
math.Vec2
|
Multiply vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Negate current vector.
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Negate current vector to another instance.
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Returns normalized vector.
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Normalize current vector.
Returns:
Type |
Description |
math.Vec2
|
|
-
projToRay(pos, direction){math.Vec2}
-
Gets projected point coordinates of the current vector on the ray.
Name |
Type |
Description |
pos |
math.Vec2
|
Ray position. |
direction |
math.Vec2
|
Ray direction. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Scale current vector.
Name |
Type |
Description |
scale |
number
|
Scale value. |
Returns:
Type |
Description |
math.Vec2
|
|
-
scaleTo(scale){math.Vec2}
-
Scale current vector to another instance.
Name |
Type |
Description |
scale |
number
|
Scale value. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Sets vector's values.
Name |
Type |
Description |
x |
number
|
Value X. |
y |
number
|
Value Y. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
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 |
math.Vec2
|
- |
t |
number
|
The parameter t is clamped to the range [0, 1]. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Subtract vector from the current.
Name |
Type |
Description |
v |
math.Vec2
|
Subtract vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Subtract vector from the current where results saved on the current instance.
Name |
Type |
Description |
v |
math.Vec2
|
Subtract vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
-
Converts vector to a number array.
Returns:
Type |
Description |
Array.<number>
|
- (exactly 2 entries) |
-
-
Converts to 3d vector, third value is 0.0.
Returns:
-
staticmodule:og/math/Vec2.Vec2.add(a, b){math.Vec2}
-
Returns summary vector.
Name |
Type |
Description |
a |
math.Vec2
|
First vector. |
b |
math.Vec2
|
Second vector. |
Returns:
Type |
Description |
math.Vec2
|
- Summary vector. |
-
staticmodule:og/math/Vec2.Vec2.angle(a, b){number}
-
Gets angle between two vectors.
Name |
Type |
Description |
a |
math.Vec2
|
First vector. |
b |
math.Vec2
|
Second vector. |
Returns:
-
staticmodule:og/math/Vec2.Vec2.div(a, b){math.Vec2}
-
Returns vector components division product one to another.
Name |
Type |
Description |
a |
math.Vec2
|
First vector. |
b |
math.Vec2
|
Second vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
staticmodule:og/math/Vec2.Vec2.mul(a, b){math.Vec2}
-
Returns two vectors production.
Name |
Type |
Description |
a |
math.Vec2
|
First vector. |
b |
math.Vec2
|
Second vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
staticmodule:og/math/Vec2.Vec2.orthoNormalize(normal, tangent){math.Vec2}
-
Makes vectors normalized and orthogonal to each other.
Name |
Type |
Description |
normal |
math.Vec2
|
Normal vector. |
tangent |
math.Vec2
|
Tangent vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
staticmodule:og/math/Vec2.Vec2.proj_b_to_a(b, a){math.Vec2}
-
Get projection of the first vector to the second.
Name |
Type |
Description |
b |
math.Vec2
|
First vector. |
a |
math.Vec2
|
Second vector. |
Returns:
Type |
Description |
math.Vec2
|
|
-
staticmodule:og/math/Vec2.Vec2.scale(a, scale){math.Vec2}
-
Returns scaled vector.
Name |
Type |
Description |
a |
math.Vec2
|
Input vector. |
scale |
number
|
Scale value. |
Returns:
Type |
Description |
math.Vec2
|
|
-
staticmodule:og/math/Vec2.Vec2.sub(a, b){math.Vec2}
-
Returns two vectors subtraction.
Name |
Type |
Description |
a |
math.Vec2
|
First vector. |
b |
math.Vec2
|
Second vector. |
Returns:
Type |
Description |
math.Vec2
|
- Vectors subtraction. |