Group Branching Curves
Triangular loops from branching curves
Last updated
Triangular loops from branching curves
Last updated
//All Vertices (Start and End Points of Lines)
a = Point.PruneDuplicates(List.Flatten([lns.StartPoint,lns.EndPoint],-1));
//Index of Start and End Points in list of Vertices
b = List.Transpose([List.IndexOf(a,lns.StartPoint),List.IndexOf(a,lns.EndPoint)]);
c = List.Flatten(List.Permutations(b,3)<1>,-1);
//Obtain indices of connected vertices
d = List.GetItemAtIndex(c<2>,(0..5)<1>);
e1 = d[0]==d[5] && d[1]==d[2] && d[3]==d[4];
e2 = d[1]==d[5] && d[0]==d[2] && d[3]==d[4];
f = List.UniqueItems(List.FilterByBoolMask(c,e1 || e2)["in"]<1>);
g = List.UniqueItems(List.Sort(f));
h = List.GetItemAtIndex(a,g);
//Surfaces
srf = Surface.ByPerimeterPoints(h);
//Sample Lines
Line.ByStartPointEndPoint(Point.ByCoordinates([0,0,1,1,12,7,15,12],
[0,0,9,9,10,5,6,1]),Point.ByCoordinates([7,1,7,12,7,15,12,7],[5,9,5,10,5,6,1,5]));