Vector2D Struct
struct Vector2D : IEquatable<Vector2D>, IFormattable
A structure encapsulating two double precision floating point values.
Constructors
Vector2D(dValue) | Constructs a vector whose elements are all the single specified value. |
Vector2D(value) | Constructs a Vector3D from the given Vector3D by remove the last component. |
Vector2D(value) | Constructs a Vector3D from the given Vector4D by remove the last components. |
Vector2D(dX, dY) | Constructs a vector with the given individual elements. |
Static Properties
Zero | Returns the vector (0,0). |
One | Returns the vector (1,1). |
UnitX | Returns the vector (1,0). |
UnitY | Returns the vector (0,1). |
Methods
Equals(other) | Returns a boolean indicating whether the given Vector2D is equal to this Vector2D instance. |
GetHashCode() | Returns the hash code for this instance. |
Equals(obj) | Returns a boolean indicating whether the given Object is equal to this Vector2D instance. |
ToString() | Returns a String representing this Vector2D instance. |
ToString(format) | Returns a String representing this Vector2D instance, using the specified format to format individual elements. |
ToString(format, formatProvider) | Returns a String representing this Vector2D instance, using the specified format to format individual elements and the given IFormatProvider. |
Length() | Returns the length of the vector. |
LengthSquared() | Returns the length of the vector squared. This operation is cheaper than Length(). |
Static Methods
Dot(value1, value2) | Returns the dot product of two vectors. |
Min(value1, value2) | Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors. |
Max(value1, value2) | Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors. |
Abs(value) | Returns a vector whose elements are the absolute values of each of the source vector's elements. |
SquareRoot(vdVector) | Returns a vector whose elements are the square root of each of the source vector's elements. |
Length(value) | Returns the length of the vector. |
Distance(value1, value2) | Returns the Euclidean distance between the two given points. |
DistanceSquared(value1, value2) | Returns the Euclidean distance squared between the two given points. |
Normalize(value) | Returns a vector with the same direction as the given vector, but with a length of 1. |
Reflect(vector, normal) | Returns the reflection of a vector off a surface that has the specified normal. |
Clamp(value1, min, max) | Restricts a vector between a min and max value. |
Operators
operator+(left, right) | Adds two vectors together. |
operator-(left, right) | Subtracts the second vector from the first. |
operator*(left, right) | Multiplies two vectors together. |
operator*(left, right) | Multiplies a vector by the given scalar. |
operator*(left, right) | Multiplies a vector by the given scalar. |
operator/(left, right) | Divides the first vector by the second. |
operator/(value1, value2) | Divides the vector by the given scalar. |
operator-(value) | Negates a given vector. |
operator==(left, right) | Returns a boolean indicating whether the two given vectors are equal. |
operator!=(left, right) | Returns a boolean indicating whether the two given vectors are not equal. |
Variables
X | The X component of the vector. |
Y | The Y component of the vector. |