# \[GIF\] Master Control Program (Minimal 7\_4 knot on the simple cubic lattice)

**URL:** <https://community.wolfram.com/t/gif-master-control-program-minimal-7-4-knot-on-the-simple-cubic-lattice/13855>\
**Category:** Staff Picks\
**Tags:** computational-arts, geometry, graphics-and-visualization, staff-pick\
**Created:** [April 1, 2019, 12:19am UTC](https://community.wolfram.com/t/gif-master-control-program-minimal-7-4-knot-on-the-simple-cubic-lattice/13855 "2019-04-01T00:19:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![claytonshonkwiler](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/claytonshonkwiler/32/24940_2.png) [@claytonshonkwiler](https://community.wolfram.com/u/claytonshonkwiler)\
**Post date:** [April 1, 2019, 12:19am UTC](https://community.wolfram.com/t/gif-master-control-program-minimal-7-4-knot-on-the-simple-cubic-lattice/13855/1 "2019-04-01T00:19:32Z")

</div>

![l7410q.gif](https://global.discourse-cdn.com/wolfram/original/2X/a/ae23d16b5812c240dd1c5d8f6fb1c268543c8499.gif)

**Master Control Program**

Continuing the series of minimal lattice knots ( [1](https://wolfram.discourse.group/t/13800/1) , [2](https://wolfram.discourse.group/t/13831/1) , [3](https://wolfram.discourse.group/t/13839/1) , [4](https://wolfram.discourse.group/t/13842/1) ), but now back to the simple cubic lattice with the [7\_4 knot](https://en.wikipedia.org/wiki/7%E2%82%84_knot) (a.k.a. the [endless knot](https://en.wikipedia.org/wiki/Endless_knot) from Buddhism). Here’s a more standard view of the 7\_4:

```
KnotData[{7, 4}, #] & /@ {"Image", "KnotDiagram"}

```

 ![74.jpg](https://global.discourse-cdn.com/wolfram/original/2X/b/bcecde5c8636f59aa215bfaf8780969f5d63521b.jpeg)

Once again, we’re grabbing the coordinates of this minimal lattice knot from Andrew Rechnitzer’s page and mean-centering:

```
sc74 = Standardize[Import["https://www.math.ubc.ca/~andrewr/knots/data/SC74.dat"], Mean, 1 &];

```

To get the background gradient I’m using `RadialGradientImage`, which renders very slowly. If you want a responsive `Manipulate`, delete the `Overlay` and the `RadialGradientImage`, and in the `Graphics` replace `Background -> None` with `Background -> cols[[-2]]`.

```
DynamicModule[{p, q, b, n, θ, pl, 
  cols = RGBColor /@ {"#cdffeb", "#009f9d", "#07456f", "#0f0a3c"}},
 Manipulate[
  θ = ArcCos[-(1/3)] (#^3/(1 - 3 # (1 - #))) &[Mod[t, 1]];
  Which[t < 1 || t == 4,
   {p, q} = Normalize /@ {{1, 1, 1}, {1, 0, -1}};
   {n, b} = {p, q}.RotationMatrix[-θ, {-1, 0, 1}];,
   1 <= t < 2,
   {p, q} = Normalize /@ {{-1, 1, -1}, {1, 0, -1}};
   {n, b} = {p, q}.RotationMatrix[-θ, {0, 1, 1}];,
   2 <= t < 3,
   {p, q} = Normalize /@ {{-1, -1, 1}, {-1, 0, -1}};
   {n, b} = {p, q}.RotationMatrix[- θ, {1, 0, 1}];,
   3 <= t < 4,
   {p, q} = Normalize /@ {{1, -1, -1}, {-1, 0, -1}};
   {n, b} = {p, q}.RotationMatrix[- θ, {0, -1, 1}];
   ];
  pl = sc74.Transpose[{Cross[b, n], b}];
  Overlay[
   {RadialGradientImage[cols[[2 ;;]], {540, 540}],
    Graphics[
     {EdgeForm[
       Directive[Thickness[.025], JoinForm["Round"], cols[[1]]]], 
      FaceForm[None], Polygon[pl]},
     ImageSize -> 540, PlotRange -> 4, Background -> None]}
   ],
  {t, 0, 4}]
 ]

```

---

<div class="post-metadata">

**Author:** ![pleasureoffiguring](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/pleasureoffiguring/32/18977_2.png) [@pleasureoffiguring](https://community.wolfram.com/u/pleasureoffiguring)\
**Post date:** [April 1, 2019, 12:58am UTC](https://community.wolfram.com/t/gif-master-control-program-minimal-7-4-knot-on-the-simple-cubic-lattice/13855/2 "2019-04-01T00:58:51Z")

</div>

Since the background is a fixed thing and not being actively updated, you can put the initialization in `DynamicModule[]`; thus, you can do something like

```
DynamicModule[{p, q, b, n, θ, pl, col = RGBColor["#cdffeb"], 
               bg = RadialGradientImage[RGBColor /@ {"#009f9d", "#07456f", "#0f0a3c"},
                                        {540, 540}]},
Manipulate[(* stuff *)
           Overlay[{bg, Graphics[{EdgeForm[Directive[Thickness[.025],
                                                     JoinForm["Round"], col]],
                                  FaceForm[], Polygon[pl]},
                   ImageSize -> 540, PlotRange -> 4]}], {t, 0, 4}]]

```

Yet another alternative that avoids `Overlay[]` would be to use a textured polygon as background. To do that, you can replace the last line inside the `Manipulate[]` with

```
Graphics[(* stuff *), ImageSize -> 540, PlotRange -> 4, 
         Prolog -> {Texture[bg], 
                    Polygon[{Scaled[{0, 0}], Scaled[{1, 0}],
                             Scaled[{1, 1}], Scaled[{0, 1}]}, 
                            VertexTextureCoordinates ->
                            {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}]

```

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [April 1, 2019, 5:47am UTC](https://community.wolfram.com/t/gif-master-control-program-minimal-7-4-knot-on-the-simple-cubic-lattice/13855/3 "2019-04-01T05:47:39Z")

</div>

![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)

- Congratulations! This post is now a [Staff Pick](http://community.wolfram.com/content?curTag=staff+picks) as distinguished by a badge on [your profile](http://community.wolfram.com/web/claytonshonkwiler)! Thank you, keep it coming, and consider contributing your work to the [The Notebook Archive](http://notebookarchive.org)!
