public static List <List <GeoAABB2> > PolygonPartition(List <Vector2> parentP, List <Vector2> childP, List <PartitionUnit> probablities) { List <Vector4> connects = null; List <Vector2> source = new List <Vector2>(); if (childP != null && childP.Count > 0) { EarPolygon polygon = new EarPolygon(); foreach (Vector2 t in parentP) { polygon.AddPoint(t[0], t[1]); } EarPolygon chlid = new EarPolygon(polygon); foreach (Vector2 t in childP) { chlid.AddPoint(t[0], t[1]); } connects = EarClipping.Merge(polygon); LinkedListNode <EarPoint> point = polygon.Get(); while (point.Next != null) { source.Add(point.Value.mPoint); point = point.Next; } } else { source.AddRange(parentP); } return(PolygonPartition(source, probablities, connects)); }
private void Initialize(List <Vector2> parent, List <Vector2> child) { List <Vector4> connects = null; List <Vector2> source = new List <Vector2>(); if (child != null && child.Count > 0) { EarPolygon polygon = new EarPolygon(); foreach (Vector2 t in parent) { polygon.AddPoint(t[0], t[1]); } EarPolygon chlid = new EarPolygon(polygon); foreach (Vector2 t in child) { chlid.AddPoint(t[0], t[1]); } connects = EarClipping.Merge(polygon); LinkedListNode <EarPoint> point = polygon.Get(); while (point.Next != null) { source.Add(point.Value.mPoint); point = point.Next; } } else { source.AddRange(parent); } mWrapper = PolygonWrapper.Create(source, true, connects, 2); mArea = mWrapper.Area; }