User:Brian Schott/code/turtleGraphics/3Dogl

From J Wiki
Jump to: navigation, search

Download the script here: File:Tgsj3ogl.ijs
A contra dancing specialization of the above script is also under development. The contra dancing script requires the main script, also.
Download contra dancers script here: File:Dancersogl.ijs


10 contra dancers and some paths. This screen shot image portrays

(1) 10 dancers drawn in their final static positions at the end of the simulation only, and
(2) 4 dancer's partial paths (drawn as line segments: 2 paths are drawn in black; 2 are in yellow) showing continuous, cumulative movement for 4 select dancers during select moves described in the text.

Tgsjcontra.jpg This is a description of a graphic simulation of 10 contra dancers as performed using the programming language J using the program script "dancersogl.ijs". By default when the script is launched, 10 dancers are created -- 5 couples -- all facing to the left on the screen, with even-numbered men in one long line and odd-numbered women in the other long line. (Recall that the screen shot image above does NOT show the dancers in this initial position, though.) All the dancers are facing the imaginary caller and band "up the hall" in "a contra set" waiting to be told how to further arrange themselves in their groups of 4 called duples -- more precisely, duple minor sets. Initially the dancers are further arranged in groups of four by "dancersogl.ijs" as shown in the boxed arrays. The fifth couple, dancers 8 and 9, are temporarily unmatched. (Normally there are more than 5 couples in a contra set: more like 16 couples.)

   load '/Users/brian/j601/addons/turtle/dancersogl.ijs'
Look for examples near the beginning of the script.
type "help" for a very little
+---+---+-+
|1 3|5 7|9|
|0 2|4 6|8|
+---+---+-+


Simulating the caller's call "Take hands four and Ones cross over", is the command "hands4cross 10". By comparing the numbers in the new output arrangement to the old arrangement you will notice that the first couple in each pair of couples have exchanged places relative to their original positions above. Unobservable here, but plain from the associated graphics screen, the dancers are now facing up and down the set in their own duple minor set. This starting arrangement for a contra dance is called "improper" and is the most common; other arrangements are "proper" which is uncommon, and "becket" which is growing in popularity. The number 10 indicates that the command can be used to create exactly 10 dancers in the desired arrangement.

   hands4cross 10
+---+---+-+
|0 3|4 7|9|
|1 2|5 6|8|
+---+---+-+


The first command instructs the graphics system to show the bread crumb path taken by dancers 0 and 1. The second command requests that the dancers pass one another by their right shoulders along the long lines. However the script refuses this command because, contrary to my description above, the dancers are not really facing one another up and down the long lines. Rather the dancers are facing diagonally into their duple's center, waiting for the caller to give further instructions.

   pendown 0 1
+--------+---------------------+
|Penstate|1 1 0 0 0 0 0 0 0 0 0|
+--------+---------------------+
   passThrough Along
Dancers passing through must be facing


An instruction to dancers get them oriented correctly. The "Heading" output is not important, but if you are interested, the rows refer to the 10 dancers and an 11th imaginary dancer whose space was originally used to store information on the viewing eye. The three columns are the x- , y- , and z-axis orientation of each dancer after they face their Neighbors. The important column is the middle one which shows the different facing orientations.

   face Neighbors
+-------+----------------+
|Heading|_90  90 _89.9997|
|       |_90  90 _89.9997|
|       |_90 _90 _90.0003|
|       |_90 _90 _90.0003|
|       |_90  90 _89.9997|
|       |_90  90 _89.9997|
|       |_90 _90 _90.0003|
|       |_90 _90 _90.0003|
|       |_90 _74      _90|
|       |_90 _72      _90|
|       |  0   0      _90|
+-------+----------------+


The two leftmost black lines in the shape of an inverted V show the paths taken by the first couple for the "passThrough Along". These paths show how the couples passThrough passing right shoulders with their facing Neighbor. As the boxes just below suggest, passing through produces new foursomes and the couple comprised of dancers 2 and 3 are temporarily out of the set and are called Neutrals. In addition this Neutral couple has reversed positions with one another in order to prepare themselves for reentering the set in the next progression (or "change").

   passThrough Along
+-+---+---+
|2|0 7|4 9|
|3|1 6|5 8|
+-+---+---+


Next Neighbors swing 1.5 revolutions and end up facing across the set. The square shaped paths show very crudely the swing of male 0 and female 1 who are swinging with their respective Neighbors. In fact the path should be much more circular with smaller radius. The boxes just below show that the positions of the dancers in the foursomes are shuffled in identical patterns from foursome to foursome. This constancy is standard in contra dancing. But for example dancers 0 and 1 remain partners throughout a dance, but their Neighbors change from progression to progression. Their Neighbors at first were dancers 2 and 3, and now are 6 and 7.

   1.5 swing Neighbors
+-+---+---+
|2|7 0|9 4|
|3|6 1|8 5|
+-+---+---+


Changing the dancers whose paths will show will make the result easier to view.

   penup 0 1
+--------+---------------------+
|Penstate|0 0 0 0 0 0 0 0 0 0 0|
+--------+---------------------+
   pendown 8 9
+--------+---------------------+
|Penstate|0 0 0 0 0 0 0 0 1 1 0|
+--------+---------------------+


The yellow paths show a single couple's (dancers 8 and 9) movement for a "Half hey" which is one of the more complex moves made in contra dancing. A hey is a zig-zagging or figure 8 move across the set. Looking at the boxes just below relative to the previous boxes above, you can see that the result of this "Half hey" moves couples across the set from their previous position. Furthermore, because the women started this hey and the men followed them, they end slightly asymmetrically: women are facing one another in their Foursome, while men are facing away from one another. Typically this anomalous arrangement will be fixed with the next called move. Looking more carefully at the graphical output you can see that Foursomes share a single color, that women are wearing skirts, and that some of the couples have dark skin color while other couples have light skin color. Dark skin color is for couples progressing down the set (called "Ones" or "Actives" and light skin color is for couples progressing up the set (called "Twos" or "Inactives").

   Half hey Men ,:&, Women
+-+---+---+
|2|1 6|5 8|
|3|0 7|4 9|
+-+---+---+


The mysterious part of the last instruction was "Men ,:&, Women". As shown just below, this J phrase arranges the Men in the first row of an array and the women in the second row, in couples. This works for this hey because couples are across from one another both before and after the "Half hey".

    Men ,:&, Women
0 4 6 8
1 5 7 9


This should give you a taste of the script "dancersogl.ijs", and may even suggest a tiny bit about contra dancing. But of course this is nothing like live dancing. If you get a chance try contra dancing in your locality. You will not need to bring a partner because the tradition is to dance with a different partner each dance. Almost all dance groups have a training session for 30 minutes before the scheduled dance, and you will get plenty from that training to enjoy yourself and to be enjoyed; groups are all looking for new dancers.