Class: AxVector4

AxVector4(v1, v2non-null, v3non-null, v4non-null)

new AxVector4(v1, v2non-null, v3non-null, v4non-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, Number) - Sets the x, y, z and w components to the values of the given numbers in the respective order (AxVector2, Number, Number) - Sets the x and y components to the respective values from the given vector and the z and w components to the values of the given numbers in the respective order (AxVector3, Number) - Sets the x, y and z components to the respective values from the given vector and the w component to the value of the given number (AxVector4) - Copies the components from the given vector
Parameters:
Name Type Description
v1 Number | AxVector2 | AxVector3 | AxVector4 For (number) input - the value to set to all components. For (x, y, z, w) input - the value for the X component of the vector. For (AxVector2, z, w) input - the AxVector2 which contains the x and y components. For (AxVector3, w) input - the AxVector3 which contains the x, y and z components. For (AxVector4) input - the vector to copy from
v2 Number For (x, y, z, w) input - the value for the Y component. For (AxVector2, z, w) input - the value for the Z component. For (AxVector3, w) input - the value for the W component.
v3 Number For (x, y, z, w) input - the value for the Z component. For (AxVector2, z, w) input - the value for the W component.
v4 Number For (x, y, z, w) input - the value for the W component.
Source:

Methods

Add(v) → {AxVector4}

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

Cross(v1, v2) → {AxVector4}

Returns the cross product of the original vector and the given one
Parameters:
Name Type Description
v1 AxVector4 The first vector to calculate cross product against
v2 AxVector4 The second vector to calculate cross product against
Source:
Returns:
The cross product of the original vector and the given one
Type
AxVector4

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 AxVector4 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 AxVector4 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 AxVector4 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() → {AxVector4}

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

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 AxVector4 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

Max(v) → {AxVector4}

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 AxVector4 The vector, whose components to compare against
Source:
Returns:
A component-wise maximum vector
Type
AxVector4

Min(v) → {AxVector4}

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 AxVector4 The vector, whose components to compare against
Source:
Returns:
A component-wise minimum vector
Type
AxVector4

Normalize() → {AxVector4}

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

OfLength(length) → {AxVector4}

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
AxVector4

Scale(v) → {AxVector4}

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

Scale(factor) → {AxVector4}

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
AxVector4

Set(v1, v2non-null, v3non-null, v4non-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, Number) - Sets the x, y, z and w components to the values of the given numbers in the respective order (AxVector2, Number, Number) - Sets the x and y components to the respective values from the given vector and the z and w components to the values of the given numbers in the respective order (AxVector3, Number) - Sets the x, y and z components to the respective values from the given vector and the w component to the value of the given number (AxVector4) - Copies the components from the given vector
Parameters:
Name Type Description
v1 Number | AxVector2 | AxVector3 | AxVector4 For (number) input - the value to set to all components. For (x, y, z, w) input - the value for the X component of the vector. For (AxVector2, z, w) input - the AxVector2 which contains the x and y components. For (AxVector3, w) input - the AxVector3 which contains the x, y and z components. For (AxVector4) input - the vector to copy from
v2 Number For (x, y, z, w) input - the value for the Y component. For (AxVector2, z, w) input - the value for the Z component. For (AxVector3, w) input - the value for the W component.
v3 Number For (x, y, z, w) input - the value for the Z component. For (AxVector2, z, w) input - the value for the W component.
v4 Number For (x, y, z, w) input - the value for the W 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 four component of the vector to
Source:

Set_2(x, y, z, w)

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
w Number The value for the W component of the vector
Source:

Set_3(source, z, w)

Constructs the vector's X and Y components from a 2D vector and the Z and W components from values
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
w Number A value to use as source for the W component
Source:

Set_4(source, w)

Constructs the vector's X and Y components from a 3D vector and the W component from a value
Parameters:
Name Type Description
source AxVector3 A 3D vector to use as source for the X, Y and Z components
w Number A value to use as source for the W component
Source:

Set_5(source)

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

Subtract(v) → {AxVector4}

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

Transform(transformation) → {AxVector4}

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
AxVector4

(static) Add(result, v1, v2)

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

(static) Copy(result, source)

Copies the source vector into the result
Parameters:
Name Type Description
result AxVector4 The vector to copy to
source AxVector4 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 AxVector4 The resulting vector produced by adding the two vectors
v1 AxVector4 First vector
v2 AxVector4 Second vector
Source:

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

Calculates the distance between two points in 3D space
Parameters:
Name Type Description
v1 AxVector4 First point
v2 AxVector4 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 AxVector4 First vector
v2 AxVector4 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 AxVector4 The resulting inverted vector
v AxVector4 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 AxVector4 The resulting vector produced by interpolating between the given two vectors
v1 AxVector4 First vector
v2 AxVector4 Second vector
factor Number Interpolation factor. Having this factor outside of [0, 1] results in extrapolation
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 AxVector4 The resulting vector, having the greater components taken from the two original ones
v1 AxVector4 Original vector to compare against
v2 AxVector4 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 AxVector4 The resulting vector, having the lesser components taken from the two original ones
v1 AxVector4 Original vector to compare against
v2 AxVector4 Original vector to compare against
Source:

(static) Normalize(result, v)

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

(static) Scale(result, v1, factor)

Scales a vector by a scalar value
Parameters:
Name Type Description
result AxVector4 The resulting vector produced by scaling the given vector
v1 AxVector4 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 AxVector4 The resulting vector produced by scaling the given vector
v1 AxVector4 Original vector for scaling
v2 AxVector4 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 AxVector4 The resulting vector
v AxVector4 The vector which holds the orientation
length Number The length value for the new vector
Source:

(static) Subtract(result, v1, v2)

Subtracts two vectors
Parameters:
Name Type Description
result AxVector4 The resulting vector produced by subtracting the second vector from the first
v1 AxVector4 Vector to subtract from
v2 AxVector4 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 AxVector4 The resulting transformed vector
v AxVector4 The original vector to be transformed
transformation AxMatrix The transformation matrix to use
Source:

(static) Transform_2(result, v, transformation)

Transforms a 3D vector by a given tranformation matrix and returns a 4D vector. This transformation does not take into account the translation of the transformation
Parameters:
Name Type Description
result AxVector4 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)