ICustomLine FindLineWithPoint(Point point) { foreach (var line in simplifiedModel) { if (CustomLine.IsPointBelongsToLine(line.GetPoint1().GetPoint(), line.GetPoint2().GetPoint(), point, 0.01)) { return(line); } } return(null); }
public static bool CheckOutOfBoundary(Point linePoint1, Point linePoint2, IEnumerable <ICustomLine> simplifiedModel) { bool isOutOfBoundary = false; Parallel.ForEach(simplifiedModel, (line) => { if (CustomLine.CheckLinesIntersection(linePoint1, linePoint2, line.GetPoint1().GetPoint(), line.GetPoint2().GetPoint())) { isOutOfBoundary = true; } }); return(isOutOfBoundary); }
public List <ICustomLine> Split(IEnumerable <IContour> contours, double accuracy) { List <ICustomLine> customLines = new List <ICustomLine>(); int segmentNumber = 0; foreach (var contour in contours) { IEnumerable <ISegment> segments = contour.GetSegments(); foreach (var segment in segments) { List <ICustomPoint> splittedPoints = SplitSegment(segment, accuracy, tStep, segmentNumber); for (int i = 0; i < splittedPoints.Count - 1; i++) { ICustomLine newLine = new CustomLine(splittedPoints[i], splittedPoints[i + 1]); customLines.Add(newLine); } segmentNumber++; } } return(customLines); }