LineSegment Class 
Namespace: Accord.Math.Geometry
The LineSegment type exposes the following members.
Name  Description  

LineSegment 
Initializes a new instance of the LineSegment class.

Name  Description  

DistanceToPoint 
Calculate Euclidean distance between a point and a finite line segment.
 
Equals 
Check if this instance of LineSegment equals to the specified one.
(Overrides ObjectEquals(Object).)  
GetHashCode 
Get hash code for this instance.
(Overrides ObjectGetHashCode.)  
GetIntersectionWith(Line) 
Finds, provided it exists, the intersection point with the specified Line.
 
GetIntersectionWith(LineSegment) 
Finds, provided it exists, the intersection point with the specified LineSegment.
 
GetType  Gets the Type of the current instance. (Inherited from Object.)  
ToString 
Get string representation of the class.
(Overrides ObjectToString.) 
Name  Description  

Equality 
Equality operator  checks if two line segments have equal parameters.
 
(LineSegment to Line) 
Converts this LineSegment to a Line by discarding
its endpoints and extending it infinitely in both directions.
 
Inequality 
Inequality operator  checks if two lines have different parameters.

Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual 
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.)  
To(Type)  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) 
The class provides some methods which are related to line segments: distance to point, finding intersection point, etc.
A line segment may be converted to a Line.
Sample usage:
// create a segment LineSegment segment = new LineSegment( new Point( 0, 0 ), new Point( 3, 4 ) ); // get segment's length float length = segment.Length; // get intersection point with a line Point? intersection = segment.GetIntersectionWith( new Line( new Point( 3, 8 ), new Point( 0, 4 ) ) );