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
value
floatThe 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
value1
Vector2The first vector to add.
value2
Vector2The second vector to add.
result
Vector2The 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
Vector2The first vector of 2d-triangle.
value2
Vector2The second vector of 2d-triangle.
value3
Vector2The third vector of 2d-triangle.
amount1
floatBarycentric scalar
b2
which represents a weighting factor towards second vector of 2d-triangle.amount2
floatBarycentric 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
Vector2The first vector of 2d-triangle.
value2
Vector2The second vector of 2d-triangle.
value3
Vector2The third vector of 2d-triangle.
amount1
floatBarycentric scalar
b2
which represents a weighting factor towards second vector of 2d-triangle.amount2
floatBarycentric scalar
b3
which represents a weighting factor towards third vector of 2d-triangle.result
Vector2The 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
Vector2The first vector in interpolation.
value2
Vector2The second vector in interpolation.
value3
Vector2The third vector in interpolation.
value4
Vector2The fourth vector in interpolation.
amount
floatWeighting 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
Vector2The first vector in interpolation.
value2
Vector2The second vector in interpolation.
value3
Vector2The third vector in interpolation.
value4
Vector2The fourth vector in interpolation.
amount
floatWeighting factor.
result
Vector2The 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
value1
Vector2The value to clamp.
min
Vector2The min value.
max
Vector2The max value.
result
Vector2The 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
value1
Vector2The first vector.
value2
Vector2The second vector.
result
floatThe 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
value1
Vector2The first vector.
value2
Vector2The second vector.
result
floatThe 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
value1
Vector2Source Vector2.
value2
Vector2Divisor Vector2.
result
Vector2The 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
Vector2Source Vector2.
divider
floatDivisor scalar.
result
Vector2The 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
value1
Vector2The first vector.
value2
Vector2The second vector.
result
floatThe 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
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
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
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
value1
Vector2The first position vector.
tangent1
Vector2The first tangent vector.
value2
Vector2The second position vector.
tangent2
Vector2The second tangent vector.
amount
floatWeighting 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
Vector2The first position vector.
tangent1
Vector2The first tangent vector.
value2
Vector2The second position vector.
tangent2
Vector2The second tangent vector.
amount
floatWeighting factor.
result
Vector2The 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
value1
Vector2The first vector.
value2
Vector2The second vector.
amount
floatWeighting 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
Vector2The first vector.
value2
Vector2The second vector.
amount
floatWeighting value(between 0.0 and 1.0).
result
Vector2The 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
Vector2The first vector.
value2
Vector2The second vector.
amount
floatWeighting 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
Vector2The first vector.
value2
Vector2The second vector.
amount
floatWeighting value(between 0.0 and 1.0).
result
Vector2The 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
value1
Vector2The first vector.
value2
Vector2The second vector.
result
Vector2The 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
value1
Vector2The first vector.
value2
Vector2The second vector.
result
Vector2The 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
value1
Vector2Source Vector2.
value2
Vector2Source Vector2.
result
Vector2The 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
value1
Vector2Source Vector2.
scaleFactor
floatScalar value.
result
Vector2The 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
value
Vector2Source Vector2.
result
Vector2The 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
vector
Vector2Source Vector2.
normal
Vector2Reflection normal.
result
Vector2Reflected 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
value
Vector2The Vector2 to be rotated
origin
Vector2The origin location to be rotated around
radians
floatThe 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
origin
Vector2The origin location to be rotated around
radians
floatThe 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
value1
Vector2Source Vector2.
value2
Vector2Source Vector2.
amount
floatWeighting value.
result
Vector2Cubic 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
value1
Vector2Source Vector2.
value2
Vector2Source Vector2.
result
Vector2The 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
value
Vector2Source Vector2.
rotation
QuaternionThe 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
position
Vector2Source Vector2.
matrix
MatrixThe transformation Matrix.
result
Vector2Transformed 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
Vector2Source Vector2.
rotation
QuaternionThe Quaternion which contains rotation transformation.
result
Vector2Transformed 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
MatrixThe 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
QuaternionThe 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
intThe starting index of transformation in the source array.
matrix
MatrixThe transformation Matrix.
destinationArray
Vector2[]Destination array.
destinationIndex
intThe starting index in the destination array, where the first Vector2 should be written.
length
intThe 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
intThe starting index of transformation in the source array.
rotation
QuaternionThe Quaternion which contains rotation transformation.
destinationArray
Vector2[]Destination array.
destinationIndex
intThe starting index in the destination array, where the first Vector2 should be written.
length
intThe 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
Vector2Source Vector2 which represents a normal vector.
matrix
MatrixThe 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
Vector2Source Vector2 which represents a normal vector.
matrix
MatrixThe transformation Matrix.
result
Vector2Transformed 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
MatrixThe 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
intThe starting index of transformation in the source array.
matrix
MatrixThe transformation Matrix.
destinationArray
Vector2[]Destination array.
destinationIndex
intThe starting index in the destination array, where the first Vector2 should be written.
length
intThe number of normals to be transformed.
Operators
operator +(Vector2, Vector2)
Adds two vectors.
public static Vector2 operator +(Vector2 value1, Vector2 value2)
Parameters
value1
Vector2Source Vector2 on the left of the add sign.
value2
Vector2Source 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
value1
Vector2Source Vector2 on the left of the div sign.
value2
Vector2Divisor 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
Vector2Source Vector2 on the left of the div sign.
divider
floatDivisor 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
Vector2Vector2 instance on the left of the equal sign.
value2
Vector2Vector2 instance on the right of the equal sign.
Returns
- bool
true
if the instances are equal;false
otherwise.
implicit operator Vector2(Vector2)
public static implicit operator Vector2(Vector2 value)
Parameters
value
Vector2The converted value.
Returns
operator !=(Vector2, Vector2)
Compares whether two Vector2 instances are not equal.
public static bool operator !=(Vector2 value1, Vector2 value2)
Parameters
value1
Vector2Vector2 instance on the left of the not equal sign.
value2
Vector2Vector2 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
Vector2Source Vector2 on the left of the mul sign.
value2
Vector2Source 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
Vector2Source Vector2 on the left of the mul sign.
scaleFactor
floatScalar 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
floatScalar value on the left of the mul sign.
value
Vector2Source 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
value1
Vector2Source Vector2 on the left of the sub sign.
value2
Vector2Source 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.