private static List <List <Vec2> > PolygonToTriangleStrips(Dictionary <Vec2, int> .KeyCollection keyCollection) { List <Vec2> temp = new List <Vec2>(); foreach (Vec2 v in keyCollection) { temp.Add(v); } Polygon p = new Polygon(temp); TriStrip t = p.ToTriangleStrip(); List <List <Vec2> > ret = new List <List <Vec2> >(); if (t.Count == 0) { return(ret); // throw new Exception("No triangle strip"); } foreach (List <Vec2d> vl in t.Strips) { List <Vec2> vertList = new List <Vec2>(); foreach (Vec2d v in vl) { vertList.Add(GetFromList(temp, new Vec2((float)v.X, (float)v.Y))); } ret.Add(vertList); } return(ret); }
internal static List <List <Vec2i> > PolygonToTriangleStrips(List <Vec2i> vecs) { Polygon p = new Polygon(vecs); TriStrip t = p.ToTriangleStrip(); List <List <Vec2i> > ret = new List <List <Vec2i> >(); if (t.Count == 0) { return(ret); // throw new Exception("No triangle strip"); } foreach (List <Vec2d> vl in t.Strips) { ret.Add(Vec2i.FromVec2dList(vl)); } return(ret); }