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 (Number tolerance) |
Boolean | isZero (Number tolerance) |
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 () |
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 true if two vectors are different.
a | First vector to compare. |
b | Second vector to compare. |
tolerance | An optional comparison tolerance/accuracy. If 'tolerance' is greater than or equal to 1 then 'tolerance' specifies the number of digits to the right of the decimal to truncate the vectors to prior to comparison. |
Returns true if two vectors are parallel.
a | First vector to compare. |
b | Second vector to compare. |
tolerance | An optional comparison tolerance/accuracy. If 'tolerance' is greater than or equal to 1 then 'tolerance' specifies the number of digits to the right of the decimal to truncate the vectors to prior to comparison. |
Returns true if two vectors are perpendicular.
a | First vector to compare. |
b | Second vector to compare. |
tolerance | An optional comparison tolerance/accuracy. If 'tolerance' is greater than or equal to 1 then 'tolerance' specifies the number of digits to the right of the decimal to truncate the vectors to prior to comparison. |
Returns true if two vectors are in the same direction.
a | First vector to compare. |
b | Second vector to compare. |
tolerance | An optional comparison tolerance/accuracy. If 'tolerance' is greater than or equal to 1 then 'tolerance' specifies the number of digits to the right of the decimal to truncate the vectors to prior to comparison. |
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).
Returns true if the vector has non-zero length.
tolerance | An optional comparison tolerance/accuracy. If 'tolerance' is greater than or equal to 1 then 'tolerance' specifies the number of digits to the right of the decimal to truncate the vector to prior to comparison. |
'tolerance' is available:
Returns true if the vector is zero length.
tolerance | An optional comparison tolerance/accuracy. If 'tolerance' is greater than or equal to 1 then 'tolerance' specifies the number of digits to the right of the decimal to truncate the vector to prior to comparison. |
'tolerance' is available:
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 distance between a point and a line of infinite length.
point | Point used to calculate distance to line. |
start | First point on infinite line. |
end | Second point on infinite line. |
Returns the distance between a point and a plane.
point | Point used to calculate the distance to plane. |
planePoint | Point on plane. |
planeNormal | Vector normal to plane. |
Returns the distance between a point and a line segment. If the projected point is outside of the line segment, then the distance to the closest end point of the line segment is returned.
point | Point used to calculate the distance to line. |
start | Start point of line segment. |
end | End point of line segment. |
Returns the product of the specified vector and number.
Projects a point to a line of infinite length.
point | Point to project onto line. |
start | First point on infinite line. |
end | Second point on infinite line. |
Projects a point to a plane.
point | Point to project onto plane. |
planePoint | Point on plane. |
planeNormal | Vector normal to plane. |
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)).