# Pattern

![](/files/-LfQUgHRTw3C0JGNsq_E)

```d
//Length of smallest side
side = 1;

//Number of modules (X)
nx = 8;

//Number of modules (Y)
ny = 8;

//The module is a square with an inscribed regular Octagon and another smaller Octagon within
//The dimension of the square side is equal to twice the Apothem of the Larger Octagon
//The length of the large Octagon side is twice the length of the smaller Octagon

//The Apothem of the larger Octagon is calculated
a = side/(2*Math.Tan(180/8));

//The circumradius of the large Octagon
r = a/(Math.Cos(180/8));

//Points for one module
//Corner Points of Bounding Square
pnt01 = Point.ByCoordinates({2*a,-2*a,-2*a,2*a},{2*a,2*a,-2*a,-2*a});
//Midpoints of large Octagon sides
pnt02 = (Point.Origin()).Translate(Vector.XAxis(),2*a).Rotate(Point.Origin(),Vector.ZAxis(),45..360..45);
//Corner Points of Large Octagon
pnt03 = (Point.Origin()).Translate(Vector.XAxis(),2*r).Rotate(Point.Origin(),Vector.ZAxis(),22.5..337.5..45);
//Corner Points of Small Octagon
pnt04 = (Point.Origin()).Translate(Vector.XAxis(),r).Rotate(Point.Origin(),Vector.ZAxis(),22.5..337.5..45);

//Square Corner Triangulation
tri11 = Transpose({List.TakeEveryNthItem(pnt03,2,1),List.TakeEveryNthItem(pnt02,2,1),pnt01});
tri12 = Transpose({List.TakeEveryNthItem(pnt02,2,1),pnt01,List.TakeEveryNthItem(pnt03,2,0)});

//Large Octagon Triangulation
tri13 = Transpose({pnt02,pnt03,pnt04});
tri14 = Transpose({List.ShiftIndices(pnt03,-1),List.ShiftIndices(pnt02,-1),List.ShiftIndices(pnt04,-1)});
tri15 = Transpose({pnt02,pnt04,List.ShiftIndices(pnt04,-1)});
tri16 = Transpose({List.ShiftIndices(pnt03,-1),List.ShiftIndices(pnt02,0),List.ShiftIndices(pnt04,-1)});

//Small Octagon Triangulation
tri17 = List.AddItemToFront(Point.Origin(),Transpose({pnt04,List.ShiftIndices(pnt04,1)})<1>);

//Three point groups for module
triPt = List.Flatten({tri11,tri12,tri13,tri14,tri15,tri16,tri17},1);

//Grid
pnts1 = Point.ByCoordinates((2*a..#nx..4*a)<1>,(2*a..#ny..4*a)<2>);

//Place instances of the points module at grid points.
cdSy1 = CoordinateSystem.ByOrigin(pnts1);
pat01 = triPt.Transform(cdSy1<1><2>);

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.testingwaters.in/patterns/pattern.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
