Area Graph
Subdivide a Rectangle proportionately based on a list of numbers
AreaGraph.dyn
5KB
Text
1
sq01 = Math.Sqrt(Math.Sum(a));
2
sq02 = sq01 % Math.Floor(sq01);
3
sq03 = 1+sq02/Math.Floor(sq01);
4
sq04 = Rectangle.ByWidthLength(sq03,sq03);
5
sq05 = sq04.Translate(Vector.YAxis(),0..#Math.Floor(sq01)..sq03);
6
sq06 = sq05<1>.Translate(Vector.XAxis(),0..#Math.Floor(sq01)..sq03);
7
sq07 = List.TakeEveryNthItem(sq06,2,1);
8
sq08 = List.Reverse(List.TakeEveryNthItem(sq06,2,0)<1>);
9
sq09 = List.Clean(Flatten(List.Transpose({sq07,sq08})),false);
10
ct01 = Math.Pow(Math.Floor(sq01),2);
11
ct02 = Math.Round(a/(Math.Sum(a)/ct01));
12
ct03 = List.ReplaceItemAtIndex(ct02,-1,List.LastItem(ct02)+(ct01-Math.Sum(ct02)));
13
sq10 = PolySurface.ByJoinedSurfaces(List.Chop(sq09,ct03).Patch());
14
clr1 = List.Chop(Math.Floor(Math.RemapRange(Math.RandomList(List.Count(sq10)*3),10,255)),List.Count(sq10));
15
clr2 = Display.ByGeometryColor(sq10,Color.ByARGB(255,clr1[0],clr1[1],clr1[2]));
Copied!
Last modified 1yr ago
Copy link