Group Abstract Group Abstract

Message Boards Message Boards

[GIF] Nines (Minimum-stick 9-crossing knots)

2 Replies
Posted 6 years ago

Here's a slightly simplified version of Clayton's original implementation:

knotcoords = Table[Import["https://raw.githubusercontent.com/thomaseddy/stick-knot-gen/master/data/mseq_knots/9_"
                          <> IntegerString[k] <> ".txt", "Data"],
                   {k, {35, 39, 43, 45, 48}}];

offsets = 1.4 {{-1, 1/2, 0}, {0, 1/2, 0}, {1, 1/2, 0}, {-1/2, -1/2, 0}, {1/2, -1/2, 0}};

DynamicModule[{p, cols = RGBColor /@ {"#D9782D", "#12A4B6", "#ECC530",
                                      "#CC5430", "#C9D845", "#105456"}}, 
              Manipulate[Graphics3D[MapThread[
                         Function[{cl, kn, of}, GraphicsComplex[
                         TranslationTransform[of][Standardize[kn .
                                                  RotationMatrix[-θ, {0, 1, 0}],
                                                  Mean, 1 &]],
                         {cl, Tube[Append[Range[Length[kn]], 1], 0.015], 
                          Sphere[Range[Length[kn]], .025]}]],
                         {Most[cols], knotcoords, offsets}],
                         Boxed -> False, SphericalRegion -> True, PlotRange -> 2,
                         ViewAngle -> π/8, ViewPoint -> Top, ImageSize -> {540, 400},
                         Background -> cols[[-1]], Lighting -> "Neutral"],
                         {θ, 0, 2 π}, SaveDefinitions -> True]]

Some notes:

  • MeanCenter[] and HorizontalOffset[] were replaced with the built-ins Standardize[] and TranslationTransform[].

  • GraphicsComplex[] is useful for sharing points between the Sphere[] and Tube[] objects. Sphere[]'s first argument can be a list of centers, such that all those spheres have a fixed radius.

  • Instead of using Table[] and looping over different lists of the same length, it can be more convenient to use MapThread[].

POSTED BY: J. M.

enter image description here -- you have earned Featured Contributor Badge enter image description here

Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you, keep it coming, and consider contributing to the The Notebook Archive!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard