private static List <Vector4> MergePolygon(EarPolygon poly) { List <Vector4> connects = new List <Vector4>(); if (poly.NumChildren() > 0) { List <EarPolygon> children = poly.GetChildren(); List <KeyValuePair <int, float> > order = ChildOrder(children); KeyValuePair <LinkedListNode <EarPoint>, LinkedListNode <EarPoint> > connection; LinkedListNode <EarPoint> temp; for (int i = 0; i < order.Count; i++) { connection = GetSplit(poly, children[order[i].Key], order[i].Value); connects.Add(new Vector4(connection.Key.Value[0], connection.Key.Value[1], connection.Value.Value[0], connection.Value.Value[1])); LinkedListNode <EarPoint> newP = poly.InsertPoint(connection.Key.Value[0], connection.Key.Value[1], connection.Value); temp = connection.Key; do { temp = children[order[i].Key].Next(temp); newP = poly.InsertPoint(temp.Value[0], temp.Value[1], newP); } while (temp.Value != connection.Key.Value); newP = poly.InsertPoint(connection.Value.Value[0], connection.Value.Value[1], newP); } } return(connects); }