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