new Vector(
x
?,y
?,z
?):Vector
number
X coordinate of 3D vector.
number
Y coordinate of 3D vector.
number
Z coordinate of 3D vector.
get x():
number
Returns x coordinate of 3D vector.
number
set x(
x
):void
Sets x coordinate of 3D vector.
number
X coordinate.
void
get y():
number
Returns y coordinate of 3D vector.
number
set y(
y
):void
Sets y coordinate of 3D vector.
number
Y coordinate.
void
get z():
number
Returns z coordinate of 3D vector.
number
set z(
z
):void
Sets z coordinate of 3D vector.
number
Z coordinate.
void
add(
other
):this
Adds other
vector coordinates to this
vector coordinates.
Other vector.
this
added(
other
):Vector
Returns new Vector
object with coordinates received by performing a add() operation to this
object.
Other vector.
angle(
other
):number
Returns angle between this
and other
vectors.
Other vector.
number
clone():
Vector
Creates new Vector
object with coordinates same as this
.
copy(
other
):this
Copies the coordinates of the other
vector to this
.
Copied object.
this
cross(
other
):this
Sets coordinates of this
vector as cross product of this
and other
vectors.
Other vector.
this
crossed(
other
):Vector
Returns new Vector
object with coordinates received by performing a cross() operation to this
object.
Other vector.
divide(
scalar
):this
Divide this
vector coordinates by scalar
value.
number
Scalar value.
this
divided(
scalar
):Vector
Returns new Vector
object with coordinates received by performing a divide() operation to this
object.
number
Scalar value.
dot(
other
):number
Returns dot product of this
and other
vector.
Other vector.
number
isEqual(
other
,tolerance
?):boolean
Returns true
if other
vector coordinates are equal to this
vector coordinated within provided tolerance (1e-7
by default). Returns false
otherwise.
Other 3D vector.
number
Coordinates comparison tolerance;
boolean
isNormal(
other
,tolerance
?):boolean
Returns true
if other
vector is perpendicular to this
within provided tolerance (1e-7
by default).
Other vector.
number
boolean
isOpposite(
other
,tolerance
?):boolean
Returns true
if other
vector is opposite to this
within provided tolerance (1e-7
by default).
Other vector.
number
boolean
isParallel(
other
,tolerance
?):boolean
Returns true
if other
vector is parallel to this
within provided tolerance (1e-7
by default).
Other vector.
number
boolean
length():
number
Returns length of the vector.
number
mirror(
direction
):this
Mirrors this
3D vector relative to direction
.
Direction.
this
mirror(
axis
):this
Mirrors this
3D vector relative to axis
.
Axis.
this
mirror(
axis
):this
Mirrors this
3D vector relative to axis
.
Axis.
this
mirrored(
direction
):Vector
Returns new Vector
object with coordinates received by performing a mirror() operation to this
object.
Direction.
mirrored(
axis
):Vector
Returns new Vector
object with coordinates received by performing a mirror() operation to this
object.
Axis.
mirrored(
axis
):Vector
Returns new Vector
object with coordinates received by performing a mirror() operation to this
object.
Axis.
multiplied(
other
):Vector
Returns new Vector
object with coordinates received by performing a multiply() operation to this
object.
Other vector.
multiplied(
matrix
):Vector
Returns new Vector
object with coordinates received by performing a multiply() operation to this
object.
3D matrix.
multiplied(
scalar
):Vector
Returns new Vector
object with coordinates received by performing a multiply() operation to this
object.
number
Scalar value.
multiply(
other
):this
Multiplies this
vector coordinates with other
vector coordinates.
Other vector.
this
multiply(
matrix
):this
Multiplies this
point coordinates with 3D matrix.
3D matrix.
this
multiply(
scalar
):this
Multiplies this
vector coordinates with scalar
value.
number
Scalar value.
this
normalize():
this
Normalizes coordinates of this
vector.
this
normalized():
Vector
Returns new Vector
object with normalized coordinates of this
vector.
reverse():
this
Reverses coordinates of this
vector.
this
reversed():
Vector
Returns new Vector
object with coordinates received by performing a reverse() operation to this
object.
rotate(
axis
,angle
):this
Rotates this
3D vector around axis
on angle
.
Rotation axis.
number
Rotation angle.
this
rotated(
axis
,angle
):Vector
Returns new Vector
object with coordinates received by performing a rotate() operation to this
object.
Rotation axis.
number
Rotation angle.
setCoord(
x
?,y
?,z
?):this
Sets x
,y
and z
coordinates of this
object.
number
X coordinate of 3D vector.
number
Y coordinate of 3D vector.
number
Z coordinate of 3D vector.
this
setX(
x
):this
Sets x coordinate of 3D vector.
number
X coordinate.
this
setY(
y
):this
Sets y coordinate of 3D vector.
number
Y coordinate.
this
setZ(
z
):this
Sets z coordinate of 3D vector.
number
Z coordinate.
this
subtract(
other
):this
Subtracts other
vector coordinates from this
vector coordinates.
Other vector.
this
subtracted(
other
):Vector
Returns new Vector
object with coordinates received by performing a subtract() operation to this
object.
Other vector.
toJSON():
BaseXYZ
Returns JSON representation of this
vector.
toString(
precision
):string
Returns string representation of this
vector with provided precision (3
by default).
number
= 3
Precision.
string
transform(
transformation
):this
Transforms coordinates of this
vector according to transformation
.
Transformation.
this
transformed(
transformation
):Vector
Returns new Vector
object with coordinates received by performing a transform() operation to this
object.
Transformation.
static
fromPoints(start
,end
):Vector
Creates new Vector
object from two points that represents start and end points of the vector.
Start point.
End point.
static
fromXYZ(xyz
):Vector
Creates new Vector
object from object implementing BaseXYZ interface.
Object implementing BaseXYZ interface.