Table of Contents

Struct Vector2

Namespace
Microsoft.Xna.Framework
Assembly
MonoGame.Framework.dll

Describes a 2D-vector.

[TypeConverter(typeof(Vector2TypeConverter))]
[DataContract]
public struct Vector2 : IEquatable<Vector2>
Implements
Inherited Members

Constructors

Vector2(float)

Constructs a 2d vector with X and Y set to the same value.

public Vector2(float value)

Parameters

value float

The x and y coordinates in 2d-space.

Vector2(float, float)

Constructs a 2d vector with X and Y from two values.

public Vector2(float x, float y)

Parameters

x float

The x coordinate in 2d-space.

y float

The y coordinate in 2d-space.

Fields

X

The x coordinate of this Vector2.

[DataMember]
public float X

Field Value

float

Y

The y coordinate of this Vector2.

[DataMember]
public float Y

Field Value

float

Properties

One

Returns a Vector2 with components 1, 1.

public static Vector2 One { get; }

Property Value

Vector2

UnitX

Returns a Vector2 with components 1, 0.

public static Vector2 UnitX { get; }

Property Value

Vector2

UnitY

Returns a Vector2 with components 0, 1.

public static Vector2 UnitY { get; }

Property Value

Vector2

Zero

Returns a Vector2 with components 0, 0.

public static Vector2 Zero { get; }

Property Value

Vector2

Methods

Add(Vector2, Vector2)

Performs vector addition on value1 and value2.

public static Vector2 Add(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

The first vector to add.

value2 Vector2

The second vector to add.

Returns

Vector2

The result of the vector addition.

Add(ref Vector2, ref Vector2, out Vector2)

Performs vector addition on value1 and value2, storing the result of the addition in result.

public static void Add(ref Vector2 value1, ref Vector2 value2, out Vector2 result)

Parameters

value1 Vector2

The first vector to add.

value2 Vector2

The second vector to add.

result Vector2

The result of the vector addition.

Barycentric(Vector2, Vector2, Vector2, float, float)

Creates a new Vector2 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 2d-triangle.

public static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)

Parameters

value1 Vector2

The first vector of 2d-triangle.

value2 Vector2

The second vector of 2d-triangle.

value3 Vector2

The third vector of 2d-triangle.

amount1 float

Barycentric scalar b2 which represents a weighting factor towards second vector of 2d-triangle.

amount2 float

Barycentric scalar b3 which represents a weighting factor towards third vector of 2d-triangle.

Returns

Vector2

The cartesian translation of barycentric coordinates.

Barycentric(ref Vector2, ref Vector2, ref Vector2, float, float, out Vector2)

Creates a new Vector2 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 2d-triangle.

public static void Barycentric(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, float amount1, float amount2, out Vector2 result)

Parameters

value1 Vector2

The first vector of 2d-triangle.

value2 Vector2

The second vector of 2d-triangle.

value3 Vector2

The third vector of 2d-triangle.

amount1 float

Barycentric scalar b2 which represents a weighting factor towards second vector of 2d-triangle.

amount2 float

Barycentric scalar b3 which represents a weighting factor towards third vector of 2d-triangle.

result Vector2

The cartesian translation of barycentric coordinates as an output parameter.

CatmullRom(Vector2, Vector2, Vector2, Vector2, float)

Creates a new Vector2 that contains CatmullRom interpolation of the specified vectors.

public static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)

Parameters

value1 Vector2

The first vector in interpolation.

value2 Vector2

The second vector in interpolation.

value3 Vector2

The third vector in interpolation.

value4 Vector2

The fourth vector in interpolation.

amount float

Weighting factor.

Returns

Vector2

The result of CatmullRom interpolation.

CatmullRom(ref Vector2, ref Vector2, ref Vector2, ref Vector2, float, out Vector2)

Creates a new Vector2 that contains CatmullRom interpolation of the specified vectors.

public static void CatmullRom(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, ref Vector2 value4, float amount, out Vector2 result)

Parameters

value1 Vector2

The first vector in interpolation.

value2 Vector2

The second vector in interpolation.

value3 Vector2

The third vector in interpolation.

value4 Vector2

The fourth vector in interpolation.

amount float

Weighting factor.

result Vector2

The result of CatmullRom interpolation as an output parameter.

Ceiling()

Round the members of this Vector2 towards positive infinity.

public void Ceiling()

Ceiling(Vector2)

Creates a new Vector2 that contains members from another vector rounded towards positive infinity.

public static Vector2 Ceiling(Vector2 value)

Parameters

value Vector2

Source Vector2.

Returns

Vector2

The rounded Vector2.

Ceiling(ref Vector2, out Vector2)

Creates a new Vector2 that contains members from another vector rounded towards positive infinity.

public static void Ceiling(ref Vector2 value, out Vector2 result)

Parameters

value Vector2

Source Vector2.

result Vector2

The rounded Vector2.

Clamp(Vector2, Vector2, Vector2)

Clamps the specified value within a range.

public static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)

Parameters

value1 Vector2

The value to clamp.

min Vector2

The min value.

max Vector2

The max value.

Returns

Vector2

The clamped value.

Clamp(ref Vector2, ref Vector2, ref Vector2, out Vector2)

Clamps the specified value within a range.

public static void Clamp(ref Vector2 value1, ref Vector2 min, ref Vector2 max, out Vector2 result)

Parameters

value1 Vector2

The value to clamp.

min Vector2

The min value.

max Vector2

The max value.

result Vector2

The clamped value as an output parameter.

Deconstruct(out float, out float)

Deconstruction method for Vector2.

public void Deconstruct(out float x, out float y)

Parameters

x float
y float

Distance(Vector2, Vector2)

Returns the distance between two vectors.

public static float Distance(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

Returns

float

The distance between two vectors.

Distance(ref Vector2, ref Vector2, out float)

Returns the distance between two vectors.

public static void Distance(ref Vector2 value1, ref Vector2 value2, out float result)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

result float

The distance between two vectors as an output parameter.

DistanceSquared(Vector2, Vector2)

Returns the squared distance between two vectors.

public static float DistanceSquared(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

Returns

float

The squared distance between two vectors.

DistanceSquared(ref Vector2, ref Vector2, out float)

Returns the squared distance between two vectors.

public static void DistanceSquared(ref Vector2 value1, ref Vector2 value2, out float result)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

result float

The squared distance between two vectors as an output parameter.

Divide(Vector2, Vector2)

Divides the components of a Vector2 by the components of another Vector2.

public static Vector2 Divide(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Divisor Vector2.

Returns

Vector2

The result of dividing the vectors.

Divide(Vector2, float)

Divides the components of a Vector2 by a scalar.

public static Vector2 Divide(Vector2 value1, float divider)

Parameters

value1 Vector2

Source Vector2.

divider float

Divisor scalar.

Returns

Vector2

The result of dividing a vector by a scalar.

Divide(ref Vector2, ref Vector2, out Vector2)

Divides the components of a Vector2 by the components of another Vector2.

public static void Divide(ref Vector2 value1, ref Vector2 value2, out Vector2 result)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Divisor Vector2.

result Vector2

The result of dividing the vectors as an output parameter.

Divide(ref Vector2, float, out Vector2)

Divides the components of a Vector2 by a scalar.

public static void Divide(ref Vector2 value1, float divider, out Vector2 result)

Parameters

value1 Vector2

Source Vector2.

divider float

Divisor scalar.

result Vector2

The result of dividing a vector by a scalar as an output parameter.

Dot(Vector2, Vector2)

Returns a dot product of two vectors.

public static float Dot(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

Returns

float

The dot product of two vectors.

Dot(ref Vector2, ref Vector2, out float)

Returns a dot product of two vectors.

public static void Dot(ref Vector2 value1, ref Vector2 value2, out float result)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

result float

The dot product of two vectors as an output parameter.

Equals(Vector2)

Compares whether current instance is equal to specified Vector2.

public bool Equals(Vector2 other)

Parameters

other Vector2

The Vector2 to compare.

Returns

bool

true if the instances are equal; false otherwise.

Equals(object)

Compares whether current instance is equal to specified object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare.

Returns

bool

true if the instances are equal; false otherwise.

Floor()

Round the members of this Vector2 towards negative infinity.

public void Floor()

Floor(Vector2)

Creates a new Vector2 that contains members from another vector rounded towards negative infinity.

public static Vector2 Floor(Vector2 value)

Parameters

value Vector2

Source Vector2.

Returns

Vector2

The rounded Vector2.

Floor(ref Vector2, out Vector2)

Creates a new Vector2 that contains members from another vector rounded towards negative infinity.

public static void Floor(ref Vector2 value, out Vector2 result)

Parameters

value Vector2

Source Vector2.

result Vector2

The rounded Vector2.

GetHashCode()

Gets the hash code of this Vector2.

public override int GetHashCode()

Returns

int

Hash code of this Vector2.

Hermite(Vector2, Vector2, Vector2, Vector2, float)

Creates a new Vector2 that contains hermite spline interpolation.

public static Vector2 Hermite(Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount)

Parameters

value1 Vector2

The first position vector.

tangent1 Vector2

The first tangent vector.

value2 Vector2

The second position vector.

tangent2 Vector2

The second tangent vector.

amount float

Weighting factor.

Returns

Vector2

The hermite spline interpolation vector.

Hermite(ref Vector2, ref Vector2, ref Vector2, ref Vector2, float, out Vector2)

Creates a new Vector2 that contains hermite spline interpolation.

public static void Hermite(ref Vector2 value1, ref Vector2 tangent1, ref Vector2 value2, ref Vector2 tangent2, float amount, out Vector2 result)

Parameters

value1 Vector2

The first position vector.

tangent1 Vector2

The first tangent vector.

value2 Vector2

The second position vector.

tangent2 Vector2

The second tangent vector.

amount float

Weighting factor.

result Vector2

The hermite spline interpolation vector as an output parameter.

Length()

Returns the length of this Vector2.

public float Length()

Returns

float

The length of this Vector2.

LengthSquared()

Returns the squared length of this Vector2.

public float LengthSquared()

Returns

float

The squared length of this Vector2.

Lerp(Vector2, Vector2, float)

Creates a new Vector2 that contains linear interpolation of the specified vectors.

public static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

Returns

Vector2

The result of linear interpolation of the specified vectors.

Lerp(ref Vector2, ref Vector2, float, out Vector2)

Creates a new Vector2 that contains linear interpolation of the specified vectors.

public static void Lerp(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

result Vector2

The result of linear interpolation of the specified vectors as an output parameter.

LerpPrecise(Vector2, Vector2, float)

Creates a new Vector2 that contains linear interpolation of the specified vectors. Uses LerpPrecise(float, float, float) on MathHelper for the interpolation. Less efficient but more precise compared to Lerp(Vector2, Vector2, float). See remarks section of LerpPrecise(float, float, float) on MathHelper for more info.

public static Vector2 LerpPrecise(Vector2 value1, Vector2 value2, float amount)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

Returns

Vector2

The result of linear interpolation of the specified vectors.

LerpPrecise(ref Vector2, ref Vector2, float, out Vector2)

Creates a new Vector2 that contains linear interpolation of the specified vectors. Uses LerpPrecise(float, float, float) on MathHelper for the interpolation. Less efficient but more precise compared to Lerp(ref Vector2, ref Vector2, float, out Vector2). See remarks section of LerpPrecise(float, float, float) on MathHelper for more info.

public static void LerpPrecise(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

result Vector2

The result of linear interpolation of the specified vectors as an output parameter.

Max(Vector2, Vector2)

Creates a new Vector2 that contains a maximal values from the two vectors.

public static Vector2 Max(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

Returns

Vector2

The Vector2 with maximal values from the two vectors.

Max(ref Vector2, ref Vector2, out Vector2)

Creates a new Vector2 that contains a maximal values from the two vectors.

public static void Max(ref Vector2 value1, ref Vector2 value2, out Vector2 result)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

result Vector2

The Vector2 with maximal values from the two vectors as an output parameter.

Min(Vector2, Vector2)

Creates a new Vector2 that contains a minimal values from the two vectors.

public static Vector2 Min(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

Returns

Vector2

The Vector2 with minimal values from the two vectors.

Min(ref Vector2, ref Vector2, out Vector2)

Creates a new Vector2 that contains a minimal values from the two vectors.

public static void Min(ref Vector2 value1, ref Vector2 value2, out Vector2 result)

Parameters

value1 Vector2

The first vector.

value2 Vector2

The second vector.

result Vector2

The Vector2 with minimal values from the two vectors as an output parameter.

Multiply(Vector2, Vector2)

Creates a new Vector2 that contains a multiplication of two vectors.

public static Vector2 Multiply(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Source Vector2.

Returns

Vector2

The result of the vector multiplication.

Multiply(Vector2, float)

Creates a new Vector2 that contains a multiplication of Vector2 and a scalar.

public static Vector2 Multiply(Vector2 value1, float scaleFactor)

Parameters

value1 Vector2

Source Vector2.

scaleFactor float

Scalar value.

Returns

Vector2

The result of the vector multiplication with a scalar.

Multiply(ref Vector2, ref Vector2, out Vector2)

Creates a new Vector2 that contains a multiplication of two vectors.

public static void Multiply(ref Vector2 value1, ref Vector2 value2, out Vector2 result)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Source Vector2.

result Vector2

The result of the vector multiplication as an output parameter.

Multiply(ref Vector2, float, out Vector2)

Creates a new Vector2 that contains a multiplication of Vector2 and a scalar.

public static void Multiply(ref Vector2 value1, float scaleFactor, out Vector2 result)

Parameters

value1 Vector2

Source Vector2.

scaleFactor float

Scalar value.

result Vector2

The result of the multiplication with a scalar as an output parameter.

Negate(Vector2)

Creates a new Vector2 that contains the specified vector inversion.

public static Vector2 Negate(Vector2 value)

Parameters

value Vector2

Source Vector2.

Returns

Vector2

The result of the vector inversion.

Negate(ref Vector2, out Vector2)

Creates a new Vector2 that contains the specified vector inversion.

public static void Negate(ref Vector2 value, out Vector2 result)

Parameters

value Vector2

Source Vector2.

result Vector2

The result of the vector inversion as an output parameter.

Normalize()

Turns this Vector2 to a unit vector with the same direction.

public void Normalize()

Normalize(Vector2)

Creates a new Vector2 that contains a normalized values from another vector.

public static Vector2 Normalize(Vector2 value)

Parameters

value Vector2

Source Vector2.

Returns

Vector2

Unit vector.

Normalize(ref Vector2, out Vector2)

Creates a new Vector2 that contains a normalized values from another vector.

public static void Normalize(ref Vector2 value, out Vector2 result)

Parameters

value Vector2

Source Vector2.

result Vector2

Unit vector as an output parameter.

Reflect(Vector2, Vector2)

Creates a new Vector2 that contains reflect vector of the given vector and normal.

public static Vector2 Reflect(Vector2 vector, Vector2 normal)

Parameters

vector Vector2

Source Vector2.

normal Vector2

Reflection normal.

Returns

Vector2

Reflected vector.

Reflect(ref Vector2, ref Vector2, out Vector2)

Creates a new Vector2 that contains reflect vector of the given vector and normal.

public static void Reflect(ref Vector2 vector, ref Vector2 normal, out Vector2 result)

Parameters

vector Vector2

Source Vector2.

normal Vector2

Reflection normal.

result Vector2

Reflected vector as an output parameter.

Rotate(Vector2, float)

Rotates a vector by the specified number of radians

public static Vector2 Rotate(Vector2 value, float radians)

Parameters

value Vector2

The vector to be rotated.

radians float

The amount to rotate the vector.

Returns

Vector2

A rotated copy of value.

Remarks

A positive angle and negative angle would rotate counterclockwise and clockwise, respectively

Rotate(float)

Rotates a Vector2 by the specified number of radians

public void Rotate(float radians)

Parameters

radians float

The amount to rotate this Vector2.

Remarks

A positive angle and negative angle would rotate counterclockwise and clockwise, respectively

RotateAround(Vector2, Vector2, float)

Rotates a Vector2 around another Vector2 representing a location

public static Vector2 RotateAround(Vector2 value, Vector2 origin, float radians)

Parameters

value Vector2

The Vector2 to be rotated

origin Vector2

The origin location to be rotated around

radians float

The amount to rotate by in radians

Returns

Vector2

The rotated Vector2

Remarks

A positive angle and negative angle would rotate counterclockwise and clockwise, respectively

RotateAround(Vector2, float)

Rotates a Vector2 around another Vector2 representing a location

public void RotateAround(Vector2 origin, float radians)

Parameters

origin Vector2

The origin location to be rotated around

radians float

The amount to rotate by in radians

Remarks

A positive angle and negative angle would rotate counterclockwise and clockwise, respectively

Round()

Round the members of this Vector2 to the nearest integer value.

public void Round()

Round(Vector2)

Creates a new Vector2 that contains members from another vector rounded to the nearest integer value.

public static Vector2 Round(Vector2 value)

Parameters

value Vector2

Source Vector2.

Returns

Vector2

The rounded Vector2.

Round(ref Vector2, out Vector2)

Creates a new Vector2 that contains members from another vector rounded to the nearest integer value.

public static void Round(ref Vector2 value, out Vector2 result)

Parameters

value Vector2

Source Vector2.

result Vector2

The rounded Vector2.

SmoothStep(Vector2, Vector2, float)

Creates a new Vector2 that contains cubic interpolation of the specified vectors.

public static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Source Vector2.

amount float

Weighting value.

Returns

Vector2

Cubic interpolation of the specified vectors.

SmoothStep(ref Vector2, ref Vector2, float, out Vector2)

Creates a new Vector2 that contains cubic interpolation of the specified vectors.

public static void SmoothStep(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Source Vector2.

amount float

Weighting value.

result Vector2

Cubic interpolation of the specified vectors as an output parameter.

Subtract(Vector2, Vector2)

Creates a new Vector2 that contains subtraction of on Vector2 from a another.

public static Vector2 Subtract(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Source Vector2.

Returns

Vector2

The result of the vector subtraction.

Subtract(ref Vector2, ref Vector2, out Vector2)

Creates a new Vector2 that contains subtraction of on Vector2 from a another.

public static void Subtract(ref Vector2 value1, ref Vector2 value2, out Vector2 result)

Parameters

value1 Vector2

Source Vector2.

value2 Vector2

Source Vector2.

result Vector2

The result of the vector subtraction as an output parameter.

ToNumerics()

Returns a Vector2.

public Vector2 ToNumerics()

Returns

Vector2

ToPoint()

Gets a Point representation for this object.

public Point ToPoint()

Returns

Point

A Point representation for this object.

ToString()

Returns a string representation of this Vector2 in the format: {X:[X] Y:[Y]}

public override string ToString()

Returns

string

A string representation of this Vector2.

Transform(Vector2, Matrix)

Creates a new Vector2 that contains a transformation of 2d-vector by the specified Matrix.

public static Vector2 Transform(Vector2 position, Matrix matrix)

Parameters

position Vector2

Source Vector2.

matrix Matrix

The transformation Matrix.

Returns

Vector2

Transformed Vector2.

Transform(Vector2, Quaternion)

Creates a new Vector2 that contains a transformation of 2d-vector by the specified Quaternion, representing the rotation.

public static Vector2 Transform(Vector2 value, Quaternion rotation)

Parameters

value Vector2

Source Vector2.

rotation Quaternion

The Quaternion which contains rotation transformation.

Returns

Vector2

Transformed Vector2.

Transform(ref Vector2, ref Matrix, out Vector2)

Creates a new Vector2 that contains a transformation of 2d-vector by the specified Matrix.

public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector2 result)

Parameters

position Vector2

Source Vector2.

matrix Matrix

The transformation Matrix.

result Vector2

Transformed Vector2 as an output parameter.

Transform(ref Vector2, ref Quaternion, out Vector2)

Creates a new Vector2 that contains a transformation of 2d-vector by the specified Quaternion, representing the rotation.

public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector2 result)

Parameters

value Vector2

Source Vector2.

rotation Quaternion

The Quaternion which contains rotation transformation.

result Vector2

Transformed Vector2 as an output parameter.

Transform(Vector2[], ref Matrix, Vector2[])

Apply transformation on all vectors within array of Vector2 by the specified Matrix and places the results in an another array.

public static void Transform(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)

Parameters

sourceArray Vector2[]

Source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector2[]

Destination array.

Transform(Vector2[], ref Quaternion, Vector2[])

Apply transformation on all vectors within array of Vector2 by the specified Quaternion and places the results in an another array.

public static void Transform(Vector2[] sourceArray, ref Quaternion rotation, Vector2[] destinationArray)

Parameters

sourceArray Vector2[]

Source array.

rotation Quaternion

The Quaternion which contains rotation transformation.

destinationArray Vector2[]

Destination array.

Transform(Vector2[], int, ref Matrix, Vector2[], int, int)

Apply transformation on vectors within array of Vector2 by the specified Matrix and places the results in an another array.

public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)

Parameters

sourceArray Vector2[]

Source array.

sourceIndex int

The starting index of transformation in the source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector2[]

Destination array.

destinationIndex int

The starting index in the destination array, where the first Vector2 should be written.

length int

The number of vectors to be transformed.

Transform(Vector2[], int, ref Quaternion, Vector2[], int, int)

Apply transformation on vectors within array of Vector2 by the specified Quaternion and places the results in an another array.

public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector2[] destinationArray, int destinationIndex, int length)

Parameters

sourceArray Vector2[]

Source array.

sourceIndex int

The starting index of transformation in the source array.

rotation Quaternion

The Quaternion which contains rotation transformation.

destinationArray Vector2[]

Destination array.

destinationIndex int

The starting index in the destination array, where the first Vector2 should be written.

length int

The number of vectors to be transformed.

TransformNormal(Vector2, Matrix)

Creates a new Vector2 that contains a transformation of the specified normal by the specified Matrix.

public static Vector2 TransformNormal(Vector2 normal, Matrix matrix)

Parameters

normal Vector2

Source Vector2 which represents a normal vector.

matrix Matrix

The transformation Matrix.

Returns

Vector2

Transformed normal.

TransformNormal(ref Vector2, ref Matrix, out Vector2)

Creates a new Vector2 that contains a transformation of the specified normal by the specified Matrix.

public static void TransformNormal(ref Vector2 normal, ref Matrix matrix, out Vector2 result)

Parameters

normal Vector2

Source Vector2 which represents a normal vector.

matrix Matrix

The transformation Matrix.

result Vector2

Transformed normal as an output parameter.

TransformNormal(Vector2[], ref Matrix, Vector2[])

Apply transformation on all normals within array of Vector2 by the specified Matrix and places the results in an another array.

public static void TransformNormal(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)

Parameters

sourceArray Vector2[]

Source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector2[]

Destination array.

TransformNormal(Vector2[], int, ref Matrix, Vector2[], int, int)

Apply transformation on normals within array of Vector2 by the specified Matrix and places the results in an another array.

public static void TransformNormal(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)

Parameters

sourceArray Vector2[]

Source array.

sourceIndex int

The starting index of transformation in the source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector2[]

Destination array.

destinationIndex int

The starting index in the destination array, where the first Vector2 should be written.

length int

The number of normals to be transformed.

Operators

operator +(Vector2, Vector2)

Adds two vectors.

public static Vector2 operator +(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Source Vector2 on the left of the add sign.

value2 Vector2

Source Vector2 on the right of the add sign.

Returns

Vector2

Sum of the vectors.

operator /(Vector2, Vector2)

Divides the components of a Vector2 by the components of another Vector2.

public static Vector2 operator /(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Source Vector2 on the left of the div sign.

value2 Vector2

Divisor Vector2 on the right of the div sign.

Returns

Vector2

The result of dividing the vectors.

operator /(Vector2, float)

Divides the components of a Vector2 by a scalar.

public static Vector2 operator /(Vector2 value1, float divider)

Parameters

value1 Vector2

Source Vector2 on the left of the div sign.

divider float

Divisor scalar on the right of the div sign.

Returns

Vector2

The result of dividing a vector by a scalar.

operator ==(Vector2, Vector2)

Compares whether two Vector2 instances are equal.

public static bool operator ==(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Vector2 instance on the left of the equal sign.

value2 Vector2

Vector2 instance on the right of the equal sign.

Returns

bool

true if the instances are equal; false otherwise.

implicit operator Vector2(Vector2)

Converts a Vector2 to a Vector2.

public static implicit operator Vector2(Vector2 value)

Parameters

value Vector2

The converted value.

Returns

Vector2

operator !=(Vector2, Vector2)

Compares whether two Vector2 instances are not equal.

public static bool operator !=(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Vector2 instance on the left of the not equal sign.

value2 Vector2

Vector2 instance on the right of the not equal sign.

Returns

bool

true if the instances are not equal; false otherwise.

operator *(Vector2, Vector2)

Multiplies the components of two vectors by each other.

public static Vector2 operator *(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Source Vector2 on the left of the mul sign.

value2 Vector2

Source Vector2 on the right of the mul sign.

Returns

Vector2

Result of the vector multiplication.

operator *(Vector2, float)

Multiplies the components of vector by a scalar.

public static Vector2 operator *(Vector2 value, float scaleFactor)

Parameters

value Vector2

Source Vector2 on the left of the mul sign.

scaleFactor float

Scalar value on the right of the mul sign.

Returns

Vector2

Result of the vector multiplication with a scalar.

operator *(float, Vector2)

Multiplies the components of vector by a scalar.

public static Vector2 operator *(float scaleFactor, Vector2 value)

Parameters

scaleFactor float

Scalar value on the left of the mul sign.

value Vector2

Source Vector2 on the right of the mul sign.

Returns

Vector2

Result of the vector multiplication with a scalar.

operator -(Vector2, Vector2)

Subtracts a Vector2 from a Vector2.

public static Vector2 operator -(Vector2 value1, Vector2 value2)

Parameters

value1 Vector2

Source Vector2 on the left of the sub sign.

value2 Vector2

Source Vector2 on the right of the sub sign.

Returns

Vector2

Result of the vector subtraction.

operator -(Vector2)

Inverts values in the specified Vector2.

public static Vector2 operator -(Vector2 value)

Parameters

value Vector2

Source Vector2 on the right of the sub sign.

Returns

Vector2

Result of the inversion.