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

Intercept 
If not IsVertical, gets the Line's Yintercept.
If IsVertical gets the line's Xintercept.
 
IsHorizontal 
Checks if the line horizontal or not.
 
IsVertical 
Checks if the line vertical or not.
 
Slope 
Gets the slope of the line.

Name  Description  

DistanceToPoint 
Calculate Euclidean distance between a point and a line.
 
Equals 
Check if this instance of Line equals to the specified one.
(Overrides ObjectEquals(Object).)  
FromPoints 
Creates a Line that goes through the two specified points.
 
FromPointTheta 
Constructs a Line from a point and an angle (in degrees).
 
FromRTheta 
Constructs a Line from a radius and an angle (in degrees).
 
FromSlopeIntercept 
Creates a Line with the specified slope and intercept.
 
GetAngleBetweenLines 
Calculate minimum angle between this line and the specified line measured in [0, 90] degrees range.
 
GetHashCode 
Get hash code for this instance.
(Overrides ObjectGetHashCode.)  
GetIntersectionWith(Line) 
Finds 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 lines have equal parameters.
 
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.)  
ToT 
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 lines: angle between lines, distance to point, finding intersection point, etc.
Generally, the equation of the line is y = Slope * x + Intercept. However, when Slope is an Infinity, would normally be meaningless, and it would be impossible to distinguish the line x = 5 from the line x = 5. Therefore, if Slope is PositiveInfinity or NegativeInfinity, the line's equation is instead x = Intercept.
Sample usage:
// create a line Line line = Line.FromPoints( new Point( 0, 0 ), new Point( 3, 4 ) ); // check if it is vertical or horizontal if ( line.IsVertical  line.IsHorizontal ) { // ... } // get intersection point with another line Point intersection = line.GetIntersectionWith( Line.FromPoints( new Point( 3, 0 ), new Point( 0, 4 ) ) );