/// <summary> /// Returns the contour points on a grid starting in a given contour point /// </summary> /// <param name="first"></param> /// <param name="vgrid"></param> /// <param name="hgrid"></param> /// <returns></returns> private IEnumerable <ContourPoint> GetPoints(ContourPoint first, IEnumerable <ContourPoint>[][] vgrid, IEnumerable <ContourPoint>[][] hgrid) { first.Parent = this; yield return(first); ContourPoint next, current = first; while ((next = current.FindNext(vgrid, hgrid)) != null && next != first) { next.Parent = this; yield return(next); current = next; } }
public Contour(ContourPoint first, IEnumerable <ContourPoint>[][] vgrid, IEnumerable <ContourPoint>[][] hgrid, bool isClosed) { Value = first.Value; IsClosed = isClosed; Points = GetPoints(first, vgrid, hgrid).ToArray(); }