<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />

System.Numerics.Vector2

Represents a vector with two single-precision floating-point values.
public float X

The X component of the vector.

public float Y

The Y component of the vector.

public static Vector2 One { get; }

Gets a vector whose 2 elements are equal to one.

public static Vector2 UnitX { get; }

Gets the vector (1,0).

public static Vector2 UnitY { get; }

Gets the vector (0,1).

public static Vector2 Zero { get; }

Returns a vector whose 2 elements are equal to zero.

public Vector2(float value)

Creates a new Vector2 object whose two elements have the same value.

public Vector2(float x, float y)

Creates a vector whose elements have the specified values.

public static Vector2 Abs(Vector2 value)

Returns a vector whose elements are the absolute values of each of the specified vector&#39;s elements.

public static Vector2 Add(Vector2 left, Vector2 right)

Adds two vectors together.

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

Restricts a vector between a minimum and a maximum value.

public static float Distance(Vector2 value1, Vector2 value2)

Computes the Euclidean distance between the two given points.

public static float DistanceSquared(Vector2 value1, Vector2 value2)

Returns the Euclidean distance squared between two specified points.

public static Vector2 Divide(Vector2 left, Vector2 right)

Divides the first vector by the second.

public static Vector2 Divide(Vector2 left, float divisor)

Divides the specified vector by a specified scalar value.

public static float Dot(Vector2 value1, Vector2 value2)

Returns the dot product of two vectors.

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

Performs a linear interpolation between two vectors based on the given weighting.

public static Vector2 Max(Vector2 value1, Vector2 value2)

Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.

public static Vector2 Min(Vector2 value1, Vector2 value2)

Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.

public static Vector2 Multiply(Vector2 left, Vector2 right)

Multiplies two vectors together.

public static Vector2 Multiply(Vector2 left, float right)

Multiplies a vector by a specified scalar.

public static Vector2 Multiply(float left, Vector2 right)

Multiplies a scalar value by a specified vector.

public static Vector2 Negate(Vector2 value)

Negates a specified vector.

public static Vector2 Normalize(Vector2 value)

Returns a vector with the same direction as the specified vector, but with a length of one.

public static Vector2 op_Addition(Vector2 left, Vector2 right)

Adds two vectors together.

public static Vector2 op_Division(Vector2 left, Vector2 right)

Divides the first vector by the second.

public static Vector2 op_Division(Vector2 value1, float value2)

Divides the specified vector by a specified scalar value.

public static bool op_Equality(Vector2 left, Vector2 right)

Returns a value that indicates whether each pair of elements in two specified vectors is equal.

public static bool op_Inequality(Vector2 left, Vector2 right)

Returns a value that indicates whether two specified vectors are not equal.

public static Vector2 op_Multiply(Vector2 left, Vector2 right)

Multiplies two vectors together.

public static Vector2 op_Multiply(float left, Vector2 right)

Multiples the scalar value by the specified vector.

public static Vector2 op_Multiply(Vector2 left, float right)

Multiples the specified vector by the specified scalar value.

public static Vector2 op_Subtraction(Vector2 left, Vector2 right)

Subtracts the second vector from the first.

public static Vector2 op_UnaryNegation(Vector2 value)

Negates the specified vector.

public static Vector2 Reflect(Vector2 vector, Vector2 normal)

Returns the reflection of a vector off a surface that has the specified normal.

public static Vector2 SquareRoot(Vector2 value)

Returns a vector whose elements are the square root of each of a specified vector&#39;s elements.

public static Vector2 Subtract(Vector2 left, Vector2 right)

Subtracts the second vector from the first.

public static Vector2 Transform(Vector2 position, Matrix3x2 matrix)

Transforms a vector by a specified 3x2 matrix.

public static Vector2 Transform(Vector2 position, Matrix4x4 matrix)

Transforms a vector by a specified 4x4 matrix.

public static Vector2 Transform(Vector2 value, Quaternion rotation)

Transforms a vector by the specified Quaternion rotation value.

public static Vector2 TransformNormal(Vector2 normal, Matrix3x2 matrix)

Transforms a vector normal by the given 3x2 matrix.

public static Vector2 TransformNormal(Vector2 normal, Matrix4x4 matrix)

Transforms a vector normal by the given 4x4 matrix.

public void CopyTo(float[] array)

Copies the elements of the vector to a specified array.

public void CopyTo(float[] array, int index)

Copies the elements of the vector to a specified array starting at a specified index position.

public bool Equals(Vector2 other)

Returns a value that indicates whether this instance and another vector are equal.

public float Length()

Returns the length of the vector.

public float LengthSquared()

Returns the length of the vector squared.

public string ToString(string format)

Returns the string representation of the current instance using the specified format string to format individual elements.

public string ToString(string format, IFormatProvider formatProvider)

Returns the string representation of the current instance using the specified format string to format individual elements and the specified format provider to define culture-specific formatting.