Pattern
1
//Length of smallest side
2
side = 1;
3
4
//Number of modules (X)
5
nx = 8;
6
7
//Number of modules (Y)
8
ny = 8;
9
10
//The module is a square with an inscribed regular Octagon and another smaller Octagon within
11
//The dimension of the square side is equal to twice the Apothem of the Larger Octagon
12
//The length of the large Octagon side is twice the length of the smaller Octagon
13
14
//The Apothem of the larger Octagon is calculated
15
a = side/(2*Math.Tan(180/8));
16
17
//The circumradius of the large Octagon
18
r = a/(Math.Cos(180/8));
19
20
//Points for one module
21
//Corner Points of Bounding Square
22
pnt01 = Point.ByCoordinates({2*a,-2*a,-2*a,2*a},{2*a,2*a,-2*a,-2*a});
23
//Midpoints of large Octagon sides
24
pnt02 = (Point.Origin()).Translate(Vector.XAxis(),2*a).Rotate(Point.Origin(),Vector.ZAxis(),45..360..45);
25
//Corner Points of Large Octagon
26
pnt03 = (Point.Origin()).Translate(Vector.XAxis(),2*r).Rotate(Point.Origin(),Vector.ZAxis(),22.5..337.5..45);
27
//Corner Points of Small Octagon
28
pnt04 = (Point.Origin()).Translate(Vector.XAxis(),r).Rotate(Point.Origin(),Vector.ZAxis(),22.5..337.5..45);
29
30
//Square Corner Triangulation
31
tri11 = Transpose({List.TakeEveryNthItem(pnt03,2,1),List.TakeEveryNthItem(pnt02,2,1),pnt01});
32
tri12 = Transpose({List.TakeEveryNthItem(pnt02,2,1),pnt01,List.TakeEveryNthItem(pnt03,2,0)});
33
34
//Large Octagon Triangulation
35
tri13 = Transpose({pnt02,pnt03,pnt04});
36
tri14 = Transpose({List.ShiftIndices(pnt03,-1),List.ShiftIndices(pnt02,-1),List.ShiftIndices(pnt04,-1)});
37
tri15 = Transpose({pnt02,pnt04,List.ShiftIndices(pnt04,-1)});
38
tri16 = Transpose({List.ShiftIndices(pnt03,-1),List.ShiftIndices(pnt02,0),List.ShiftIndices(pnt04,-1)});
39
40
//Small Octagon Triangulation
41
tri17 = List.AddItemToFront(Point.Origin(),Transpose({pnt04,List.ShiftIndices(pnt04,1)})<1>);
42
43
//Three point groups for module
44
triPt = List.Flatten({tri11,tri12,tri13,tri14,tri15,tri16,tri17},1);
45
46
//Grid
47
pnts1 = Point.ByCoordinates((2*a..#nx..4*a)<1>,(2*a..#ny..4*a)<2>);
48
49
//Place instances of the points module at grid points.
50
cdSy1 = CoordinateSystem.ByOrigin(pnts1);
51
pat01 = triPt.Transform(cdSy1<1><2>);
52
Copied!
Last modified 1yr ago
Copy link