Vector3
Overview
Description
Vector3
represents a vector used in 3D space that includes x, y, and z coordinates. It is commonly used in 3D rendering, physics calculations, and position computations.
Properties
X
number
Represents the X-axis coordinate value.
Code Samples
Y
number
Represents the Y-axis coordinate value.
Code Samples
Z
number
Represents the Z-axis coordinate value.
Code Samples
zero
Vector3
A vector where all axis values are 0. (0, 0, 0)
Code Samples
one
Vector3
A vector where all axis values equal 1. (1, 1, 1)
Code Samples
xAxis
Vector3
The unit vector defined in the direction of the X-axis.
Code Samples
yAxis
Vector3
The unit vector defined in the direction of the Y-axis.
Code Samples
zAxis
Vector3
The unit vector defined in the direction of the Z-axis.
Code Samples
Constructors
new
Creates a Vector3
instance with specified x, y, and z coordinates.
Parameters
number x
The x-coordinate value
number y
The y-coordinate value
number z
The z-coordinate value
Return
Vector3
A new instance of Vector3
Code Samples
Methods
Unit
Normalizes the vector to produce a unit vector.
Parameters
Return
Vector3
The vector normalized to unit length
Code Samples
Magnitude
Calculates the magnitude (length) of the vector.
Parameters
None.
Return
number
The magnitude (length) of the vector
Code Samples
Last updated