The class encapsulates 2D line segment and provides some tool methods related to lines.

Namespace:  AForge.Math.Geometry
Assembly:  AForge.Math (in AForge.Math.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public sealed class LineSegment

Remarks

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:

CopyC#
// 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 ) ) );

Inheritance Hierarchy

System..::.Object
  AForge.Math.Geometry..::.LineSegment

See Also