Vector3D
12 Sep 20254 minutes to read
Represents a three-dimensional 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 | Chart3DVector | 
      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 | Chart3DVector | 
      The first vertex of the triangle. | 
| v2 | Chart3DVector | 
      The second vertex of the triangle. | 
| v3 | Chart3DVector | 
      The third vertex of the triangle. | 
Returns Chart3DVector
isValid
Checks if a vector is valid (not NaN for any component).
| Parameter | Type | Description | 
|---|---|---|
| point | Chart3DVector | 
      The vector to check. | 
Returns boolean
normalize
Normalizes the vector to have a length of 1.
Returns void
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 Chart3DVector
vector3DAdd
Calculates the dot product of two vectors.
| Parameter | Type | Description | 
|---|---|---|
| v1 | Chart3DVector | 
      The first vector. | 
| v2 | Chart3DVector | 
      The second vector. | 
Returns number
vector3DMinus
Subtracts one vector from another and returns the result.
| Parameter | Type | Description | 
|---|---|---|
| v1 | Chart3DVector | 
      The first vector. | 
| v2 | Chart3DVector | 
      The second vector to subtract from the first. | 
Returns Chart3DVector
vector3DMultiply
Multiplies two vectors using the cross product and returns the result.
| Parameter | Type | Description | 
|---|---|---|
| v1 | Chart3DVector | 
      The first vector. | 
| v2 | Chart3DVector | 
      The second vector. | 
Returns Chart3DVector
vector3DPlus
Adds two vectors and returns the result.
| Parameter | Type | Description | 
|---|---|---|
| v1 | Chart3DVector | 
      The first vector. | 
| v2 | Chart3DVector | 
      The second vector to add to the first. | 
Returns Chart3DVector
vector3DStarMultiply
Multiplies a vector by a scalar value.
| Parameter | Type | Description | 
|---|---|---|
| v1 | Chart3DVector | 
      The vector to multiply. | 
| value | number | 
      The scalar value. | 
Returns Chart3DVector