# Vector2d struct

Namespace: [Rhino.Geometry](https://developer.rhino3d.com/api/rhinocommon/namespace/rhino.geometry.md) · Assembly: [RhinoCommon](https://developer.rhino3d.com/api/rhinocommon/assembly/rhinocommon.md)

```cs
[StructLayout(LayoutKind.Sequential, Pack = 8, Size = 16)]
[DebuggerDisplay("({m_x}, {m_y})")]
[Serializable]
public struct Vector2d : ISerializable, IEquatable<Vector2d>, IComparable<Vector2d>, IComparable, IEpsilonComparable<Vector2d>, IFormattable
```

Represents the two components of a vector in two-dimensional space, using [double](https://learn.microsoft.com/dotnet/api/system.double)-precision floating point numbers.

## Constructors

- [Vector2d](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/ctor.md): Initializes a new instance of the vector based on two, X and Y, components.

## Properties

- [IsValid](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/isvalid.md): Gets a value indicating whether this vector is valid. A valid vector must be formed of valid component values for x, y and z.
- [Length](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/length.md): Computes the length (or magnitude, or size) of this vector. This is an application of Pythagoras' theorem.
- [SquareLength](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/squarelength.md): Returns the square of the length of the vector.
- [Unset](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/unset.md): (static) Gets the value of the vector with components set as RhinoMath.UnsetValue,RhinoMath.UnsetValue.
- [X](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/x.md): Gets or sets the X (first) component of this vector.
- [Y](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/y.md): Gets or sets the Y (second) component of this vector.
- [Zero](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/zero.md): (static) Gets the value of the vector with components 0,0.

## Methods

- [Add](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/add.md): (static) Sums up two vectors. (Provided for languages that do not support operator overloading. You can use the + operator otherwise)
- [CompareTo](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/compareto.md): Compares this [Vector2d](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d.md) with another [Vector2d](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d.md). Components evaluation priority is first X, then Y.
- [Divide](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/divide.md): (static) Divides a [Vector2d](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d.md) by a number, having the effect of shrinking it. (Provided for languages that do not support operator overloading. You can use the / operator otherwise)
- [EpsilonEquals](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/epsilonequals.md): Check that all values in other are within epsilon of the values in this
- [Equals](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/equals.md): (2 overloads) Determines whether the specified System.Object is a Vector2d and has the same value as the present vector.
- [GetHashCode](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/gethashcode.md): Provides a hashing value for the present vector.
- [IsTiny](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/istiny.md): (2 overloads) Uses RhinoMath.ZeroTolerance for IsTiny calculation.
- [Multiply](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/multiply.md): (3 overloads, static) Multiplies two vectors together, returning the dot product (or inner product). (Provided for languages that do not support operator overloading. You can use the * operator otherwise)
- [Negate](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/negate.md): (static) Computes the reversed vector. (Provided for languages that do not support operator overloading. You can use the - unary operator otherwise)
- [Rotate](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/rotate.md): Rotates this vector.
- [Subtract](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/subtract.md): (static) Subtracts the second vector from the first one. (Provided for languages that do not support operator overloading. You can use the - operator otherwise)
- [IComparable.CompareTo](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/system-icomparable-compareto.md)
- [ISerializable.GetObjectData](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/system-runtime-serialization-iserializable-getobjectdata.md)
- [ToString](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/tostring.md): (2 overloads) Constructs a string representation of the current vector.
- [Unitize](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/unitize.md): Unitizes the vector in place. A unit vector has length 1 unit. An invalid or zero length vector cannot be unitized.

## Operators

- [operator +](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-addition.md): (static) Sums up two vectors.
- [operator /](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-division.md): (static) Divides a [Vector2d](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d.md) by a number, having the effect of shrinking it.
- [operator ==](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-equality.md): (static) Determines whether two vectors have equal values.
- [operator >](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-greaterthan.md): (static) Determines whether the first specified vector comes after (has superior sorting value than) the second vector. Components have decreasing evaluation priority: first X, then Y.
- [operator >=](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-greaterthanorequal.md): (static) Determines whether the first specified vector comes after (has superior sorting value than) the second vector, or it is equal to it. Components have decreasing evaluation priority: first X, then Y.
- [operator !=](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-inequality.md): (static) Determines whether two vectors have different values.
- [operator <](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-lessthan.md): (static) Determines whether the first specified vector comes before (has inferior sorting value than) the second vector. Components have decreasing evaluation priority: first X, then Y.
- [operator <=](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-lessthanorequal.md): (static) Determines whether the first specified vector comes before (has inferior sorting value than) the second vector, or it is equal to it. Components have decreasing evaluation priority: first X, then Y.
- [operator *](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-multiply.md): (3 overloads, static) Multiplies two vectors together, returning the dot product (or inner product).
- [operator -](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-subtraction.md): (static) Subtracts the second vector from the first one.
- [operator -](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2d/op-unarynegation.md): (static) Computes the opposite vector.
