Inherits ScriptObject.
Public Member Functions | |
Vector () | |
Vector (Number x, Number y, Number z) | |
Number | getX () |
setX (Number x) | |
Number | getY () |
setY (Number y) | |
Number | getZ () |
setZ (Number z) | |
Number | getCoordinate (Integer coordinate) |
setCoordinate (Integer coordinate, Number value) | |
add (Vector value) | |
add (Number x, Number y, Number z) | |
subtract (Vector value) | |
subtract (Number x, Number y, Number z) | |
multiply (Number value) | |
divide (Number value) | |
Boolean | isNonZero () |
Boolean | isZero () |
Number | getXYAngle () |
Number | getZAngle () |
Number | getLength () |
Number | getLength2 () |
normalize () | |
Vector | getNormalized () |
negate () | |
Vector | getNegated () |
Vector | getAbsolute () |
Number | getMinimum () |
Number | getMaximum () |
String | toString () |
Vector | toDeg () |
Vector | toRad () |
Static Public Member Functions | |
static Vector | sum (Vector left, Vector right) |
static Vector | diff (Vector left, Vector right) |
static Vector | product (Vector left, Number right) |
static Number | dot (Vector left, Vector right) |
static Number | getAngle (Vector v1, Vector v2) |
static Vector | cross (Vector left, Vector right) |
static Number | getDistance (Vector left, Vector right) |
static Number | getDistance2 (Vector left, Vector right) |
static Vector | lerp (Vector left, Vector right, Number u) |
static Vector | getBySpherical (Number xyAngle, Number zAngle, Number radius) |
Public Attributes | |
Number | x |
The X coordinate. | |
Number | y |
The Y coordinate. | |
Number | z |
The Z coordinate. | |
Number | length |
The length of the vector. | |
Number | length2 |
The square of the length of the vector. | |
Vector | negated |
The negated vector. | |
Vector | abs |
The vector with the absolute coordinates. | |
Vector | normalized |
The vector normalized to length 1. | |
A 3D vector (X, Y, and Z coordinates).
Vector | ( | ) |
Constructs a (0, 0, 0) vector.
Constructs a vector with the specified x, y, and z coordinates.
add | ( | Vector | value | ) |
Adds the specified vector.
Returns the cross product of this vector and the specified vector.
Returns the difference of the specified vectors.
divide | ( | Number | value | ) |
Divides the vector by the specified value.
Returns the dot product of this vector and the specified vector.
Vector getAbsolute | ( | ) |
Returns the vector with the absolute values of the coordinates.
Returns the angle between the specified vectors.
Returns the vector for the specified spherical coordinates.
Returns the distance between the specified vectors.
Returns the square of the distance between the specified vectors.
Number getLength | ( | ) |
Returns the length of this vector.
Number getLength2 | ( | ) |
Returns the square length of this vector.
Number getMaximum | ( | ) |
Returns the value for the maximum coordinate.
Number getMinimum | ( | ) |
Returns the value for the minimum coordinate.
Vector getNegated | ( | ) |
Returns the negated vector.
Vector getNormalized | ( | ) |
Returns the normalized vector.
Number getX | ( | ) |
Returns the X coordinate.
Number getXYAngle | ( | ) |
Returns the angle in the X-Y plane (spherical coordinate).
Number getY | ( | ) |
Returns the Y coordinate.
Number getZ | ( | ) |
Returns the Z coordinate.
Number getZAngle | ( | ) |
Returns the Z angle relative to the X-Y plane (spherical coordinate).
Boolean isNonZero | ( | ) |
Returns true if the vector has non-zero length.
Boolean isZero | ( | ) |
Returns true if the vector has non-zero length.
Linear interpolation between the specified vectors. The U coordinate is clamped to the range [0; 1]. U equal to 0 and 1 corresponds to the left vector and the right vector, respectively.
multiply | ( | Number | value | ) |
Multiplies the specified value.
negate | ( | ) |
Negates the vector.
normalize | ( | ) |
Normalizes the vector.
Returns the product of the specified vector and number.
Sets the specified coordinate (0:X, 1:Y, and 2:Z).
setX | ( | Number | x | ) |
Sets the X coordinate.
setY | ( | Number | y | ) |
Sets the Y coordinate.
setZ | ( | Number | z | ) |
Sets the Z coordinate.
subtract | ( | Vector | value | ) |
Subtracts the specified vector.
Vector toDeg | ( | ) |
Returns the value converted from radians to degrees.
Vector toRad | ( | ) |
Returns the value converted from degrees to radians.
String toString | ( | ) |
Converts the vector to a string (e.g. (1, 2, 3)).