Class Vector2
Defines a vector with two components.
Inheritance
Namespace: VRageMath
Assembly: VRage.Math.dll
Syntax
public sealed class Vector2 : ValueType, IEquatable<Vector2>
Constructors
Vector2(Single)
Creates a new instance of Vector2.
Declaration
public Vector2(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | Value to initialize both components to. |
Vector2(Single, Single)
Initializes a new instance of Vector2.
Declaration
public Vector2(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | Initial value for the x-component of the vector. |
System.Single | y | Initial value for the y-component of the vector. |
Fields
One
Declaration
public static Vector2 One
Field Value
Type | Description |
---|---|
Vector2 |
PositiveInfinity
Declaration
public static Vector2 PositiveInfinity
Field Value
Type | Description |
---|---|
Vector2 |
UnitX
Declaration
public static Vector2 UnitX
Field Value
Type | Description |
---|---|
Vector2 |
UnitY
Declaration
public static Vector2 UnitY
Field Value
Type | Description |
---|---|
Vector2 |
X
Gets or sets the x-component of the vector.
Declaration
public float X
Field Value
Type | Description |
---|---|
System.Single |
Y
Gets or sets the y-component of the vector.
Declaration
public float Y
Field Value
Type | Description |
---|---|
System.Single |
Zero
Declaration
public static Vector2 Zero
Field Value
Type | Description |
---|---|
Vector2 |
Properties
Item[Int32]
Declaration
public float this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
System.Single |
Methods
Add(Vector2, Vector2)
Adds two vectors.
Declaration
public static Vector2 Add(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Add(ref Vector2, ref Vector2, out Vector2)
Adds two vectors.
Declaration
public static void Add(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Vector2 | result | [OutAttribute] Sum of the source vectors. |
AssertIsValid()
Declaration
public void AssertIsValid()
Barycentric(Vector2, Vector2, Vector2, Single, Single)
Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.
Declaration
public static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | A Vector2 containing the 2D Cartesian coordinates of vertex 1 of the triangle. |
Vector2 | value2 | A Vector2 containing the 2D Cartesian coordinates of vertex 2 of the triangle. |
Vector2 | value3 | A Vector2 containing the 2D Cartesian coordinates of vertex 3 of the triangle. |
System.Single | amount1 | Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2). |
System.Single | amount2 | Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3). |
Returns
Type | Description |
---|---|
Vector2 |
Barycentric(ref Vector2, ref Vector2, ref Vector2, Single, Single, out Vector2)
Returns a Vector2 containing the 2D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 2D triangle.
Declaration
public static void Barycentric(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, float amount1, float amount2, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | A Vector2 containing the 2D Cartesian coordinates of vertex 1 of the triangle. |
Vector2 | value2 | A Vector2 containing the 2D Cartesian coordinates of vertex 2 of the triangle. |
Vector2 | value3 | A Vector2 containing the 2D Cartesian coordinates of vertex 3 of the triangle. |
System.Single | amount1 | Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2). |
System.Single | amount2 | Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3). |
Vector2 | result | [OutAttribute] The 2D Cartesian coordinates of the specified point are placed in this Vector2 on exit. |
Between(ref Vector2, ref Vector2)
Declaration
public bool Between(ref Vector2 start, ref Vector2 end)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | start | |
Vector2 | end |
Returns
Type | Description |
---|---|
System.Boolean |
CatmullRom(Vector2, Vector2, Vector2, Vector2, Single)
Performs a Catmull-Rom interpolation using the specified positions.
Declaration
public static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | The first position in the interpolation. |
Vector2 | value2 | The second position in the interpolation. |
Vector2 | value3 | The third position in the interpolation. |
Vector2 | value4 | The fourth position in the interpolation. |
System.Single | amount | Weighting factor. |
Returns
Type | Description |
---|---|
Vector2 |
CatmullRom(ref Vector2, ref Vector2, ref Vector2, ref Vector2, Single, out Vector2)
Performs a Catmull-Rom interpolation using the specified positions.
Declaration
public static void CatmullRom(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, ref Vector2 value4, float amount, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | The first position in the interpolation. |
Vector2 | value2 | The second position in the interpolation. |
Vector2 | value3 | The third position in the interpolation. |
Vector2 | value4 | The fourth position in the interpolation. |
System.Single | amount | Weighting factor. |
Vector2 | result | [OutAttribute] A vector that is the result of the Catmull-Rom interpolation. |
Clamp(Vector2, Vector2, Vector2)
Restricts a value to be within a specified range.
Declaration
public static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | The value to clamp. |
Vector2 | min | The minimum value. |
Vector2 | max | The maximum value. |
Returns
Type | Description |
---|---|
Vector2 |
Clamp(ref Vector2, ref Vector2, ref Vector2, out Vector2)
Restricts a value to be within a specified range.
Declaration
public static void Clamp(ref Vector2 value1, ref Vector2 min, ref Vector2 max, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | The value to clamp. |
Vector2 | min | The minimum value. |
Vector2 | max | The maximum value. |
Vector2 | result | [OutAttribute] The clamped value. |
ClampToSphere(Vector2, Single)
Declaration
public static Vector2 ClampToSphere(Vector2 vector, float radius)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | |
System.Single | radius |
Returns
Type | Description |
---|---|
Vector2 |
ClampToSphere(ref Vector2, Single)
Declaration
public static void ClampToSphere(ref Vector2 vector, float radius)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | |
System.Single | radius |
Distance(Vector2, Vector2)
Calculates the distance between two vectors.
Declaration
public static float Distance(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
System.Single |
Distance(ref Vector2, ref Vector2, out Single)
Calculates the distance between two vectors.
Declaration
public static void Distance(ref Vector2 value1, ref Vector2 value2, out float result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
System.Single | result | [OutAttribute] The distance between the vectors. |
DistanceSquared(Vector2, Vector2)
Calculates the distance between two vectors squared.
Declaration
public static float DistanceSquared(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
System.Single |
DistanceSquared(ref Vector2, ref Vector2, out Single)
Calculates the distance between two vectors squared.
Declaration
public static void DistanceSquared(ref Vector2 value1, ref Vector2 value2, out float result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
System.Single | result | [OutAttribute] The distance between the vectors squared. |
Divide(Vector2, Single)
Divides a vector by a scalar value.
Declaration
public static Vector2 Divide(Vector2 value1, float divider)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
System.Single | divider | The divisor. |
Returns
Type | Description |
---|---|
Vector2 |
Divide(Vector2, Vector2)
Divides the components of a vector by the components of another vector.
Declaration
public static Vector2 Divide(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Divisor vector. |
Returns
Type | Description |
---|---|
Vector2 |
Divide(ref Vector2, Single, out Vector2)
Divides a vector by a scalar value.
Declaration
public static void Divide(ref Vector2 value1, float divider, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
System.Single | divider | The divisor. |
Vector2 | result | [OutAttribute] The result of the division. |
Divide(ref Vector2, ref Vector2, out Vector2)
Divides the components of a vector by the components of another vector.
Declaration
public static void Divide(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | The divisor. |
Vector2 | result | [OutAttribute] The result of the division. |
Dot(Vector2, Vector2)
Calculates the dot product of two vectors. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.
Declaration
public static float Dot(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
System.Single |
Dot(ref Vector2, ref Vector2, out Single)
Calculates the dot product of two vectors and writes the result to a user-specified variable. If the two vectors are unit vectors, the dot product returns a floating point value between -1 and 1 that can be used to determine some properties of the angle between two vectors. For example, it can show whether the vectors are orthogonal, parallel, or have an acute or obtuse angle between them.
Declaration
public static void Dot(ref Vector2 value1, ref Vector2 value2, out float result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
System.Single | result | [OutAttribute] The dot product of the two vectors. |
Equals(Object)
Returns a value that indicates whether the current instance is equal to a specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to make the comparison with. |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Vector2)
Determines whether the specified Object is equal to the Vector2.
Declaration
public bool Equals(Vector2 other)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | other | The Object to compare with the current Vector2. |
Returns
Type | Description |
---|---|
System.Boolean |
Floor(Vector2)
Declaration
public static Vector2 Floor(Vector2 position)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | position |
Returns
Type | Description |
---|---|
Vector2 |
GetHashCode()
Gets the hash code of the vector object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Hermite(Vector2, Vector2, Vector2, Vector2, Single)
Performs a Hermite spline interpolation.
Declaration
public static Vector2 Hermite(Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source position vector. |
Vector2 | tangent1 | Source tangent vector. |
Vector2 | value2 | Source position vector. |
Vector2 | tangent2 | Source tangent vector. |
System.Single | amount | Weighting factor. |
Returns
Type | Description |
---|---|
Vector2 |
Hermite(ref Vector2, ref Vector2, ref Vector2, ref Vector2, Single, out Vector2)
Performs a Hermite spline interpolation.
Declaration
public static void Hermite(ref Vector2 value1, ref Vector2 tangent1, ref Vector2 value2, ref Vector2 tangent2, float amount, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source position vector. |
Vector2 | tangent1 | Source tangent vector. |
Vector2 | value2 | Source position vector. |
Vector2 | tangent2 | Source tangent vector. |
System.Single | amount | Weighting factor. |
Vector2 | result | [OutAttribute] The result of the Hermite spline interpolation. |
IsValid()
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
System.Boolean |
IsZero(Vector2, Single)
Declaration
public static bool IsZero(Vector2 value, float epsilon)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | |
System.Single | epsilon |
Returns
Type | Description |
---|---|
System.Boolean |
IsZero(ref Vector2)
Declaration
public static bool IsZero(ref Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value |
Returns
Type | Description |
---|---|
System.Boolean |
IsZero(ref Vector2, Single)
Declaration
public static bool IsZero(ref Vector2 value, float epsilon)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | |
System.Single | epsilon |
Returns
Type | Description |
---|---|
System.Boolean |
Length()
Calculates the length of the vector.
Declaration
public float Length()
Returns
Type | Description |
---|---|
System.Single |
LengthSquared()
Calculates the length of the vector squared.
Declaration
public float LengthSquared()
Returns
Type | Description |
---|---|
System.Single |
Lerp(Vector2, Vector2, Single)
Performs a linear interpolation between two vectors.
Declaration
public static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
System.Single | amount | Value between 0 and 1 indicating the weight of value2. |
Returns
Type | Description |
---|---|
Vector2 |
Lerp(ref Vector2, ref Vector2, Single, out Vector2)
Performs a linear interpolation between two vectors.
Declaration
public static void Lerp(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
System.Single | amount | Value between 0 and 1 indicating the weight of value2. |
Vector2 | result | [OutAttribute] The result of the interpolation. |
Max(Vector2, Vector2)
Returns a vector that contains the highest value from each matching pair of components.
Declaration
public static Vector2 Max(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Max(ref Vector2, ref Vector2, out Vector2)
Returns a vector that contains the highest value from each matching pair of components.
Declaration
public static void Max(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Vector2 | result | [OutAttribute] The maximized vector. |
Min(Vector2, Vector2)
Returns a vector that contains the lowest value from each matching pair of components.
Declaration
public static Vector2 Min(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Min(ref Vector2, ref Vector2, out Vector2)
Returns a vector that contains the lowest value from each matching pair of components.
Declaration
public static void Min(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Vector2 | result | [OutAttribute] The minimized vector. |
Multiply(Vector2, Single)
Multiplies a vector by a scalar value.
Declaration
public static Vector2 Multiply(Vector2 value1, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
System.Single | scaleFactor | Scalar value. |
Returns
Type | Description |
---|---|
Vector2 |
Multiply(Vector2, Vector2)
Multiplies the components of two vectors by each other.
Declaration
public static Vector2 Multiply(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Multiply(ref Vector2, Single, out Vector2)
Multiplies a vector by a scalar value.
Declaration
public static void Multiply(ref Vector2 value1, float scaleFactor, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
System.Single | scaleFactor | Scalar value. |
Vector2 | result | [OutAttribute] The result of the multiplication. |
Multiply(ref Vector2, ref Vector2, out Vector2)
Multiplies the components of two vectors by each other.
Declaration
public static void Multiply(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Vector2 | result | [OutAttribute] The result of the multiplication. |
Negate(Vector2)
Returns a vector pointing in the opposite direction.
Declaration
public static Vector2 Negate(Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Negate(ref Vector2, out Vector2)
Returns a vector pointing in the opposite direction.
Declaration
public static void Negate(ref Vector2 value, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | Source vector. |
Vector2 | result | [OutAttribute] Vector pointing in the opposite direction. |
Normalize()
Turns the current vector into a unit vector. The result is a vector one unit in length pointing in the same direction as the original vector.
Declaration
public void Normalize()
Normalize(Vector2)
Creates a unit vector from the specified vector. The result is a vector one unit in length pointing in the same direction as the original vector.
Declaration
public static Vector2 Normalize(Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | Source Vector2. |
Returns
Type | Description |
---|---|
Vector2 |
Normalize(ref Vector2, out Vector2)
Creates a unit vector from the specified vector, writing the result to a user-specified variable. The result is a vector one unit in length pointing in the same direction as the original vector.
Declaration
public static void Normalize(ref Vector2 value, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | Source vector. |
Vector2 | result | [OutAttribute] Normalized vector. |
Reflect(Vector2, Vector2)
Determines the reflect vector of the given vector and normal.
Declaration
public static Vector2 Reflect(Vector2 vector, Vector2 normal)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Source vector. |
Vector2 | normal | Normal of vector. |
Returns
Type | Description |
---|---|
Vector2 |
Reflect(ref Vector2, ref Vector2, out Vector2)
Determines the reflect vector of the given vector and normal.
Declaration
public static void Reflect(ref Vector2 vector, ref Vector2 normal, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector | Source vector. |
Vector2 | normal | Normal of vector. |
Vector2 | result | [OutAttribute] The created reflect vector. |
Rotate(Double)
Declaration
public void Rotate(double angle)
Parameters
Type | Name | Description |
---|---|---|
System.Double | angle |
SignNonZero(Vector2)
Declaration
public static Vector2 SignNonZero(Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value |
Returns
Type | Description |
---|---|
Vector2 |
SmoothStep(Vector2, Vector2, Single)
Interpolates between two values using a cubic equation.
Declaration
public static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source value. |
Vector2 | value2 | Source value. |
System.Single | amount | Weighting value. |
Returns
Type | Description |
---|---|
Vector2 |
SmoothStep(ref Vector2, ref Vector2, Single, out Vector2)
Interpolates between two values using a cubic equation.
Declaration
public static void SmoothStep(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source value. |
Vector2 | value2 | Source value. |
System.Single | amount | Weighting value. |
Vector2 | result | [OutAttribute] The interpolated value. |
Subtract(Vector2, Vector2)
Subtracts a vector from a vector.
Declaration
public static Vector2 Subtract(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Subtract(ref Vector2, ref Vector2, out Vector2)
Subtracts a vector from a vector.
Declaration
public static void Subtract(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Vector2 | result | [OutAttribute] The result of the subtraction. |
ToString()
Retrieves a string representation of the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Transform(Vector2, Matrix)
Transforms the vector (x, y, 0, 1) by the specified matrix.
Declaration
public static Vector2 Transform(Vector2 position, Matrix matrix)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | position | The source vector. |
Matrix | matrix | The transformation matrix. |
Returns
Type | Description |
---|---|
Vector2 |
Transform(Vector2, Quaternion)
Transforms a single Vector2, or the vector normal (x, y, 0, 0), by a specified Quaternion rotation.
Declaration
public static Vector2 Transform(Vector2 value, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | The vector to rotate. |
Quaternion | rotation | The Quaternion rotation to apply. |
Returns
Type | Description |
---|---|
Vector2 |
Transform(ref Vector2, ref Matrix, out Vector2)
Transforms a Vector2 by the given Matrix.
Declaration
public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | position | The source Vector2. |
Matrix | matrix | The transformation Matrix. |
Vector2 | result | [OutAttribute] The Vector2 resulting from the transformation. |
Transform(ref Vector2, ref Quaternion, out Vector2)
Transforms a Vector2, or the vector normal (x, y, 0, 0), by a specified Quaternion rotation.
Declaration
public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | The vector to rotate. |
Quaternion | rotation | The Quaternion rotation to apply. |
Vector2 | result | [OutAttribute] An existing Vector2 filled in with the result of the rotation. |
Transform(Vector2[], Int32, ref Matrix, Vector2[], Int32, Int32)
Transforms a specified range in an array of Vector2s by a specified Matrix and places the results in a specified range in a destination array.
Declaration
public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | sourceArray | The source array. |
System.Int32 | sourceIndex | The index of the first Vector2 to transform in the source array. |
Matrix | matrix | The Matrix to transform by. |
Vector2[] | destinationArray | The destination array into which the resulting Vector2s will be written. |
System.Int32 | destinationIndex | The index of the position in the destination array where the first result Vector2 should be written. |
System.Int32 | length | The number of Vector2s to be transformed. |
Transform(Vector2[], Int32, ref Quaternion, Vector2[], Int32, Int32)
Transforms a specified range in an array of Vector2s by a specified Quaternion and places the results in a specified range in a destination array.
Declaration
public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector2[] destinationArray, int destinationIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | sourceArray | The source array. |
System.Int32 | sourceIndex | The index of the first Vector2 to transform in the source array. |
Quaternion | rotation | The Quaternion rotation to apply. |
Vector2[] | destinationArray | The destination array into which the resulting Vector2s are written. |
System.Int32 | destinationIndex | The index of the position in the destination array where the first result Vector2 should be written. |
System.Int32 | length | The number of Vector2s to be transformed. |
Transform(Vector2[], ref Matrix, Vector2[])
Transforms an array of Vector2s by a specified Matrix.
Declaration
public static void Transform(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | sourceArray | The array of Vector2s to transform. |
Matrix | matrix | The transform Matrix to apply. |
Vector2[] | destinationArray | An existing array into which the transformed Vector2s are written. |
Transform(Vector2[], ref Quaternion, Vector2[])
Transforms an array of Vector2s by a specified Quaternion.
Declaration
public static void Transform(Vector2[] sourceArray, ref Quaternion rotation, Vector2[] destinationArray)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | sourceArray | The array of Vector2s to transform. |
Quaternion | rotation | The transform Matrix to use. |
Vector2[] | destinationArray | An existing array into which the transformed Vector2s are written. |
TransformNormal(Vector2, Matrix)
Transforms a 2D vector normal by a matrix.
Declaration
public static Vector2 TransformNormal(Vector2 normal, Matrix matrix)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | normal | The source vector. |
Matrix | matrix | The transformation matrix. |
Returns
Type | Description |
---|---|
Vector2 |
TransformNormal(ref Vector2, ref Matrix, out Vector2)
Transforms a vector normal by a matrix.
Declaration
public static void TransformNormal(ref Vector2 normal, ref Matrix matrix, out Vector2 result)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | normal | The source vector. |
Matrix | matrix | The transformation matrix. |
Vector2 | result | [OutAttribute] The Vector2 resulting from the transformation. |
TransformNormal(Vector2[], Int32, ref Matrix, Vector2[], Int32, Int32)
Transforms a specified range in an array of Vector2 vector normals by a specified Matrix and places the results in a specified range in a destination array.
Declaration
public static void TransformNormal(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | sourceArray | The source array. |
System.Int32 | sourceIndex | The index of the first Vector2 to transform in the source array. |
Matrix | matrix | The Matrix to apply. |
Vector2[] | destinationArray | The destination array into which the resulting Vector2s are written. |
System.Int32 | destinationIndex | The index of the position in the destination array where the first result Vector2 should be written. |
System.Int32 | length | The number of vector normals to be transformed. |
TransformNormal(Vector2[], ref Matrix, Vector2[])
Transforms an array of Vector2 vector normals by a specified Matrix.
Declaration
public static void TransformNormal(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)
Parameters
Type | Name | Description |
---|---|---|
Vector2[] | sourceArray | The array of vector normals to transform. |
Matrix | matrix | The transform Matrix to apply. |
Vector2[] | destinationArray | An existing array into which the transformed vector normals are written. |
Operators
Addition(Vector2, Single)
Adds float to each component of a vector.
Declaration
public static Vector2 operator +(Vector2 value1, float value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
System.Single | value2 | Source float. |
Returns
Type | Description |
---|---|
Vector2 |
Addition(Vector2, Vector2)
Adds two vectors.
Declaration
public static Vector2 operator +(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Division(Single, Vector2)
Divides a scalar value by a vector.
Declaration
public static Vector2 operator /(float value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value1 | |
Vector2 | value2 |
Returns
Type | Description |
---|---|
Vector2 |
Division(Vector2, Single)
Divides a vector by a scalar value.
Declaration
public static Vector2 operator /(Vector2 value1, float divider)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
System.Single | divider | The divisor. |
Returns
Type | Description |
---|---|
Vector2 |
Division(Vector2, Vector2)
Divides the components of a vector by the components of another vector.
Declaration
public static Vector2 operator /(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Divisor vector. |
Returns
Type | Description |
---|---|
Vector2 |
Equality(Vector2, Vector2)
Tests vectors for equality.
Declaration
public static bool operator ==(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
System.Boolean |
Explicit(Vector2 to Vector2I)
Declaration
public static explicit operator Vector2I(Vector2 vector)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | vector |
Returns
Type | Description |
---|---|
Vector2I |
Inequality(Vector2, Vector2)
Tests vectors for inequality.
Declaration
public static bool operator !=(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Vector to compare. |
Vector2 | value2 | Vector to compare. |
Returns
Type | Description |
---|---|
System.Boolean |
Multiply(Single, Vector2)
Multiplies a vector by a scalar value.
Declaration
public static Vector2 operator *(float scaleFactor, Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | scaleFactor | Scalar value. |
Vector2 | value | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Multiply(Vector2, Single)
Multiplies a vector by a scalar value.
Declaration
public static Vector2 operator *(Vector2 value, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | Source vector. |
System.Single | scaleFactor | Scalar value. |
Returns
Type | Description |
---|---|
Vector2 |
Multiply(Vector2, Vector2)
Multiplies the components of two vectors by each other.
Declaration
public static Vector2 operator *(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Subtraction(Vector2, Single)
Subtracts a vector from a vector.
Declaration
public static Vector2 operator -(Vector2 value1, float value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
System.Single | value2 | source vector. |
Returns
Type | Description |
---|---|
Vector2 |
Subtraction(Vector2, Vector2)
Subtracts a vector from a vector.
Declaration
public static Vector2 operator -(Vector2 value1, Vector2 value2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value1 | Source vector. |
Vector2 | value2 | source vector. |
Returns
Type | Description |
---|---|
Vector2 |
UnaryNegation(Vector2)
Returns a vector pointing in the opposite direction.
Declaration
public static Vector2 operator -(Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | Source vector. |
Returns
Type | Description |
---|---|
Vector2 |