public double VerticalDistance(OCVLineData line2) { if (this.IsHorizontal() && line2.IsHorizontal()) { return(Math.Abs(GetY() - line2.GetY())); } 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()); }