Class: AxVector3

AxVector3(v1, v2non-null, v3non-null)

new AxVector3(v1, v2non-null, v3non-null)

Creates a vector object and initializes its components Sets the components of the vector to the given values. Supports multiple input formats Valid input formats are () - Initializes all components to zero (Number) - Sets all components to the value of the given number (Number, Number, Number) - Sets the x, y and z components to the values of the given numbers in the respective order (AxVector2, Number) - Sets the x and y components to the respective values from the given vector and the z component to the values of the given number (AxVector3) - Copies the components from the given vector
Parameters:
Name Type Description
v1 Number | AxVector2 | AxVector3 For (number) input - the value to set to all components. For (x, y, z) input - the value for the X component of the vector. For (AxVector2, z) input - the AxVector2 which contains the x and y components. For (AxVector3) input - the vector to copy from.
v2 Number For (x, y, z) input - the value for the Y component. For (AxVector2, z) input - the value for the Z component.
v3 Number For (x, y, z) input - the value for the Z component.
Source:

Methods

Add(v) → {AxVector3}

Returns a vetor which is the sum of the original vector and the given one
Parameters:
Name Type Description
v AxVector3 The vector, which is to be added to the original one
Source:
Returns:
The sum of the original vector and the given one
Type
AxVector3

CartesianToSpherical() → {AxVector3}

Given the original vector contains Cartesian space coordinates (x, y and z), returns the spatially equivalent vector in spherical space coordinates, such that X corresponds to azimuth, Y corresponds to elevation and Z corresponds to radius
Source:
Returns:
The spatially equivalent vector in spherical space coordinates, where X is azimuth, Y is elevation and Z is radius
Type
AxVector3

Cross(v) → {AxVector3}

Returns the cross product of the original vector and the given one
Parameters:
Name Type Description
v AxVector3 The vector to calculate cross product against
Source:
Returns:
The cross product of the original vector and the given one
Type
AxVector3

DistanceTo(v) → {Number}

Returns the distance between the point represented by the vector and a point represented by the given vector
Parameters:
Name Type Description
v AxVector3 A vector representing the point to which distance will be calculated
Source:
Returns:
The distance to the given point
Type
Number

Dot(v) → {Number}

Returns the dot product of the original vector and the given one
Parameters:
Name Type Description
v AxVector3 The vector to calculate dot product against
Source:
Returns:
The dot product of the original vector and the given one
Type
Number

Equals(vector) → {Boolean}

Compares the vector with another one and returns true if both are identical
Parameters:
Name Type Description
vector AxVector3 The vector to compare with
Source:
Returns:
True if identical to the given vector
Type
Boolean

GetLength() → {Number}

Calculates the length of the vector
Source:
Returns:
Returns the length of the vector
Type
Number

Invert() → {AxVector3}

Returns the vector inverted
Source:
Returns:
An inverted version of the original vector
Type
AxVector3

Lerp(v, factor) → {Number}

Returns a linearly vector interpolated between (or extrapolated outside of) the original and the given one
Parameters:
Name Type Description
v AxVector3 The vector towards which to interpolate (or extrapolate)
factor Number The interpolation (or extrapolation) value. Values between 0 and 1 result in interpolation, while values outside of this range result in extrapolation.
Source:
Returns:
A linearly interpolated (or extrapolated) vector
Type
Number

LerpAngles(v, factor) → {Number}

Interpolates between the components of the original vector and the given one, treating them as angles, thus performing the interpolation between the angular smallest interval
Parameters:
Name Type Description
v AxVector3 The vector towards which to interpolate
factor Number The interpolation value
Source:
Returns:
The interpolation result
Type
Number

LerpSpherical(s, factor) → {AxVector3}

Returns a vector in spherical coordinates, which is a linear interpolation between (or extrapolation outside of) the original vector and the provided one, given both are also in spherical coordinates Spherical coordinates are interpreted as X being azimuth, Y being elevation and Z being radius
Parameters:
Name Type Description
s AxVector3 The vector in spherical coordinates, towards which to interpolate (or extrapolate)
factor Number The interpolation (or extrapolation) value. Values between 0 and 1 result in interpolation, while values outside of this range result in extrapolation.
Source:
Returns:
A linearly interpolated (or extrapolated) vector in spherical coordinates, given the original vector and the provided one are also in spherical coordinates
Type
AxVector3

Max(v) → {AxVector3}

Returns a vector with each of its components being the greater between their original value and the value of the corresponding component of the given vector. In effect, the result is a component-wise maximum vector
Parameters:
Name Type Description
v AxVector3 The vector, whose components to compare against
Source:
Returns:
A component-wise maximum vector
Type
AxVector3

Min(v) → {AxVector3}

Returns a vector with each of its components being the lesser between their original value and the value of the corresponding component of the given vector. In effect, the result is a component-wise minimum vector
Parameters:
Name Type Description
v AxVector3 The vector, whose components to compare against
Source:
Returns:
A component-wise minimum vector
Type
AxVector3

Normalize() → {AxVector3}

Returns the vector normalized
Source:
Returns:
A normalized version of the original vector
Type
AxVector3

OfLength(length) → {AxVector3}

Return a vector with the same orientation, but of the given length
Parameters:
Name Type Description
length Number Length of the returned vector
Source:
Returns:
A vector with the same orientation as the original, but of the given length
Type
AxVector3

Scale(factor) → {AxVector3}

Returns the vector with each of its components multiplied by the given value
Parameters:
Name Type Description
factor Number The value by which to multiply the components of the original vector
Source:
Returns:
The component-wise scaled vector
Type
AxVector3

Scale(v) → {AxVector3}

Returns the vector with each of its components multiplied by the components of the given vector
Parameters:
Name Type Description
v AxVector3 The vector by which compoenents to multiply the components of the original one
Source:
Returns:
The component-wise scaled vector
Type
AxVector3

Set(v1, v2non-null, v3non-null)

Sets the components of the vector to the given values. Supports multiple input formats Valid input formats are (Number) - Sets all components to the value of the given number (Number, Number, Number) - Sets the x, y and z components to the values of the given numbers in the respective order (AxVector2, Number) - Sets the x and y components to the respective values from the given vector and the z component to the values of the given number (AxVector3) - Copies the components from the given vector
Parameters:
Name Type Description
v1 Number | AxVector2 | AxVector3 For (number) input - the value to set to all components. For (x, y, z) input - the value for the X component of the vector. For (AxVector2, z) input - the AxVector2 which contains the x and y components. For (AxVector3) input - the vector to copy from.
v2 Number For (x, y, z) input - the value for the Y component. For (AxVector2, z) input - the value for the Z component.
v3 Number For (x, y, z) input - the value for the Z component.
Source:

Set_1(value)

Sets the components of the vectors to the given value
Parameters:
Name Type Description
value Number The value to set all the three component of the vector to
Source:

Set_2(x, y, z)

Sets the components of the vectors to the given values
Parameters:
Name Type Description
x Number The value for the X component of the vector
y Number The value for the Y component of the vector
z Number The value for the Z component of the vector
Source:

Set_3(source, z)

Constructs the vector's X and Y components from a 2D vector and the Z component from a value
Parameters:
Name Type Description
source AxVector2 A 2D vector to use as source for the X and Y components
z Number A value to use as source for the Z component
Source:

Set_4(source)

Copies the source vector
Parameters:
Name Type Description
source AxVector3 A vector to copy from
Source:

SphericalToCartesian() → {AxVector3}

Given the original vector contains spherical space coordinates (X as azimuth, Y as elevation and Z as radius), returns a spatially equivalent vector in Cartesian space coordinates.
Source:
Returns:
The spatially equivalent vector in Cartesian space coordinates, given the original vector is in spherical coordinates
Type
AxVector3

Subtract(v) → {AxVector3}

Returns a vetor which is the difference between the original vector and the given one
Parameters:
Name Type Description
v AxVector3 The vector, which is to be subtracted from the original one
Source:
Returns:
The difference between the original vector and the given one
Type
AxVector3

Transform(transformation) → {AxVector3}

Returns a vector which is the original one, transformed by the given transformation matrix
Parameters:
Name Type Description
transformation AxMatrix The transformation matrix to apply
Source:
Returns:
The transformed vector
Type
AxVector3

(static) Add(result, v1, v2)

Adds two vectors
Parameters:
Name Type Description
result AxVector3 The resulting vector produced by adding the two vectors
v1 AxVector3 First vector
v2 AxVector3 Second vector
Source:

(static) CartesianToSpherical(result, x, ynon-null, znon-null)

Converts Cartesian coordinates into spherical coordinates Accepts 2 sets of input parameters: A result vector and an input vector A result vector and the three coordinates of the input vector The result coordinates are as follow: result.x - azimuth: range 0 to 2Pi, initial direction is negative Z (east), increasing towards full revolution around positive Y result.y - elevation: range -Pi/2 to Pi/2, initial direction is negative Y (down), increasing towards positive Y (up) result.z - distance
Parameters:
Name Type Description
result AxVector3 The resulting vector containing the spherical coordinates.
x Number | AxVector3 The X cartesian coordinate or a whole vector containing the three cartesian coordinates
y Number The Y cartesian coordinate
z Number The Z cartesian coordinate
Source:

(static) CartesianToSpherical_1(result, x, y, z)

Converts Cartesian coordinates into spherical coordinates The result coordinates are as follow: result.x - azimuth: range 0 to 2Pi, initial direction is negative Z (east), increasing towards full revolution around positive Y result.y - elevation: range -Pi/2 to Pi/2, initial direction is negative Y (down), increasing towards positive Y (up) result.z - distance
Parameters:
Name Type Description
result AxVector3 The resulting vector containing the spherical coordinates.
x Number The X cartesian coordinate
y Number The Y cartesian coordinate
z Number The Z cartesian coordinate
Source:

(static) CartesianToSpherical_2(result, cartesian)

Converts Cartesian coordinates into spherical coordinates The result coordinates are as follow: result.x - azimuth: range 0 to 2Pi, initial direction is negative Z (east), increasing towards full revolution around positive Y result.y - elevation: range -Pi/2 to Pi/2, initial direction is negative Y (down), increasing towards positive Y (up) result.z - distance
Parameters:
Name Type Description
result AxVector3 The resulting vector containing the spherical coordinates.
cartesian AxVector3 The vector containing the cartesian coordinates
Source:

(static) Copy(result, source)

Copies the source vector into the result
Parameters:
Name Type Description
result AxVector3 The vector to copy to
source AxVector3 The vector to copy from
Source:

(static) Cross(result, v1, v2)

Calculates the cross product (a.k.a. vector product) of two vectors
Parameters:
Name Type Description
result AxVector3 The resulting vector produced by adding the two vectors
v1 AxVector3 First vector
v2 AxVector3 Second vector
Source:

(static) Distance(v1, v2) → {Number}

Calculates the distance between two points in 3D space
Parameters:
Name Type Description
v1 AxVector3 First point
v2 AxVector3 Second point
Source:
Returns:
The distance between the two points
Type
Number

(static) Dot(v1, v2) → {Number}

Calculates the dot product (a.k.a. scalar product) of two vectors.
Parameters:
Name Type Description
v1 AxVector3 First vector
v2 AxVector3 Second vector
Source:
Returns:
The dot product of the two vectors
Type
Number

(static) Invert(result, v)

Inverts a vector
Parameters:
Name Type Description
result AxVector3 The resulting inverted vector
v AxVector3 The vector to be inverted
Source:

(static) Lerp(result, v1, v2, factor)

Performs linear interpolation or extrapolation between two vectors
Parameters:
Name Type Description
result AxVector3 The resulting vector produced by interpolating between the given two vectors
v1 AxVector3 First vector
v2 AxVector3 Second vector
factor Number Interpolation factor. Having this factor outside of [0, 1] results in extrapolation
Source:

(static) LerpAngles(result, v1, v2, factor)

Interpolates between the components of the vector, treating them as angles, thus performing the interpolation between the angular smallest interval
Parameters:
Name Type Description
result AxVector3 The resulting vector
v1 AxVector3 The first vector of angular components
v2 AxVector3 The second vector of angular comonents
factor Number The factor by which to interpolate
Source:

(static) LerpSpherical(result, v1, v2, factor)

Interpolates between spherical coordinates, producing a gradual change of a vector's orientation The spherical coordinates are as follow: x - azimuth: range 0 to 2Pi, initial direction is negative Z (east), increasing towards full revolution around positive Y y - elevation: range -Pi/2 to Pi/2, initial direction is negative Y (down), increasing towards positive Y (up) z - distance
Parameters:
Name Type Description
result AxVector3 The resulting vector
v1 AxVector3 The first vector of spherical coordinates
v2 AxVector3 The second vector of spherical coordinates
factor Number The factor by which to interpolate
Source:

(static) Max(result, v1, v2)

Produces a vector whose components are each the greater corresponding component from two other vectors
Parameters:
Name Type Description
result AxVector3 The resulting vector, having the greater components taken from the two original ones
v1 AxVector3 Original vector to compare against
v2 AxVector3 Original vector to compare against
Source:

(static) Min(result, v1, v2)

Produces a vector whose components are each the lesser corresponding component from two other vectors
Parameters:
Name Type Description
result AxVector3 The resulting vector, having the lesser components taken from the two original ones
v1 AxVector3 Original vector to compare against
v2 AxVector3 Original vector to compare against
Source:

(static) Normalize(result, v)

Normalizes a vector
Parameters:
Name Type Description
result AxVector3 The resulting normalized vector
v AxVector3 The vector to be normalized
Source:

(static) Scale(result, v1, factor)

Scales a vector by a scalar value
Parameters:
Name Type Description
result AxVector3 The resulting vector produced by scaling the given vector
v1 AxVector3 Original vector for scaling
factor Number Scaling factor
Source:

(static) Scale_2(result, v1, v2)

Scales a vector's components by the components of another vector
Parameters:
Name Type Description
result AxVector3 The resulting vector produced by scaling the given vector
v1 AxVector3 Original vector for scaling
v2 AxVector3 Vector containing the per-component scaling factors
Source:

(static) SetLength(result, v, length)

Produces a vector with an orientation given by another vector and a given length
Parameters:
Name Type Description
result AxVector3 The resulting vector
v AxVector3 The vector which holds the orientation
length Number The length value for the new vector
Source:

(static) SphericalToCartesian(result, arg1, arg2, arg3)

Converts spherical coordinates into Cartesian coordinates Accepts 2 sets of input parameters: A result vector and a The spherical coordinates are as follow:
Parameters:
Name Type Description
result AxVector3 The resulting vector containing the spherical coordinates.
arg1 Number | AxVector3 A vector containing spherical coordinates or the azimuth component, in range 0 to 2Pi, initial direction being negative Z (east), increasing towards full revolution around positive Y
arg2 Number The elevation component. Range -Pi/2 to Pi/2, initial direction is negative Y (down), increasing towards positive Y (up)
arg3 Number The radial distance component
Source:

(static) SphericalToCartesian_1(result, azimuth, elevation, radius)

Converts spherical coordinates into Cartesian coordinates The spherical coordinates are as follow:
Parameters:
Name Type Description
result AxVector3 The resulting vector containing the spherical coordinates.
azimuth Number The azimuth component. Range 0 to 2Pi, initial direction is negative Z (east), increasing towards full revolution around positive Y
elevation Number The elevation component. Range -Pi/2 to Pi/2, initial direction is negative Y (down), increasing towards positive Y (up)
radius Number The radial distance component
Source:

(static) SphericalToCartesian_2(result, spherical)

Converts spherical coordinates into Cartesian coordinates The spherical coordinates are as follow: spherical.x - azimuth: range 0 to 2Pi, initial direction is negative Z (east), increasing towards full revolution around positive Y spherical.y - elevation: range -Pi/2 to Pi/2, initial direction is negative Y (down), increasing towards positive Y (up) spherical.z - distance
Parameters:
Name Type Description
result AxVector3 The resulting vector containing the Cartesian coordinates.
spherical AxVector3 The vector containing the spherical coordinates
Source:

(static) Subtract(result, v1, v2)

Subtracts two vectors
Parameters:
Name Type Description
result AxVector3 The resulting vector produced by subtracting the second vector from the first
v1 AxVector3 Vector to subtract from
v2 AxVector3 Vector to be subtracted
Source:

(static) Transform(result, v, transformation)

Transforms a vector by a given tranformation matrix. This transformation takes into account the translation of the transformation
Parameters:
Name Type Description
result AxVector3 The resulting transformed vector
v AxVector3 The original vector to be transformed
transformation AxMatrix The transformation matrix to use
Source:

(static) TransformNormal(result, v, transformation)

Transforms a vector by a given tranformation matrix. This transformation does not take into account the translation of the transformation
Parameters:
Name Type Description
result AxVector3 The resulting transformed vector
v AxVector3 The original vector to be transformed
transformation AxMatrix The transformation matrix to use
Source:

Documentation generated by JSDoc 3.5.3 on Mon Feb 19 2018 20:39:27 GMT+0200 (FLE Standard Time)