new $.oVector(x, y, z)
openHarmony/openHarmony_math.js, line 555
The $.oVector constructor.
Name | Type | Default | Description |
---|---|---|---|
x |
float | a x coordinate for this vector. | |
y |
float | a y coordinate for this vector. | |
z |
float | 0 | optional a z coordinate for this vector. If ommited, will be set to 0 and vector will be 2D. |
Members
-
readonlyanglefloat
-
The angle of this vector in radians.
-
readonlydegreesAnglefloat
-
The angle of this vector in degrees.
-
readonlylengthfloat
-
The length of the vector.
-
xfloat
-
The X Coordinate of the vector.
-
yfloat
-
The Y Coordinate of the vector.
-
zfloat
-
The Z Coordinate of the vector.
Methods
-
static$.oVector.fromPoints()
openHarmony/openHarmony_math.js, line 625 -
-
add(vector2){$.oVector}
openHarmony/openHarmony_math.js, line 635 -
Adds another vector to this one.
Name Type Description vector2
$.oVector Returns:
Type Description $.oVector returns itself. -
cross(vector2){$.oVector}
openHarmony/openHarmony_math.js, line 673 -
The cross product of the two vectors
Name Type Description vector2
$.oVector a vector object. Returns:
Type Description $.oVector the resultant vector from the dot product of the two vectors. -
dot(vector2){float}
openHarmony/openHarmony_math.js, line 663 -
The dot product of the two vectors
Name Type Description vector2
$.oVector a vector object. Returns:
Type Description float the resultant vector from the dot product of the two vectors. -
multiply(num){$.oVector}
openHarmony/openHarmony_math.js, line 649 -
Multiply this vector coordinates by a number (scalar multiplication)
Name Type Description num
float Returns:
Type Description $.oVector returns itself -
normalize(){$.oVector}
openHarmony/openHarmony_math.js, line 692 -
Normalize the vector.
Returns:
Type Description $.oVector returns itself after normalization. -
project(vector2){$.oVector}
openHarmony/openHarmony_math.js, line 683 -
The projected vectors resulting from the operation
Name Type Description vector2
$.oVector a vector object. Returns:
Type Description $.oVector the resultant vector from the projection of the current vector.