# Vector2 Struct

## Definition

Represents a 2D vector using two single-precision floating-point numbers.

``````[System.Serializable]
public struct Vector2 : IEquatable<OpenTK.Vector2>``````
``type Vector2 = struct``
Inheritance
Vector2
Attributes
Implements

## Remarks

The Vector2 structure is suitable for interoperation with unmanaged code requiring two consecutive floats.

## Constructors

 Constructs a new Vector2. Constructs a new Vector2 from the given Vector2. Constructs a new Vector2 from the given Vector3. Constructs a new Vector2 from the given Vector4.

## Fields

 Defines an instance with all components set to 1. Defines the size of the Vector2 struct in bytes. Defines a unit-length Vector2 that points towards the X-axis. Defines a unit-length Vector2 that points towards the Y-axis. The X component of the Vector2. The Y component of the Vector2. Defines a zero-length Vector2.

## Properties

 Gets the length (magnitude) of the vector. Gets an approximation of the vector length (magnitude). Gets the square of the vector length (magnitude). Gets the perpendicular vector on the left side of this vector. Gets the perpendicular vector on the right side of this vector.

## Methods

 Add the Vector passed as parameter to this instance. Add the Vector passed as parameter to this instance. Add two Vectors Clamp a vector to the given minimum and maximum vectors Calculate the component-wise maximum of two vectors Calculate the component-wise minimum of two vectors Divide this instance by a scalar. Calculate the dot (scalar) product of two vectors Indicates whether this instance and a specified object are equal. Indicates whether the current vector is equal to another vector. Returns the hashcode for this instance. Multiply this instance by a scalar. Scales the Vector2 to unit length. Scale a vector to unit length Scales the Vector2 to approximately unit length. Scale a vector to approximately unit length Scales the current Vector2 by the given amounts. Scales this instance by the given parameter. Scales this instance by the given parameter. Subtract the Vector passed as parameter from this instance. Subtract the Vector passed as parameter from this instance. Subtract one Vector from another Returns a System.String that represents the current Vector2.

## Operators

 Compares the specified instances for equality. Compares the specified instances for inequality.