JSL erstellt die Bilder für diese angehängte 4K-Animation mit 60 FPS.
Die verdrehten Verbindungen waren ziemlich einfach. Jetzt denke ich über Zöpfe nach. Da ist ein Gruppe Haufen Mathematiker, die auf Zöpfe stehen. Ich habe gerade genug gelernt, um gefährlich zu sein. Hier ist eine kleine JSL zum Zeichnen eines fünfsträngigen Geflechts. Ich glaube, alle drei Variationen im Bild unten sind es Äquivalent .
drawpattern = Function( {pattern, gb},
channelToYPos = ["A" => 1, "B" => 2, "C" => 3, "D" => 4, "E" => 5]; // static
channelToStrandID = ["A" => 1, "B" => 2, "C" => 3, "D" => 4, "E" => 5]; // braiding swaps these around
strandIDToColor = Heat Color( (1 :: 5) / 6, "jet" );
erasecolor = gb[Framebox( 1 )] << getbackgroundcolor;
xleft = 1;
xstep = 1 / N Items( pattern );
circlesize = .20;
pensize = 15;
For( x = 1, x <= 10, x += 1,
For Each( {row}, pattern,
notfound = Associative Array( channelToYPos << getkeys );
For Each( {swapchans}, row,
channel_over = Substr( swapchans, 1, 1 );
channel_under = Substr( swapchans, 2, 1 );
// get Y positions of the two adjacent channels that will swap strands...
channel_over_ypos = channelToYPos[channel_over];
channel_under_ypos = channelToYPos[channel_under];
// get the strand ids currently in those channels
channel_over_StrandID = channelToStrandID[channel_over];
channel_under_StrandID = channelToStrandID[channel_under];
// get the colors of the strand ids
channel_over_Color = strandIDToColor[channel_over_StrandID];
channel_under_Color = strandIDToColor[channel_under_StrandID];
// render this swap
Pen Size( pensize );
Pen Color( channel_under_Color );
Line( {xleft, channel_under_ypos}, {xleft + xstep, channel_over_ypos} ); // draw under first
Fill Color( channel_under_Color );
Circle( {xleft, channel_under_ypos}, circlesize, "FILL" );
Pen Size( pensize * 2 - 1 );// erase a wider line before drawing to make the
Pen Color( erasecolor ); // overpass effect...
Line( {xleft, channel_over_ypos}, {xleft + xstep, channel_under_ypos} ); // draw over last, erase wider
Pen Size( pensize );
Pen Color( channel_over_Color );
Line( {xleft, channel_over_ypos}, {xleft + xstep, channel_under_ypos} ); // draw over last, within erased
Fill Color( channel_over_Color );
Circle( {xleft, channel_over_ypos}, circlesize, "FILL" );
// swap
channelToStrandID[channel_over] = channel_under_StrandID;
channelToStrandID[channel_under] = channel_over_StrandID;
notfound[channel_over] = 0;
notfound[channel_under] = 0;
);
For Each( {chan}, notfound,
ypos = channelToYPos[chan];
strandID = channelToStrandID[chan];
color = strandIDToColor[strandID];
Pen Size( pensize );
Pen Color( color );
Line( {xleft, ypos}, {xleft + xstep, ypos} ); // draw uncrossed strand
Fill Color( color );
Circle( {xleft, ypos}, circlesize, "FILL" );
);
xleft += xstep;
)
);
// endcaps, just for pretty
For Each( {chan, ypos}, channelToYPos,
strandID = channelToStrandID[chan];
color = strandIDToColor[strandID];
Fill Color( color );
Circle( {xleft, ypos}, circlesize, "FILL" );
);
);
New Window( "braidtest",
V List Box(
window:gb1 = Graph Box(
X Scale( 0, 12 ),
Y Scale( 0, 6 ),
framesize( 1800, 300 ),
xname( "" ),
yname( "" ),
suppressaxes,
<<BACKGROUNDCOLOR></BACKGROUNDCOLOR>
Die JSL verwendet Kanäle A, B, C, D, E beziehen sich auf die geraden horizontalen Reihen und Stränge 1, 2, 3, 4, 5 beziehen sich auf die fünf bunten Saiten, die zwischen den Kanälen hin und her huschen und über/unter einer anderen Saite verlaufen. Die drei Variationen werden durch ein Muster definiert; der mittlere ist</CODE></P>
<PRE><CODE class=" language-jsl">drawpattern( {{"CB"}, {"AB", "ED"}, {"CD"}}, window:gb2 );
Das bedeutet, dass die Kanäle C und B die Stränge tauschen, wobei der Strang von C über den Strang von B läuft. Dann verläuft Kanal A gleichzeitig über B und Kanal E über D. Zum Schluss tauschen Sie C und D aus, wiederum mit C oben.
Colorful braids. The top one is smoothest.Colorful braids. The top one is smoothest.Colorful braids. The top one is smoothest.Colorful braids. The top one is smoothest.Bunte Zöpfe. Die oberste ist am glattsten.
Wenn Sie den angehängten Code ausführen, ändern Sie AntiAlias = 4 in AntiAlias = 1, um ihn schneller auszuführen, bis Sie qualitativ hochwertige Bilder wünschen.