# Vector2f 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 = 4, Size = 8)]
[DebuggerDisplay("({m_x}, {m_y})")]
[Serializable]
public struct Vector2f : IEquatable<Vector2f>, IComparable<Vector2f>, IComparable, IEpsilonFComparable<Vector2f>, IFormattable
```

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

## Constructors

- [Vector2f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/ctor.md): Creates an instance.

## Properties

- [IsUnitVector](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/isunitvector.md): Gets a value indicating whether or not this is a unit vector. A unit vector has length 1.
- [IsValid](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/isvalid.md): Returns an indication regarding the validity of this vector.
- [IsZero](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/iszero.md): Gets a value indicating whether the X, Y, and Z values are all equal to 0.0.
- [Length](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/length.md): Computes the length (or magnitude, or size) of this vector. This is an application of Pythagoras' theorem. If this vector is invalid, its length is considered 0.
- [SquareLength](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/squarelength.md): Returns the square of the length of this vector. This method does not check for the validity of its inputs.
- [Unset](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/unset.md): (static) Gets the value of the vector with each component set to RhinoMath.UnsetValue.
- [X](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/x.md): Gets or sets the X (first) component of this vector.
- [XAxis](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/xaxis.md): (static) Gets the value of the vector with components 1,0.
- [Y](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/y.md): Gets or sets the Y (second) component of this vector.
- [YAxis](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/yaxis.md): (static) Gets the value of the vector with components 0,1.
- [Zero](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/zero.md): (static) Gets the value of the vector with components 0,0.

## Methods

- [Add](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/add.md): (2 overloads, static) Sums up a point and a vector, and returns a new point. (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.vector2f/compareto.md): Compares this [Vector2f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f.md) with another [Vector2f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f.md). Components evaluation priority is first X, then Y.
- [Divide](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/divide.md): (2 overloads, static) Divides a [Vector2f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f.md) by a number, having the effect of shrinking it, t times. (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.vector2f/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.vector2f/equals.md): (2 overloads) Determines whether the specified System.Object is a Vector2f and has the same values as the present vector.
- [GetHashCode](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/gethashcode.md): Computes a hash number that represents the current vector.
- [Multiply](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/multiply.md): (3 overloads, static) Multiplies two [Vector2f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f.md) together, returning the dot (internal) product of the two. (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.vector2f/negate.md): (static) Computes the reversed vector. (Provided for languages that do not support operator overloading. You can use the - unary operator otherwise)
- [PerpendicularTo](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/perpendicularto.md): Sets this vector to be perpendicular to another vector. Result is not unitized.
- [Reverse](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/reverse.md): Reverses this vector in place (reverses the direction). If this vector contains RhinoMath.UnsetValue, the reverse will also be invalid and false will be returned.
- [Subtract](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/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.vector2f/system-icomparable-compareto.md)
- [ToString](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/tostring.md): (2 overloads) Constructs the string representation of the current vector.
- [Unitize](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/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.vector2f/op-addition.md): (2 overloads, static) Sums up a point and a vector, and returns a new point.
- [operator /](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/op-division.md): (2 overloads, static) Divides a [Vector2f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f.md) by a number, having the effect of shrinking it, t times.
- [operator ==](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/op-equality.md): (static) Determines whether two vectors have equal values.
- [operator >](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/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.vector2f/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.vector2f/op-inequality.md): (static) Determines whether two vectors have different values.
- [operator <](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/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.vector2f/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.vector2f/op-multiply.md): (3 overloads, static) Multiplies two [Vector2f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f.md) together, returning the dot (internal) product of the two.
- [operator -](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/op-subtraction.md): (static) Computes the difference between two vectors.
- [operator -](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector2f/op-unarynegation.md): (static) Computes the opposite vector.
