Vector2 Structure

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

Namespace:  System.Numerics
Assembly:  System.Numerics.Vectors (in System.Numerics.Vectors.dll)

public value class Vector2 : IEquatable<Vector2>, 
	IFormattable

The Vector2 type exposes the following members.

  NameDescription
Public methodVector2(Single)Creates a new Vector2 object whose two elements have the same value.
Public methodVector2(Single, Single)Creates a vector whose elements have the specified values.
Top

  NameDescription
Public propertyStatic memberOneGets a vector whose 2 elements are equal to one.
Public propertyStatic memberUnitXGets the vector (1,0).
Public propertyStatic memberUnitYGets the vector (0,1).
Public propertyStatic memberZeroReturns a vector whose 2 elements are equal to zero.
Top

  NameDescription
Public methodStatic memberAbsReturns a vector whose elements are the absolute values of each of the specified vector's elements.
Public methodStatic memberAddAdds two vectors together.
Public methodStatic memberClampRestricts a vector between a minimum and a maximum value.
Public methodCopyTo(array<Single>)Copies the elements of the vector to a specified array.
Public methodCopyTo(array<Single>, Int32)Copies the elements of the vector to a specified array starting at a specified index position.
Public methodStatic memberDistanceComputes the Euclidean distance between the two given points.
Public methodStatic memberDistanceSquaredReturns the Euclidean distance squared between two specified points.
Public methodStatic memberDivide(Vector2, Vector2)Divides the first vector by the second.
Public methodStatic memberDivide(Vector2, Single)Divides the specified vector by a specified scalar value.
Public methodStatic memberDotReturns the dot product of two vectors.
Public methodEquals(Object)Returns a value that indicates whether this instance and a specified object are equal. (Overrides ValueType::Equals(Object).)
Public methodEquals(Vector2)Returns a value that indicates whether this instance and another vector are equal.
Public methodGetHashCodeReturns the hash code for this instance. (Overrides ValueType::GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodLengthReturns the length of the vector.
Public methodLengthSquaredReturns the length of the vector squared.
Public methodStatic memberLerpPerforms a linear interpolation between two vectors based on the given weighting.
Public methodStatic memberMaxReturns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.
Public methodStatic memberMinReturns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.
Public methodStatic memberMultiply(Single, Vector2)Multiplies a scalar value by a specified vector.
Public methodStatic memberMultiply(Vector2, Vector2)Multiplies two vectors together.
Public methodStatic memberMultiply(Vector2, Single)Multiplies a vector by a specified scalar.
Public methodStatic memberNegateNegates a specified vector.
Public methodStatic memberNormalizeReturns a vector with the same direction as the specified vector, but with a length of one.
Public methodStatic memberReflectReturns the reflection of a vector off a surface that has the specified normal.
Public methodStatic memberSquareRootReturns a vector whose elements are the square root of each of a specified vector's elements.
Public methodStatic memberSubtractSubtracts the second vector from the first.
Public methodToString()Returns the string representation of the current instance using default formatting. (Overrides ValueType::ToString().)
Public methodToString(String)Returns the string representation of the current instance using the specified format string to format individual elements.
Public methodToString(String, IFormatProvider)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.
Public methodStatic memberTransform(Vector2, Matrix3x2)Transforms a vector by a specified 3x2 matrix.
Public methodStatic memberTransform(Vector2, Matrix4x4)Transforms a vector by a specified 4x4 matrix.
Public methodStatic memberTransform(Vector2, Quaternion)Transforms a vector by the specified Quaternion rotation value.
Public methodStatic memberTransformNormal(Vector2, Matrix3x2)Transforms a vector normal by the given 3x2 matrix.
Public methodStatic memberTransformNormal(Vector2, Matrix4x4)Transforms a vector normal by the given 4x4 matrix.
Top

  NameDescription
Public operatorStatic memberAdditionAdds two vectors together.
Public operatorStatic memberDivision(Vector2, Vector2)Divides the first vector by the second.
Public operatorStatic memberDivision(Vector2, Single)Divides the specified vector by a specified scalar value.
Public operatorStatic memberEqualityReturns a value that indicates whether each pair of elements in two specified vectors is equal.
Public operatorStatic memberInequalityReturns a value that indicates whether two specified vectors are not equal.
Public operatorStatic memberMultiply(Single, Vector2)Multiples the scalar value by the specified vector.
Public operatorStatic memberMultiply(Vector2, Vector2)Multiplies two vectors together.
Public operatorStatic memberMultiply(Vector2, Single)Multiples the specified vector by the specified scalar value.
Public operatorStatic memberSubtractionSubtracts the second vector from the first.
Public operatorStatic memberUnaryNegationNegates the specified vector.
Top

  NameDescription
Public fieldXThe X component of the vector.
Public fieldYThe Y component of the vector.
Top

The Vector2 structure provides support for hardware acceleration.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: