Triangle subdivision
Last updated
Last updated
c0 = t.Explode();
c1 = c0[0];
c2 = c1.StartPoint.DoesIntersect(c0[1])?c0[2]:c0[1];
c3 = c1.StartPoint.DoesIntersect(c0[1])?c0[1]:c0[2];
d1 = Vector.ByTwoPoints(c1.EndPoint,c2.Intersect(c3));
p1 = c1.PointAtParameter(0..1..#n+1);
d2 = List.TakeItems(0..#n+1..(c2.Length/n),1..n+1);
p3 = List.Flatten(p1<1>.Translate(d1,d2<1><2>)<1>,-1);
//Triangle Vertex Groups
p11 = List.DropItems(p3,-1);
p12 = List.DropItems(List.Sublists(List.RestOfItems(p3)<1>,0..1,1)<1>,-1);
p13 = List.Flatten(List.Transpose(List.Transpose([p11,p12])<1>)<1><2>,-1);
p14 = List.DropItems(List.DropItems(List.DropItems(p3,2)<1>,-1)<1>,1);
p15 = List.DropItems(List.Sublists(List.DropItems(p11,1)<1>,0..1,1)<1>,-1);
p16 = List.Flatten(List.Transpose(List.Transpose([p14,p15])<1>)<1><2>,-1);
p17 = List.Clean(List.Flatten(List.Transpose([p13,p16]),2),false);