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