static void ConnectExtendedPoints(List <ContourCorner> corners, List <int> cornerOfNextContours) { //test 2 if each edge has unique color int startAt = 0; for (int i = 0; i < cornerOfNextContours.Count; ++i) { int nextStartAt = cornerOfNextContours[i]; for (int n = startAt + 1; n < nextStartAt; ++n) { ContourCorner.ConnectToEachOther(corners[n - 1], corners[n]); } //-------------- { //the last one ContourCorner.ConnectToEachOther(corners[nextStartAt - 1], corners[startAt]); } //--------- startAt = nextStartAt;//*** } }
internal static void ConnectToEachOther(ContourCorner a, ContourCorner b) { a.NextCorner = b; b.PrevCorner = a; }