struct Vector2

in global :: System . Numerics

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


public Vector2( float value )

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

  • value The value to assign to both elements.

public Vector2( float x, float y )

Creates a vector whose elements have the specified values.

  • x The value to assign to the field.
  • y The value to assign to the field.

public static Vector2 Abs( Vector2 value )

Returns a vector whose elements are the absolute values of each of the specified vector's elements.

  • value A vector.
  • Returns The absolute value vector.

public static Vector2 Add( Vector2 left, Vector2 right )

Adds two vectors together.

  • left The first vector to add.
  • right The second vector to add.
  • Returns The summed vector.

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

Restricts a vector between a minimum and a maximum value.

  • value1 The vector to restrict.
  • min The minimum value.
  • max The maximum value.
  • Returns The restricted vector.

public void CopyTo( float[] array )

Copies the elements of the vector to a specified array.

  • array The destination array.

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

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

  • array The destination array.
  • index The index at which to copy the first element of the vector.

public static float Distance( Vector2 value1, Vector2 value2 )

Computes the Euclidean distance between the two given points.

  • value1 The first point.
  • value2 The second point.
  • Returns The distance.

public static float DistanceSquared( Vector2 value1, Vector2 value2 )

Returns the Euclidean distance squared between two specified points.

  • value1 The first point.
  • value2 The second point.
  • Returns The distance squared.

public static Vector2 Divide( Vector2 left, Vector2 right )

Divides the first vector by the second.

  • left The first vector.
  • right The second vector.
  • Returns The vector resulting from the division.

public static Vector2 Divide( Vector2 left, float divisor )

Divides the specified vector by a specified scalar value.

  • left The vector.
  • divisor The scalar value.
  • Returns The vector that results from the division.

public static float Dot( Vector2 value1, Vector2 value2 )

Returns the dot product of two vectors.

  • value1 The first vector.
  • value2 The second vector.
  • Returns The dot product.

public bool Equals( Vector2 other )

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

  • other The other vector.
  • Returns if the two vectors are equal; otherwise, .

public bool Equals( object obj )

Returns a value that indicates whether this instance and a specified object are equal.

  • obj The object to compare with the current instance.
  • Returns if the current instance and are equal; otherwise, . If is , the method returns .

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

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

  • value1 The first vector.
  • value2 The second vector.
  • amount A value between 0 and 1 that indicates the weight of .
  • Returns The interpolated vector.

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.

  • value1 The first vector.
  • value2 The second vector.
  • Returns The maximized vector.

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.

  • value1 The first vector.
  • value2 The second vector.
  • Returns The minimized vector.

public static Vector2 Multiply( Vector2 left, Vector2 right )

Returns a new vector whose values are the product of each pair of elements in two specified vectors.

  • left The first vector.
  • right The second vector.
  • Returns The element-wise product vector.

public static Vector2 Multiply( Vector2 left, float right )

Multiplies a vector by a specified scalar.

  • left The vector to multiply.
  • right The scalar value.
  • Returns The scaled vector.

public static Vector2 Multiply( float left, Vector2 right )

Multiplies a scalar value by a specified vector.

  • left The scaled value.
  • right The vector.
  • Returns The scaled vector.

public static Vector2 Negate( Vector2 value )

Negates a specified vector.

  • value The vector to negate.
  • Returns The negated vector.

public static Vector2 Normalize( Vector2 value )

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

  • value The vector to normalize.
  • Returns The normalized vector.

public static Vector2 One { get; }

Gets a vector whose 2 elements are equal to one.

  • Returns A vector whose two elements are equal to one (that is, it returns the vector (1,1).

public static Vector2 op_Addition( Vector2 left, Vector2 right )

Adds two vectors together.

  • left The first vector to add.
  • right The second vector to add.
  • Returns The summed vector.

public static Vector2 op_Division( Vector2 left, Vector2 right )

Divides the first vector by the second.

  • left The first vector.
  • right The second vector.
  • Returns The vector that results from dividing by .

public static Vector2 op_Division( Vector2 value1, float value2 )

Divides the specified vector by a specified scalar value.

  • value1 The vector.
  • value2 The scalar value.
  • Returns The result of the division.

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.

  • left The first vector to compare.
  • right The second vector to compare.
  • Returns if and are equal; otherwise, .

public static bool op_Inequality( Vector2 left, Vector2 right )

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

  • left The first vector to compare.
  • right The second vector to compare.
  • Returns if and are not equal; otherwise, .

public static Vector2 op_Multiply( Vector2 left, Vector2 right )

Returns a new vector whose values are the product of each pair of elements in two specified vectors.

  • left The first vector.
  • right The second vector.
  • Returns The element-wise product vector.

public static Vector2 op_Multiply( Vector2 left, float right )

Multiples the specified vector by the specified scalar value.

  • left The vector.
  • right The scalar value.
  • Returns The scaled vector.

public static Vector2 op_Multiply( float left, Vector2 right )

Multiples the scalar value by the specified vector.

  • left The vector.
  • right The scalar value.
  • Returns The scaled vector.

public static Vector2 op_Subtraction( Vector2 left, Vector2 right )

Subtracts the second vector from the first.

  • left The first vector.
  • right The second vector.
  • Returns The vector that results from subtracting from .

public static Vector2 op_UnaryNegation( Vector2 value )

Negates the specified vector.

  • value The vector to negate.
  • Returns The negated vector.

public static Vector2 Reflect( Vector2 vector, Vector2 normal )

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

  • vector The source vector.
  • normal The normal of the surface being reflected off.
  • Returns The reflected vector.

public static Vector2 SquareRoot( Vector2 value )

Returns a vector whose elements are the square root of each of a specified vector's elements.

  • value A vector.
  • Returns The square root vector.

public static Vector2 Subtract( Vector2 left, Vector2 right )

Subtracts the second vector from the first.

  • left The first vector.
  • right The second vector.
  • Returns The difference vector.

public string ToString( string format )

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

  • format A standard or custom numeric format string that defines the format of individual elements.
  • Returns The string representation of the current instance.

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.

  • format A standard or custom numeric format string that defines the format of individual elements.
  • formatProvider A format provider that supplies culture-specific formatting information.
  • Returns The string representation of the current instance.

public static Vector2 Transform( Vector2 position, Matrix3x2 matrix )

Transforms a vector by a specified 3x2 matrix.

  • position The vector to transform.
  • matrix The transformation matrix.
  • Returns The transformed vector.

public static Vector2 Transform( Vector2 position, Matrix4x4 matrix )

Transforms a vector by a specified 4x4 matrix.

  • position The vector to transform.
  • matrix The transformation matrix.
  • Returns The transformed vector.

public static Vector2 Transform( Vector2 value, Quaternion rotation )

Transforms a vector by the specified Quaternion rotation value.

  • value The vector to rotate.
  • rotation The rotation to apply.
  • Returns The transformed vector.

public static Vector2 TransformNormal( Vector2 normal, Matrix3x2 matrix )

Transforms a vector normal by the given 3x2 matrix.

  • normal The source vector.
  • matrix The matrix.
  • Returns The transformed vector.

public static Vector2 TransformNormal( Vector2 normal, Matrix4x4 matrix )

Transforms a vector normal by the given 4x4 matrix.

  • normal The source vector.
  • matrix The matrix.
  • Returns The transformed vector.

public static Vector2 UnitX { get; }

Gets the vector (1,0).

  • Returns The vector (1,0).

public static Vector2 UnitY { get; }

Gets the vector (0,1).

  • Returns The vector (0,1).

public float X

The X component of the vector.

public float Y

The Y component of the vector.

public static Vector2 Zero { get; }

Returns a vector whose 2 elements are equal to zero.

  • Returns A vector whose two elements are equal to zero (that is, it returns the vector (0,0).

public void CopyTo( Span<float> destination )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public float Length( )

😔 No documentation found.

public float LengthSquared( )

😔 No documentation found.

public static ValueTuple<Vector2,Vector2> SinCos( Vector2 vector )

😔 No documentation found.

public static Vector2 Sin( Vector2 vector )

😔 No documentation found.

public static Vector2 Round( Vector2 vector, MidpointRounding mode )

😔 No documentation found.

public static Vector2 Round( Vector2 vector )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public Vector2( ReadOnlySpan<float> values )

😔 No documentation found.

public static Vector2 Truncate( Vector2 vector )

😔 No documentation found.

public bool TryCopyTo( Span<float> destination )

😔 No documentation found.

public static Vector2 MaxMagnitude( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 E { get; }

😔 No documentation found.

public static Vector2 Epsilon { get; }

😔 No documentation found.

public static Vector2 NaN { get; }

😔 No documentation found.

public static Vector2 NegativeInfinity { get; }

😔 No documentation found.

public static Vector2 NegativeZero { get; }

😔 No documentation found.

public static Vector2 Pi { get; }

😔 No documentation found.

public static Vector2 PositiveInfinity { get; }

😔 No documentation found.

public static Vector2 Tau { get; }

😔 No documentation found.

public float Item { get; set; }

😔 No documentation found.

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

😔 No documentation found.

public static Vector2 CopySign( Vector2 value, Vector2 sign )

😔 No documentation found.

public static Vector2 Cos( Vector2 vector )

😔 No documentation found.

public static Vector2 Create( float value )

😔 No documentation found.

public static Vector2 Create( float x, float y )

😔 No documentation found.

public static Vector2 RadiansToDegrees( Vector2 radians )

😔 No documentation found.

public static Vector2 Create( ReadOnlySpan<float> values )

😔 No documentation found.

public static Vector2 Exp( Vector2 vector )

😔 No documentation found.

public static Vector2 FusedMultiplyAdd( Vector2 left, Vector2 right, Vector2 addend )

😔 No documentation found.

public static Vector2 Hypot( Vector2 x, Vector2 y )

😔 No documentation found.

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

😔 No documentation found.

public static Vector2 Log( Vector2 vector )

😔 No documentation found.

public static Vector2 Log2( Vector2 vector )

😔 No documentation found.

public static Vector2 MaxMagnitudeNumber( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 MaxNative( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 MaxNumber( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 MinMagnitude( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 MinMagnitudeNumber( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 MinNative( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 MinNumber( Vector2 value1, Vector2 value2 )

😔 No documentation found.

public static Vector2 DegreesToRadians( Vector2 degrees )

😔 No documentation found.

public static Vector2 MultiplyAddEstimate( Vector2 left, Vector2 right, Vector2 addend )

😔 No documentation found.