using GeoAPI.Geometries;
namespace GisSharpBlog.NetTopologySuite.GeometriesGraph.Index
{
///
///
///
public class SweepLineSegment
{
private readonly Edge edge;
private readonly ICoordinate[] pts;
private readonly int ptIndex;
///
///
///
///
///
public SweepLineSegment(Edge edge, int ptIndex)
{
this.edge = edge;
this.ptIndex = ptIndex;
pts = edge.Coordinates;
}
///
///
///
public double MinX
{
get
{
double x1 = pts[ptIndex].X;
double x2 = pts[ptIndex + 1].X;
return x1 < x2 ? x1 : x2;
}
}
///
///
///
public double MaxX
{
get
{
double x1 = pts[ptIndex].X;
double x2 = pts[ptIndex + 1].X;
return x1 > x2 ? x1 : x2;
}
}
///
///
///
///
///
public void ComputeIntersections(SweepLineSegment ss, SegmentIntersector si)
{
si.AddIntersections(edge, ptIndex, ss.edge, ss.ptIndex);
}
}
}