## Types in MathNet.Spatial.Euclidean

Type Line2D

Namespace MathNet.Spatial.Euclidean

Parent ValueType

Interfaces IEquatable<Line2D>, IXmlSerializable

This structure represents a line between two points in 2-space. It allows for operations such as computing the length, direction, projections to, comparisons, and shifting by a vector.

### Public Constructors

#### Line2D(Point2D startPoint, Point2D endPoint)

Initializes a new instance of the Line2D struct. Throws an ArgumentException if the startPoint is equal to the endPoint.
##### Parameters
###### `Point2D` startPoint

the starting point of the line segment.

###### `Point2D` endPoint

the ending point of the line segment

### Public Static Functions

#### Line2DParse(string startPointString, string endPointString)

Returns a new Line2D from a pair of strings which represent points. See Parse for details on acceptable formats.
##### Parameters
###### `string` startPointString

The string representation of the first point.

###### `string` endPointString

The string representation of the second point.

##### Return
###### `Line2D`

A line segment from the first point to the second point.

### Public Methods

#### Point2DClosestPointTo(Point2D p, bool mustBeOnSegment)

Returns the closest point on the line to the given point.
##### Parameters
###### `Point2D` p

The point that the returned point is the closest point on the line to

###### `bool` mustBeOnSegment

If true the returned point is contained by the segment ends, otherwise it can be anywhere on the projected line

##### Return
###### `Point2D`

The closest point on the line to the provided point

#### Nullable<Point2D>IntersectWith(Line2D other)

Compute the intersection between two lines with parallelism considered by the double floating point precision on the cross product of the two directions.
##### Parameters
###### `Line2D` other

The other line to compute the intersection with

##### Return
###### `Nullable<Point2D>`

The point at the intersection of two lines, or null if the lines are parallel.

#### Nullable<Point2D>IntersectWith(Line2D other, Angle tolerance)

Compute the intersection between two lines if the angle between them is greater than a specified angle tolerance.
##### Parameters
###### `Line2D` other

The other line to compute the intersection with

###### `Angle` tolerance

The tolerance used when checking if the lines are parallel

##### Return
###### `Nullable<Point2D>`

The point at the intersection of two lines, or null if the lines are parallel.

#### boolIsParallelTo(Line2D other)

Checks to determine whether or not two lines are parallel to each other, using the dot product within the double precision specified in the MathNet.Numerics package.
##### Parameters
###### `Line2D` other

The other line to check this one against

##### Return
###### `bool`

True if the lines are parallel, false if they are not

#### boolIsParallelTo(Line2D other, Angle tolerance)

Checks to determine whether or not two lines are parallel to each other within a specified angle tolerance
##### Parameters
###### `Line2D` other

The other line to check this one against

###### `Angle` tolerance

If the angle between line directions is less than this value, the method returns true

##### Return
###### `bool`

True if the lines are parallel within the angle tolerance, false if they are not

#### Line2DLineTo(Point2D p, bool mustStartBetweenAndEnd)

Returns the shortest line between this line and a point.
##### Parameters
###### `Point2D` p

the point to create a line to

###### `bool` mustStartBetweenAndEnd

If false the start point can extend beyond the start and endpoint of the line

##### Return
###### `Line2D`

The shortest line between the line and the point

### Public Properties

#### Vector2DDirection get;

Gets a normalized vector in the direction from StartPoint to EndPoint

#### Point2DEndPoint get; set;

The end point of the line segment

#### doubleLength get;

Gets the distance from StartPoint to EndPoint

#### Point2DStartPoint get; set;

The starting point of the line segment