public double HorizontalDistance(OCVLineData line2) { if (this.IsVertical() && line2.IsVertical()) { return(Math.Abs(GetX() - line2.GetX())); } else { return(-1); } }
public OCVGridData(LineSegment2D[] lines) { HorizontalLines = new List <OCVLineData>(); VerticalLines = new List <OCVLineData>(); foreach (LineSegment2D line in lines) { if (line.Length < OCVConst.MinimalLineLength) { continue; } OCVLineData newData = new OCVLineData(line); if (newData.IsHorizontal()) { HorizontalLines.Add(newData); } else if (newData.IsVertical()) { VerticalLines.Add(newData); } } HorizontalLines.Sort(new OCVHorizontalLineDataSorter()); VerticalLines.Sort(new OCVVerticalLineDataSorter()); }