Struct Vector2
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
valuefloatThe 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
Fields
X
The x coordinate of this Vector2.
[DataMember]
public float X
Field Value
Y
The y coordinate of this Vector2.
[DataMember]
public float Y
Field Value
Properties
One
Returns a Vector2 with components 1, 1.
public static Vector2 One { get; }
Property Value
UnitX
Returns a Vector2 with components 1, 0.
public static Vector2 UnitX { get; }
Property Value
UnitY
Returns a Vector2 with components 0, 1.
public static Vector2 UnitY { get; }
Property Value
Zero
Returns a Vector2 with components 0, 0.
public static Vector2 Zero { get; }
Property Value
Methods
Add(Vector2, Vector2)
Performs vector addition on value1 and value2.
public static Vector2 Add(Vector2 value1, Vector2 value2)
Parameters
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
value1Vector2The first vector to add.
value2Vector2The second vector to add.
resultVector2The 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
value1Vector2The first vector of 2d-triangle.
value2Vector2The second vector of 2d-triangle.
value3Vector2The third vector of 2d-triangle.
amount1floatBarycentric scalar
b2which represents a weighting factor towards second vector of 2d-triangle.amount2floatBarycentric scalar
b3which 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
value1Vector2The first vector of 2d-triangle.
value2Vector2The second vector of 2d-triangle.
value3Vector2The third vector of 2d-triangle.
amount1floatBarycentric scalar
b2which represents a weighting factor towards second vector of 2d-triangle.amount2floatBarycentric scalar
b3which represents a weighting factor towards third vector of 2d-triangle.resultVector2The 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
value1Vector2The first vector in interpolation.
value2Vector2The second vector in interpolation.
value3Vector2The third vector in interpolation.
value4Vector2The fourth vector in interpolation.
amountfloatWeighting 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
value1Vector2The first vector in interpolation.
value2Vector2The second vector in interpolation.
value3Vector2The third vector in interpolation.
value4Vector2The fourth vector in interpolation.
amountfloatWeighting factor.
resultVector2The 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
Returns
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
Clamp(Vector2, Vector2, Vector2)
Clamps the specified value within a range.
public static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)
Parameters
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
value1Vector2The value to clamp.
minVector2The min value.
maxVector2The max value.
resultVector2The 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
Distance(Vector2, Vector2)
Returns the distance between two vectors.
public static float Distance(Vector2 value1, Vector2 value2)
Parameters
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
value1Vector2The first vector.
value2Vector2The second vector.
resultfloatThe 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
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
value1Vector2The first vector.
value2Vector2The second vector.
resultfloatThe squared distance between two vectors as an output parameter.
Divide(Vector2, Vector2)
public static Vector2 Divide(Vector2 value1, Vector2 value2)
Parameters
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
Returns
- Vector2
The result of dividing a vector by a scalar.
Divide(ref Vector2, ref Vector2, out Vector2)
public static void Divide(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
value1Vector2Source Vector2.
value2Vector2Divisor Vector2.
resultVector2The 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
value1Vector2Source Vector2.
dividerfloatDivisor scalar.
resultVector2The 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
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
value1Vector2The first vector.
value2Vector2The second vector.
resultfloatThe 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
Returns
- bool
trueif the instances are equal;falseotherwise.
Equals(object)
Compares whether current instance is equal to specified object.
public override bool Equals(object obj)
Parameters
Returns
- bool
trueif the instances are equal;falseotherwise.
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
Returns
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
GetHashCode()
Gets the hash code of this Vector2.
public override int GetHashCode()
Returns
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
value1Vector2The first position vector.
tangent1Vector2The first tangent vector.
value2Vector2The second position vector.
tangent2Vector2The second tangent vector.
amountfloatWeighting 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
value1Vector2The first position vector.
tangent1Vector2The first tangent vector.
value2Vector2The second position vector.
tangent2Vector2The second tangent vector.
amountfloatWeighting factor.
resultVector2The hermite spline interpolation vector as an output parameter.
Length()
Returns the length of this Vector2.
public float Length()
Returns
LengthSquared()
Returns the squared length of this Vector2.
public float LengthSquared()
Returns
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
value1Vector2The first vector.
value2Vector2The second vector.
amountfloatWeighting 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
value1Vector2The first vector.
value2Vector2The second vector.
amountfloatWeighting value(between 0.0 and 1.0).
resultVector2The 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
value1Vector2The first vector.
value2Vector2The second vector.
amountfloatWeighting 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
value1Vector2The first vector.
value2Vector2The second vector.
amountfloatWeighting value(between 0.0 and 1.0).
resultVector2The 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
Returns
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
value1Vector2The first vector.
value2Vector2The second vector.
resultVector2The 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
Returns
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
value1Vector2The first vector.
value2Vector2The second vector.
resultVector2The 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
Returns
- Vector2
The result of the vector multiplication.
Multiply(Vector2, float)
public static Vector2 Multiply(Vector2 value1, float scaleFactor)
Parameters
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
value1Vector2Source Vector2.
value2Vector2Source Vector2.
resultVector2The result of the vector multiplication as an output parameter.
Multiply(ref Vector2, float, out Vector2)
public static void Multiply(ref Vector2 value1, float scaleFactor, out Vector2 result)
Parameters
value1Vector2Source Vector2.
scaleFactorfloatScalar value.
resultVector2The 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
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
valueVector2Source Vector2.
resultVector2The 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
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
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
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
vectorVector2Source Vector2.
normalVector2Reflection normal.
resultVector2Reflected 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
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
Remarks
A positive angle and negative angle would rotate counterclockwise and clockwise, respectively
RotateAround(Vector2, Vector2, float)
public static Vector2 RotateAround(Vector2 value, Vector2 origin, float radians)
Parameters
valueVector2The Vector2 to be rotated
originVector2The origin location to be rotated around
radiansfloatThe amount to rotate by in radians
Returns
Remarks
A positive angle and negative angle would rotate counterclockwise and clockwise, respectively
RotateAround(Vector2, float)
public void RotateAround(Vector2 origin, float radians)
Parameters
originVector2The origin location to be rotated around
radiansfloatThe 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
Returns
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
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
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
value1Vector2Source Vector2.
value2Vector2Source Vector2.
amountfloatWeighting value.
resultVector2Cubic interpolation of the specified vectors as an output parameter.
Subtract(Vector2, Vector2)
public static Vector2 Subtract(Vector2 value1, Vector2 value2)
Parameters
Returns
- Vector2
The result of the vector subtraction.
Subtract(ref Vector2, ref Vector2, out Vector2)
public static void Subtract(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
Parameters
value1Vector2Source Vector2.
value2Vector2Source Vector2.
resultVector2The result of the vector subtraction as an output parameter.
ToNumerics()
Returns a Vector2.
public Vector2 ToNumerics()
Returns
ToPoint()
Gets a Point representation for this object.
public Point ToPoint()
Returns
ToString()
public override string ToString()
Returns
Transform(Vector2, Matrix)
public static Vector2 Transform(Vector2 position, Matrix matrix)
Parameters
Returns
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
valueVector2Source Vector2.
rotationQuaternionThe Quaternion which contains rotation transformation.
Returns
Transform(ref Vector2, ref Matrix, out Vector2)
public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector2 result)
Parameters
positionVector2Source Vector2.
matrixMatrixThe transformation Matrix.
resultVector2Transformed 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
valueVector2Source Vector2.
rotationQuaternionThe Quaternion which contains rotation transformation.
resultVector2Transformed 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
sourceArrayVector2[]Source array.
matrixMatrixThe transformation Matrix.
destinationArrayVector2[]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
sourceArrayVector2[]Source array.
rotationQuaternionThe Quaternion which contains rotation transformation.
destinationArrayVector2[]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
sourceArrayVector2[]Source array.
sourceIndexintThe starting index of transformation in the source array.
matrixMatrixThe transformation Matrix.
destinationArrayVector2[]Destination array.
destinationIndexintThe starting index in the destination array, where the first Vector2 should be written.
lengthintThe 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
sourceArrayVector2[]Source array.
sourceIndexintThe starting index of transformation in the source array.
rotationQuaternionThe Quaternion which contains rotation transformation.
destinationArrayVector2[]Destination array.
destinationIndexintThe starting index in the destination array, where the first Vector2 should be written.
lengthintThe 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
normalVector2Source Vector2 which represents a normal vector.
matrixMatrixThe 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
normalVector2Source Vector2 which represents a normal vector.
matrixMatrixThe transformation Matrix.
resultVector2Transformed 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
sourceArrayVector2[]Source array.
matrixMatrixThe transformation Matrix.
destinationArrayVector2[]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
sourceArrayVector2[]Source array.
sourceIndexintThe starting index of transformation in the source array.
matrixMatrixThe transformation Matrix.
destinationArrayVector2[]Destination array.
destinationIndexintThe starting index in the destination array, where the first Vector2 should be written.
lengthintThe number of normals to be transformed.
Operators
operator +(Vector2, Vector2)
Adds two vectors.
public static Vector2 operator +(Vector2 value1, Vector2 value2)
Parameters
value1Vector2Source Vector2 on the left of the add sign.
value2Vector2Source Vector2 on the right of the add sign.
Returns
- Vector2
Sum of the vectors.
operator /(Vector2, Vector2)
public static Vector2 operator /(Vector2 value1, Vector2 value2)
Parameters
value1Vector2Source Vector2 on the left of the div sign.
value2Vector2Divisor 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
value1Vector2Source Vector2 on the left of the div sign.
dividerfloatDivisor 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
value1Vector2Vector2 instance on the left of the equal sign.
value2Vector2Vector2 instance on the right of the equal sign.
Returns
- bool
trueif the instances are equal;falseotherwise.
implicit operator Vector2(Vector2)
public static implicit operator Vector2(Vector2 value)
Parameters
valueVector2The converted value.
Returns
operator !=(Vector2, Vector2)
Compares whether two Vector2 instances are not equal.
public static bool operator !=(Vector2 value1, Vector2 value2)
Parameters
value1Vector2Vector2 instance on the left of the not equal sign.
value2Vector2Vector2 instance on the right of the not equal sign.
Returns
- bool
trueif the instances are not equal;falseotherwise.
operator *(Vector2, Vector2)
Multiplies the components of two vectors by each other.
public static Vector2 operator *(Vector2 value1, Vector2 value2)
Parameters
value1Vector2Source Vector2 on the left of the mul sign.
value2Vector2Source 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
valueVector2Source Vector2 on the left of the mul sign.
scaleFactorfloatScalar 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
scaleFactorfloatScalar value on the left of the mul sign.
valueVector2Source Vector2 on the right of the mul sign.
Returns
- Vector2
Result of the vector multiplication with a scalar.
operator -(Vector2, Vector2)
public static Vector2 operator -(Vector2 value1, Vector2 value2)
Parameters
value1Vector2Source Vector2 on the left of the sub sign.
value2Vector2Source 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
Returns
- Vector2
Result of the inversion.