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

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

## Constructors

- [Vector3f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/ctor.md): Constructs a new vector from 3 single precision numbers.

## Properties

- [IsUnitVector](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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.vector3f/isvalid.md): Returns an indication regarding the validity of this vector.
- [IsZero](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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.vector3f/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.vector3f/squarelength.md): Returns the square length of the vector. This property does not check for the validity of the inputs.
- [Unset](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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.vector3f/x.md): Gets or sets the X (first) component of this vector.
- [XAxis](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/xaxis.md): (static) Gets the value of the vector with components 1,0,0.
- [Y](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/y.md): Gets or sets the Y (second) component of this vector.
- [YAxis](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/yaxis.md): (static) Gets the value of the vector with components 0,1,0.
- [Z](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/z.md): Gets or sets the Z (third) component of this vector.
- [ZAxis](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/zaxis.md): (static) Gets the value of the vector with components 0,0,1.
- [Zero](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/zero.md): (static) Gets the value of the vector with components 0,0,0.

## Methods

- [Add](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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.vector3f/compareto.md): Compares this [Vector3f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f.md) with another [Vector3f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f.md). Component evaluation priority is first X, then Y, then Z.
- [CrossProduct](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/crossproduct.md): (static) Computes the cross product (or vector product, or exterior product) of two vectors. This operation is not commutative.
- [Divide](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/divide.md): (2 overloads, static) Divides a [Vector3f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f.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.vector3f/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.vector3f/equals.md): (2 overloads) Determines whether the specified System.Object is a Vector3f and has the same values as the present vector.
- [GetHashCode](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/gethashcode.md): Computes a hash number that represents the current vector.
- [Multiply](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/multiply.md): (3 overloads, static) Multiplies two [Vector3f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f.md) together, returning the dot (internal) product of the two. This is not the cross 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.vector3f/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.vector3f/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.vector3f/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.
- [Rotate](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/rotate.md): Rotates this vector around a given axis.
- [Subtract](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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.vector3f/system-icomparable-compareto.md)
- [ToString](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/tostring.md): (2 overloads) Constructs the string representation of the current vector.
- [Transform](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/transform.md): Transforms the vector in place. The transformation matrix acts on the left of the vector; i.e., result = transformation*vector
- [Unitize](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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.vector3f/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.vector3f/op-division.md): (2 overloads, static) Divides a [Vector3f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f.md) by a number, having the effect of shrinking it, t times.
- [operator ==](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-equality.md): (static) Determines whether two vectors have equal values.
- [operator >](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-greaterthan.md): (static) Determines whether the first specified vector comes after (has superior sorting value than) the second vector. Components evaluation priority is first X, then Y, then Z.
- [operator >=](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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 evaluation priority is first X, then Y, then Z.
- [operator !=](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-inequality.md): (static) Determines whether two vectors have different values.
- [operator <](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-lessthan.md): (static) Determines whether the first specified vector comes before (has inferior sorting value than) the second vector. Components evaluation priority is first X, then Y, then Z.
- [operator <=](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/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 evaluation priority is first X, then Y, then Z.
- [operator *](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-multiply.md): (3 overloads, static) Multiplies two [Vector3f](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f.md) together, returning the dot (internal) product of the two. This is not the cross product.
- [operator -](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-subtraction.md): (static) Subtracts the second vector from the first one.
- [operator -](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-unarynegation.md): (static) Computes the opposite vector.

## Convertors

- [operator explicit](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.vector3f/op-explicit.md): (static) Converts a double-precision vector in a single-precision vector. Needs explicit casting to help retain precision.
