Circular3DVectorModule
12 Sep 20254 minutes to read
Represents a circular 3D vector in space.
Properties
x number
The x-coordinate of the vector.
y number
The y-coordinate of the vector.
z number
The z-coordinate of the vector.
Methods
getLength
Calculates the length of a vector.
| Parameter | Type | Description |
|---|---|---|
| vector | Circular3DVector |
The vector to calculate the length of. |
Returns number
getNormal
Calculates the normal vector of a triangle defined by three vectors.
| Parameter | Type | Description |
|---|---|---|
| v1 | Circular3DVector |
The first vertex of the triangle. |
| v2 | Circular3DVector |
The second vertex of the triangle. |
| v3 | Circular3DVector |
The third vertex of the triangle. |
Returns Circular3DVector
isValid
Checks if a vector is valid (not NaN for any component).
| Parameter | Type | Description |
|---|---|---|
| point | Circular3DVector |
The vector to check. |
Returns boolean
vector3D
Creates a new Vector3D instance from provided coordinates.
| Parameter | Type | Description |
|---|---|---|
| vx |
Object | number
|
Either an object with x and y properties or the x-coordinate. |
| vy | number |
The y-coordinate. |
| vz | number |
The z-coordinate. |
Returns Circular3DVector
vector3DAdd
Calculates the dot product of two vectors.
| Parameter | Type | Description |
|---|---|---|
| v1 | Circular3DVector |
The first vector. |
| v2 | Circular3DVector |
The second vector. |
Returns number
vector3DMinus
Subtracts one vector from another and returns the result.
| Parameter | Type | Description |
|---|---|---|
| v1 | Circular3DVector |
The first vector. |
| v2 | Circular3DVector |
The second vector to subtract from the first. |
Returns Circular3DVector
vector3DMultiply
Multiplies two vectors using the cross product and returns the result.
| Parameter | Type | Description |
|---|---|---|
| v1 | Circular3DVector |
The first vector. |
| v2 | Circular3DVector |
The second vector. |
Returns Circular3DVector
vector3DPlus
Adds two vectors and returns the result.
| Parameter | Type | Description |
|---|---|---|
| v1 | Circular3DVector |
The first vector. |
| v2 | Circular3DVector |
The second vector to add to the first. |
Returns Circular3DVector
vector3DStarMultiply
Multiplies a vector by a scalar value.
| Parameter | Type | Description |
|---|---|---|
| v1 | Circular3DVector |
The vector to multiply. |
| value | number |
The scalar value. |
Returns Circular3DVector