public final class Vector4 extends ValueType implements IEquatable<Vector4>
Modifier and Type | Field and Description |
---|---|
static Vector4 |
One
Returns a Vector4 with all of its components set to one.
|
static Vector4 |
UnitW
Returns the Vector4 (0, 0, 0, 1).
|
static Vector4 |
UnitX
Returns the Vector4 (1, 0, 0, 0).
|
static Vector4 |
UnitY
Returns the Vector4 (0, 1, 0, 0).
|
static Vector4 |
UnitZ
Returns the Vector4 (0, 0, 1, 0).
|
float |
W
Gets or sets the w-component of the vector.
|
float |
X
Gets or sets the x-component of the vector.
|
float |
Y
Gets or sets the y-component of the vector.
|
float |
Z
Gets or sets the z-component of the vector.
|
static Vector4 |
Zero
Returns a Vector4 with all of its components set to zero.
|
Constructor and Description |
---|
Vector4()
Creates a new instance of Vector4.
|
Vector4(float value)
Creates a new instance of Vector4.
|
Vector4(float x,
float y,
float z,
float w)
Creates a new instance of Vector4.
|
Vector4(Vector2 value,
float z,
float w)
Creates a new instance of Vector4.
|
Vector4(Vector3 value,
float w)
Creates a new instance of Vector4.
|
Modifier and Type | Method and Description |
---|---|
void |
Add(Vector4 other)
Adds the specified vector to the current vector.
|
static Vector4 |
Add(Vector4 value1,
Vector4 value2)
Adds two vectors.
|
static void |
Add(Vector4 value1,
Vector4 value2,
Vector4 result)
Adds two vectors.
|
static Vector4 |
Barycentric(Vector4 value1,
Vector4 value2,
Vector4 value3,
float amount1,
float amount2)
Returns a Vector4 containing the 4D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 4D triangle.
|
static void |
Barycentric(Vector4 value1,
Vector4 value2,
Vector4 value3,
float amount1,
float amount2,
Vector4 result)
Returns a Vector4 containing the 4D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 4D triangle.
|
static Vector4 |
CatmullRom(Vector4 value1,
Vector4 value2,
Vector4 value3,
Vector4 value4,
float amount)
Performs a Catmull-Rom interpolation using the specified positions.
|
static void |
CatmullRom(Vector4 value1,
Vector4 value2,
Vector4 value3,
Vector4 value4,
float amount,
Vector4 result)
Performs a Catmull-Rom interpolation using the specified positions.
|
static Vector4 |
Clamp(Vector4 value1,
Vector4 min,
Vector4 max)
Restricts a value to be within a specified range.
|
static void |
Clamp(Vector4 value1,
Vector4 min,
Vector4 max,
Vector4 result)
Restricts a value to be within a specified range.
|
static float |
Distance(Vector4 value1,
Vector4 value2)
Calculates the distance between two vectors.
|
static void |
Distance(Vector4 value1,
Vector4 value2,
float result)
Calculates the distance between two vectors.
|
static float |
DistanceSquared(Vector4 value1,
Vector4 value2)
Calculates the distance between two vectors squared.
|
static void |
DistanceSquared(Vector4 value1,
Vector4 value2,
float result)
Calculates the distance between two vectors squared.
|
void |
Divide(float divider)
Divides the current vector by a scalar value.
|
void |
Divide(Vector4 other)
Divides the components of the current vector by the components of another vector.
|
static Vector4 |
Divide(Vector4 value1,
float divider)
Divides a vector by a scalar value.
|
static void |
Divide(Vector4 value1,
float divider,
Vector4 result)
Divides a vector by a scalar value.
|
static Vector4 |
Divide(Vector4 value1,
Vector4 value2)
Divides the components of a vector by the components of another vector.
|
static void |
Divide(Vector4 value1,
Vector4 value2,
Vector4 result)
Divides the components of a vector by the components of another vector.
|
static float |
Dot(Vector4 vector1,
Vector4 vector2)
Calculates the dot product of two vectors.
|
static void |
Dot(Vector4 vector1,
Vector4 vector2,
float result)
Calculates the dot product of two vectors.
|
boolean |
equals(java.lang.Object obj)
Returns a value that indicates whether the current instance is equal to a specified object.
|
boolean |
Equals(Vector4 other)
Determines whether the specified Object is equal to the Vector4.
|
int |
hashCode()
Gets the hash code of this object.
|
static Vector4 |
Hermite(Vector4 value1,
Vector4 tangent1,
Vector4 value2,
Vector4 tangent2,
float amount)
Performs a Hermite spline interpolation.
|
static void |
Hermite(Vector4 value1,
Vector4 tangent1,
Vector4 value2,
Vector4 tangent2,
float amount,
Vector4 result)
Performs a Hermite spline interpolation.
|
float |
Length()
Calculates the length of the vector.
|
float |
LengthSquared()
Calculates the length of the vector squared.
|
static Vector4 |
Lerp(Vector4 value1,
Vector4 value2,
float amount)
Performs a linear interpolation between two vectors.
|
static void |
Lerp(Vector4 value1,
Vector4 value2,
float amount,
Vector4 result)
Performs a linear interpolation between two vectors.
|
static Vector4 |
Max(Vector4 value1,
Vector4 value2)
Returns a vector that contains the highest value from each matching pair of components.
|
static void |
Max(Vector4 value1,
Vector4 value2,
Vector4 result)
Returns a vector that contains the highest value from each matching pair of components.
|
static Vector4 |
Min(Vector4 value1,
Vector4 value2)
Returns a vector that contains the lowest value from each matching pair of components.
|
static void |
Min(Vector4 value1,
Vector4 value2,
Vector4 result)
Returns a vector that contains the lowest value from each matching pair of components.
|
void |
Multiply(float scaleFactor)
Multiplies the current vector by a scalar.
|
void |
Multiply(Vector4 other)
Multiplies the components of the current vector by the components of another vector.
|
static Vector4 |
Multiply(Vector4 value1,
float scaleFactor)
Multiplies a vector by a scalar.
|
static void |
Multiply(Vector4 value1,
float scaleFactor,
Vector4 result)
Multiplies a vector by a scalar.
|
static Vector4 |
Multiply(Vector4 value1,
Vector4 value2)
Multiplies the components of two vectors by each other.
|
static void |
Multiply(Vector4 value1,
Vector4 value2,
Vector4 result)
Multiplies the components of two vectors by each other.
|
void |
Negate()
Returns the current vector pointing in the opposite direction.
|
static Vector4 |
Negate(Vector4 value)
Returns a vector pointing in the opposite direction.
|
static void |
Negate(Vector4 value,
Vector4 result)
Returns a vector pointing in the opposite direction.
|
void |
Normalize()
Turns the current vector into a unit vector.
|
static Vector4 |
Normalize(Vector4 vector)
Creates a unit vector from the specified vector.
|
static void |
Normalize(Vector4 vector,
Vector4 result)
Returns a normalized version of the specified vector.
|
static Vector4 |
SmoothStep(Vector4 value1,
Vector4 value2,
float amount)
Interpolates between two values using a cubic equation.
|
static void |
SmoothStep(Vector4 value1,
Vector4 value2,
float amount,
Vector4 result)
Interpolates between two values using a cubic equation.
|
void |
Subtract(Vector4 other)
Subtracts a vector from the current vector.
|
static Vector4 |
Subtract(Vector4 value1,
Vector4 value2)
Subtracts a vector from a vector.
|
static void |
Subtract(Vector4 value1,
Vector4 value2,
Vector4 result)
Subtracts a vector from a vector.
|
java.lang.String |
toString()
Retrieves a string representation of the current object.
|
static Vector4 |
Transform(Vector2 position,
Matrix matrix)
Transforms a Vector2 by the given Matrix.
|
static void |
Transform(Vector2 position,
Matrix matrix,
Vector4 result)
Transforms a Vector2 by the given Matrix.
|
static Vector4 |
Transform(Vector2 value,
Quaternion rotation)
Transforms a Vector2 by a specified Quaternion into a Vector4.
|
static void |
Transform(Vector2 value,
Quaternion rotation,
Vector4 result)
Transforms a Vector2 by a specified Quaternion into a Vector4.
|
static Vector4 |
Transform(Vector3 position,
Matrix matrix)
Transforms a Vector3 by the given Matrix.
|
static void |
Transform(Vector3 position,
Matrix matrix,
Vector4 result)
Transforms a Vector3 by the given Matrix.
|
static Vector4 |
Transform(Vector3 value,
Quaternion rotation)
Transforms a Vector3 by a specified Quaternion into a Vector4.
|
static void |
Transform(Vector3 value,
Quaternion rotation,
Vector4 result)
Transforms a Vector3 by a specified Quaternion into a Vector4.
|
static void |
Transform(Vector4[] sourceArray,
int sourceIndex,
Matrix matrix,
Vector4[] destinationArray,
int destinationIndex,
int length)
Transforms a specified range in an array of Vector4s by a specified Matrix into a specified range in a destination array.
|
static void |
Transform(Vector4[] sourceArray,
int sourceIndex,
Quaternion rotation,
Vector4[] destinationArray,
int destinationIndex,
int length)
Transforms a specified range in an array of Vector4s by a specified Quaternion into a specified range in a destination array.
|
static void |
Transform(Vector4[] sourceArray,
Matrix matrix,
Vector4[] destinationArray)
Transforms an array of Vector4s by a specified Matrix.
|
static void |
Transform(Vector4[] sourceArray,
Quaternion rotation,
Vector4[] destinationArray)
Transforms an array of Vector4s by a specified Quaternion.
|
static Vector4 |
Transform(Vector4 vector,
Matrix matrix)
Transforms a Vector4 by the specified Matrix.
|
static void |
Transform(Vector4 vector,
Matrix matrix,
Vector4 result)
Transforms a Vector4 by the given Matrix.
|
static Vector4 |
Transform(Vector4 value,
Quaternion rotation)
Transforms a Vector4 by a specified Quaternion.
|
static void |
Transform(Vector4 value,
Quaternion rotation,
Vector4 result)
Transforms a Vector4 by a specified Quaternion.
|
public static final Vector4 One
public static final Vector4 UnitW
public static final Vector4 UnitX
public static final Vector4 UnitY
public static final Vector4 UnitZ
public float W
public float X
public float Y
public float Z
public static final Vector4 Zero
public Vector4(float value)
value
- Value to initialize each component to.public Vector4(Vector3 value, float w)
value
- A vector containing the values to initialize x, y, and z components with.w
- Initial value for the w-component of the vector.public Vector4(Vector2 value, float z, float w)
value
- A vector containing the values to initialize x and y components with.z
- Initial value for the z-component of the vector.w
- Initial value for the w-component of the vector.public Vector4(float x, float y, float z, float w)
x
- Initial value for the x-component of the vector.y
- Initial value for the y-component of the vector.z
- Initial value for the z-component of the vector.w
- Initial value for the w-component of the vector.public Vector4()
public void Add(Vector4 other)
other
- Source vector.public static Vector4 Add(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Source vector.public static void Add(Vector4 value1, Vector4 value2, Vector4 result)
value1
- Source vector.value2
- Source vector.result
- [OutAttribute] Sum of the source vectors.public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2)
value1
- A Vector4 containing the 4D Cartesian coordinates of vertex 1 of the triangle.value2
- A Vector4 containing the 4D Cartesian coordinates of vertex 2 of the triangle.value3
- A Vector4 containing the 4D Cartesian coordinates of vertex 4 of the triangle.amount1
- Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).amount2
- Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).public static void Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2, Vector4 result)
value1
- A Vector4 containing the 4D Cartesian coordinates of vertex 1 of the triangle.value2
- A Vector4 containing the 4D Cartesian coordinates of vertex 2 of the triangle.value3
- A Vector4 containing the 4D Cartesian coordinates of vertex 4 of the triangle.amount1
- Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).amount2
- Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).result
- [OutAttribute] The 4D Cartesian coordinates of the specified point are placed in this Vector4 on exit.public static Vector4 CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount)
value1
- The first position in the interpolation.value2
- The second position in the interpolation.value3
- The third position in the interpolation.value4
- The fourth position in the interpolation.amount
- Weighting factor.public static void CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount, Vector4 result)
value1
- The first position in the interpolation.value2
- The second position in the interpolation.value3
- The third position in the interpolation.value4
- The fourth position in the interpolation.amount
- Weighting factor.result
- [OutAttribute] A vector that is the result of the Catmull-Rom interpolation.public static Vector4 Clamp(Vector4 value1, Vector4 min, Vector4 max)
value1
- The value to clamp.min
- The minimum value.max
- The maximum value.public static void Clamp(Vector4 value1, Vector4 min, Vector4 max, Vector4 result)
value1
- The value to clamp.min
- The minimum value.max
- The maximum value.result
- [OutAttribute] The clamped value.public static float Distance(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Source vector.public static void Distance(Vector4 value1, Vector4 value2, float result)
value1
- Source vector.value2
- Source vector.result
- [OutAttribute] The distance between the vectors.public static float DistanceSquared(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Source vector.public static void DistanceSquared(Vector4 value1, Vector4 value2, float result)
value1
- Source vector.value2
- Source vector.result
- [OutAttribute] The distance between the two vectors squared.public void Divide(Vector4 other)
other
- Divisor vector.public static Vector4 Divide(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Divisor vector.public void Divide(float divider)
divider
- The divisor.public static Vector4 Divide(Vector4 value1, float divider)
value1
- Source vector.divider
- The divisor.public static void Divide(Vector4 value1, Vector4 value2, Vector4 result)
value1
- Source vector.value2
- Divisor vector.result
- [OutAttribute] The result of the division.public static void Divide(Vector4 value1, float divider, Vector4 result)
value1
- Source vector.divider
- The divisor.result
- [OutAttribute] The result of the division.public static float Dot(Vector4 vector1, Vector4 vector2)
vector1
- Source vector.vector2
- Source vector.public static void Dot(Vector4 vector1, Vector4 vector2, float result)
vector1
- Source vector.vector2
- Source vector.result
- [OutAttribute] The dot product of the two vectors.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object with which to make the comparison.public boolean Equals(Vector4 other)
Equals
in interface IEquatable<Vector4>
other
- The Vector4 to compare with the current Vector4.public int hashCode()
hashCode
in class java.lang.Object
public static Vector4 Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount)
value1
- Source position vector.tangent1
- Source tangent vector.value2
- Source position vector.tangent2
- Source tangent vector.amount
- Weighting factor.public static void Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount, Vector4 result)
value1
- Source position vector.tangent1
- Source tangent vector.value2
- Source position vector.tangent2
- Source tangent vector.amount
- Weighting factor.result
- [OutAttribute] The result of the Hermite spline interpolation.public float Length()
public float LengthSquared()
public static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
value1
- Source vector.value2
- Source vector.amount
- Value between 0 and 1 indicating the weight of value2.public static void Lerp(Vector4 value1, Vector4 value2, float amount, Vector4 result)
value1
- Source vector.value2
- Source vector.amount
- Value between 0 and 1 indicating the weight of value2.result
- [OutAttribute] The result of the interpolation.public static Vector4 Max(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Source vector.public static void Max(Vector4 value1, Vector4 value2, Vector4 result)
value1
- Source vector.value2
- Source vector.result
- [OutAttribute] The maximized vector.public static Vector4 Min(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Source vector.public static void Min(Vector4 value1, Vector4 value2, Vector4 result)
value1
- Source vector.value2
- Source vector.result
- [OutAttribute] The minimized vector.public void Multiply(Vector4 other)
other
- Source vector.public static Vector4 Multiply(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Source vector.public void Multiply(float scaleFactor)
scaleFactor
- Scalar value.public static Vector4 Multiply(Vector4 value1, float scaleFactor)
value1
- Source vector.scaleFactor
- Scalar value.public static void Multiply(Vector4 value1, Vector4 value2, Vector4 result)
value1
- Source vector.value2
- Source vector.result
- [OutAttribute] The result of the multiplication.public static void Multiply(Vector4 value1, float scaleFactor, Vector4 result)
value1
- Source vector.scaleFactor
- Scalar value.result
- [OutAttribute] The result of the multiplication.public void Negate()
public static Vector4 Negate(Vector4 value)
value
- Source vector.public static void Negate(Vector4 value, Vector4 result)
value
- Source vector.result
- [OutAttribute] Vector pointing in the opposite direction.public void Normalize()
public static Vector4 Normalize(Vector4 vector)
vector
- Source vector.public static void Normalize(Vector4 vector, Vector4 result)
vector
- Source vector.result
- [OutAttribute] The normalized vector.public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount)
value1
- Source value.value2
- Source value.amount
- Weighting value.public static void SmoothStep(Vector4 value1, Vector4 value2, float amount, Vector4 result)
value1
- Source value.value2
- Source value.amount
- Weighting value.result
- [OutAttribute] The interpolated value.public void Subtract(Vector4 other)
other
- public static Vector4 Subtract(Vector4 value1, Vector4 value2)
value1
- Source vector.value2
- Source vector.public static void Subtract(Vector4 value1, Vector4 value2, Vector4 result)
value1
- Source vector.value2
- Source vector.result
- [OutAttribute] The result of the subtraction.public java.lang.String toString()
toString
in class java.lang.Object
public static Vector4 Transform(Vector2 position, Matrix matrix)
position
- The source Vector2.matrix
- The transformation Matrix.public static Vector4 Transform(Vector2 value, Quaternion rotation)
value
- The Vector2 to transform.rotation
- The Quaternion rotation to apply.public static Vector4 Transform(Vector3 position, Matrix matrix)
position
- The source Vector3.matrix
- The transformation Matrix.public static Vector4 Transform(Vector3 value, Quaternion rotation)
value
- The Vector3 to transform.rotation
- The Quaternion rotation to apply.public static Vector4 Transform(Vector4 vector, Matrix matrix)
vector
- The source Vector4.matrix
- The transformation Matrix.public static Vector4 Transform(Vector4 value, Quaternion rotation)
value
- The Vector4 to transform.rotation
- The Quaternion rotation to apply.public static void Transform(Vector4[] sourceArray, Quaternion rotation, Vector4[] destinationArray)
sourceArray
- The array of Vector4s to transform.rotation
- The Quaternion rotation to apply.destinationArray
- The existing destination array into which the transformed Vector4s are written.public static void Transform(Vector2 position, Matrix matrix, Vector4 result)
position
- The source Vector2.matrix
- The transformation Matrix.result
- [OutAttribute] The Vector4 resulting from the transformation.public static void Transform(Vector2 value, Quaternion rotation, Vector4 result)
value
- The Vector2 to transform.rotation
- The Quaternion rotation to apply.result
- [OutAttribute] The Vector4 resulting from the transformation.public static void Transform(Vector4[] sourceArray, Matrix matrix, Vector4[] destinationArray)
sourceArray
- The array of Vector4s to transform.matrix
- The transform Matrix to apply.destinationArray
- The existing destination array into which the transformed Vector4s are written.public static void Transform(Vector3 position, Matrix matrix, Vector4 result)
position
- The source Vector3.matrix
- The transformation Matrix.result
- [OutAttribute] The Vector4 resulting from the transformation.public static void Transform(Vector3 value, Quaternion rotation, Vector4 result)
value
- The Vector3 to transform.rotation
- The Quaternion rotation to apply.result
- [OutAttribute] The Vector4 resulting from the transformation.public static void Transform(Vector4 vector, Matrix matrix, Vector4 result)
vector
- The source Vector4.matrix
- The transformation Matrix.result
- [OutAttribute] The Vector4 resulting from the transformation.public static void Transform(Vector4 value, Quaternion rotation, Vector4 result)
value
- The Vector4 to transform.rotation
- The Quaternion rotation to apply.result
- [OutAttribute] The Vector4 resulting from the transformation.public static void Transform(Vector4[] sourceArray, int sourceIndex, Matrix matrix, Vector4[] destinationArray, int destinationIndex, int length)
sourceArray
- The array of Vector4s containing the range to transform.sourceIndex
- The index in the source array of the first Vector4 to transform.matrix
- The transform Matrix to apply.destinationArray
- The existing destination array of Vector4s into which to write the results.destinationIndex
- The index in the destination array of the first result Vector4 to write.length
- The number of Vector4s to transform.public static void Transform(Vector4[] sourceArray, int sourceIndex, Quaternion rotation, Vector4[] destinationArray, int destinationIndex, int length)
sourceArray
- The array of Vector4s containing the range to transform.sourceIndex
- The index in the source array of the first Vector4 to transform.rotation
- The Quaternion rotation to apply.destinationArray
- The existing destination array of Vector4s into which to write the results.destinationIndex
- The index in the destination array of the first result Vector4 to write.length
- The number of Vector4s to transform.