# Line 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 = 48)]
[Serializable]
public struct Line : IEquatable<Line>, IEpsilonComparable<Line>, ICloneable, IFormattable
```

Represents the value of start and end points in a single line segment.

## Constructors

- [Line](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/ctor.md): (4 overloads) Constructs a new line segment between two points.

## Properties

- [BoundingBox](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/boundingbox.md): Gets the line's 3d axis aligned bounding box.
- [Direction](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/direction.md): Gets the direction of this line segment. The length of the direction vector equals the length of the line segment.
- [From](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/from.md): Start point of line segment.
- [FromX](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/fromx.md): Gets or sets the X coordinate of the line From point.
- [FromY](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/fromy.md): Gets or sets the Y coordinate of the line From point.
- [FromZ](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/fromz.md): Gets or sets the Z coordinate of the line From point.
- [IsValid](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/isvalid.md): Gets a value indicating whether or not this line is valid. Valid lines must have valid start and end points, and the points must not be equal.
- [Length](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/length.md): Gets or sets the length of this line segment. Note that a negative length will invert the line segment without making the actual length negative. The line From point will remain fixed when a new Length is set.
- [To](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/to.md): End point of line segment.
- [ToX](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/tox.md): Gets or sets the X coordinate of the line To point.
- [ToY](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/toy.md): Gets or sets the Y coordinate of the line To point.
- [ToZ](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/toz.md): Gets or sets the Z coordinate of the line To point.
- [UnitTangent](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/unittangent.md): Gets the tangent of the line segment. Note that tangent vectors are always unit vectors.
- [Unset](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/unset.md): (static) Gets a line segment which has [Point3d.Unset](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.point3d/unset.md) end points.

## Methods

- [ClosestParameter](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/closestparameter.md): Finds the parameter on the infinite line segment that is closest to a test point.
- [ClosestPoint](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/closestpoint.md): Finds the point on the (in)finite line segment that is closest to a test point.
- [DistanceTo](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/distanceto.md): Compute the shortest distance between this line segment and a test point.
- [EpsilonEquals](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/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.line/equals.md): (2 overloads) Determines whether a line has the same value as this line.
- [Extend](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/extend.md): Extend the line by custom distances on both sides.
- [ExtendThroughBox](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/extendthroughbox.md): (4 overloads) Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.
- [Flip](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/flip.md): Flip the endpoints of the line segment.
- [GetHashCode](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/gethashcode.md): Computes a hash number that represents this line.
- [MaximumDistanceTo](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/maximumdistanceto.md): (2 overloads) Finds the largest distance between this line as a finite segment and another finite segment.
- [MinimumDistanceTo](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/minimumdistanceto.md): (2 overloads) Finds the shortest distance between this line as a finite segment and another finite segment.
- [PointAt](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/pointat.md): Evaluates the line at the specified parameter.
- [PointAtLength](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/pointatlength.md): Computes a point located at a specific metric distance from the line origin ([Line.From](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/from.md)). If line start and end coincide, then the start point is always returned.
- [ICloneable.Clone](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/system-icloneable-clone.md)
- [ToNurbsCurve](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/tonurbscurve.md): Constructs a nurbs curve representation of this line. This amounts to the same as calling NurbsCurve.CreateFromLine().
- [ToString](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/tostring.md): (2 overloads) Constructs the string representation of this line, in the form "From,To".
- [Transform](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/transform.md): Transform the line using a Transformation matrix.
- [TryCreateBetweenCurves](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/trycreatebetweencurves.md): (static) Creates a line segment between a pair of curves such that the line segment is either tangent or perpendicular to each of the curves.
- [TryFitLineToPoints](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/tryfitlinetopoints.md): (static) Attempt to fit a line through a set of points.
- [TryGetPlane](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/trygetplane.md): Gets a plane that contains the line. The origin of the plane is at the start of the line. If possible, a plane parallel to the world XY, YZ, or ZX plane is returned.

## Operators

- [operator ==](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/op-equality.md): (static) Determines whether two lines have the same value.
- [operator !=](https://developer.rhino3d.com/api/rhinocommon/type/rhino.geometry.line/op-inequality.md): (static) Determines whether two lines have different values.
