Wednesday, July 19, 2023

A STEM Project: The Beauty of Coding Snowflakes In TurtleStitch

The ideas for coding in TurtleStitch come from the nature around us. In this multidisciplinary blog posting, I will explore the science, literature and mathematics of snowflakes and the different methods of coding snowflakes in TurtleStitch.

 Snowflakes are a thing of beauty and wonder.

Imagine walking through a forest on a cold winter day with snowflakes falling from the sky.  There are hundreds of millions of them falling gently to the ground. You reach out and touch one with your gloved hand and there lies a perfect snowflake in all of its wonder.  But wait, the next snowflake looks just as beautiful and unique as the last.  How can this be?  How can each snowflake be more beautiful and different than the last? 


Looking closely at the structure of a snowflake, you will see that each snowflake almost always has six points. (Occasionally, there is an anomaly and it is only three points.) Why is this true you may ask?  The answer is in the structure of the water molecule.  Water is made up of two hydrogen atoms and one oxygen atoms, H₂O. Each snowflakes is made up of billions of water molecules and at the core, are water molecules that are “holding hands”.  These water molecules, at the center, create the six point structure or hexagonal shape.  Atmospheric conditions such as temperature and humidity change the structure of the forming snowflake but the core shape always remains the same.

An interesting book about snowflakes is Snowflake Bentley, https://www.youtube.com/watch?v=rtyLpo3cWic, by Jacqueline Briggs Martin. This book depicts the true story of child named Wilson Bentley, who was fascinated with snowflakes. Bentley's enthusiasm was misunderstood at the time. He started his passion for snowflakes by drawing them.  When he was seventeen, his parents gifted him a microscopic camera to photograph the snowflakes to document the uniqueness of the snowflake shapes.



 Bentley’s Photographs of Snowflakes


In 1885, he photographed the first snowflake in Jericho, Vermont.  He went on to photograph and publish a book about snowflakes. Wilson Bentley, a self-taught scientist, was the first person to claim that no two snowflakes are alike.


The TurtleStitch Snowflake

Your mission is to create snowflakes using TurtleStitch. Start with making a six spoke structure. A spoke is just a straight line.

Here are two ways to make a spoke. It doesn’t matter which one that you choose.


Notice that the turtle is pointing in two different directions. What will that do for coding the turtle? The turtle will need to be turned differently.

Coding a Snowflake  

Since a snowflake is a six-sided figure or a hexagon, the next step is to place the spokes evenly in a circle. There are six spokes. We know that a circle is 360 degrees so that we want the turtle to turn 360/6 which is 60 degrees.


Here are two versions of code for a snowflake.  They both produce the snowflake on the right. 


Comparing Coding Techniques


Comparing the snowflake code after one repeat, the turtle is located in different positions.  The red arrow represents the starting point of the turtle.


In the screen capture above, it appears that the turtle moves a greater distance than the code on the right. However the turtle on the left needs to traverse the same line to get back to center.

The screen capture above, the turtle has already traversed the same line twice and is positioned to move.The distance travelled in both cases will be the same after six repeats.


Another difference is the turtle travels in a clockwise motion in the screen capture on the left.  The turtle moves in a counterclockwise motion on the right.


More Comparisons



In this set of blocks, the snowflake is created by the turtle moving 100 steps and then moving a -100 steps to return to the center. Notice that the turtle turns right 60 degrees after drawing a spoke.

In this set of blocks, the turtle is moved 100 steps, turned 180 degrees and then moved 100 steps back to return to the center of the figure.  The turtle is then turned 120 degrees to complete the first spoke of the snowflake structure. Why was 120 degrees used instead of 60 degrees?

image1.jpeg


The answer is the direction in which the turtle is pointing. This is an important concept in TurtleStitch and it is hard to envision without an example like this. The move is different because it is an interior angle. 


In the figure shown, the blue area represents the interior of the hexagon.  The angle y forms a 120 degree angle. The angle x in yellow represents the exterior angle and it forms a 60 degree angle.  


Both sets of codes accomplish the same result. It is interesting to see mathematical concepts come to life with the move of the turtle in TurtleStitch.  


For future reference, to calculate the move for a polygon of n sides, the interior angle formula is:


180 - (360/n)

Adding An Endpoint to the Snowflake Spoke

Here are some versions of adding a square, diamond and circle endpoints to a snowflake. https://www.turtlestitch.org/run#cloud:Username=Elaine&ProjectName=Snowflake%20Spokes

A square was added as an endpoint to this snowflake.  The first turn is only 45 degrees to set the square diamond into position.  The next three turns are 90 degrees to complete the square. There is a 45 degree turn to return to the center of the snowflake. Since the turn is an interior angle move, it is a 120 degree turn to get to the next spoke. Repeat this code 6 times.
A diamond was added as an endpoint to this snowflake.  The first turn is only 30 degrees to set the diamond into position. The next three turns are 60, 120 and then 60 degrees to complete the diamond. There is a 30 degree turn to return to the center of the snowflake. Since the turn is an interior angle move, it is a 120 degree turn to get to the next spoke. Repeat this code 6 times.


Comparing Two Methods Of Adding Circle Endpoints to the Snowflake Spoke 

Both sets of code produce circles at the end of a snowflake spoke but one is easier to code than the other.

This code required calculations to make the circle, center the circle at the end of the spoke and then realign it.

This code is the simplest.  Once the line is drawn, the turtle is coded to move 90 degrees.  This will align the turtle in the correct position.  The Arc block takes care of the alignment calculations.

Here are some snowflakes that were created in TurtleStitch. In each snowflake, a different feature was added with a turn or move.  As in nature, snowflakes can become very complex.
Now take the opportunity to see what type of snowflake you can code.

Making a Snowflake With Branches - A reimagined Markus Gaelli’s snowflake


  • The first move of 10 steps is to move away from the center of the snowflake to eliminate density warnings.

  • Looking at the code, the interior loop of ‘repeat 10' means there are 10 branches on each spoke at a 60 degree angle to the spoke in 50 steps.

  • I did not use a pen up or down when moving the turtle along the branch because I wanted some thread weight to each branch. I turned 180 degrees minus the angle measure to get back to the center of the spoke. 

  • I repeated the 60 degree angle move on the other side of the spoke for each branch and returned back to the center of the spoke. 

  • I moved the turtle 50 steps to the next branch position and repeated the move back and forth across the spoke. 

  • Once the 10 branches were made, the turtle was moved back to the center of the snowflake (0,0).

  • This spoke code was repeated 6 times to complete the snowflake.

  • The overlying branches in the center of the snowflake produce the interesting pattern in the center of the snowflake.


Making a Generalized Snowflake With Branches


This program is exactly the same as the previous program except the numerical values were replaced  with variable names. The variable names were given values in the beginning of the program.  This type of coding makes it easy to change values of different variables without having to change the logic of the code.

 Making a Generalized Snowflake With Randomized Branches


Continuing the quest to code beautiful snowflakes. 

 

  • This program is exactly the same as the previous program except  the variable names were given a range of values with the ‘pick random’ block. This generates random numbers between the numbers that were specified. 

  • Each time the program is run, a different randomized snowflake is created with different number of branches, with different angles at which the pair of branches intersect the main spoke, different branch lengths and different spacing between the branches. 

  • If you like a certain snowflake design, write down the randomized number that created the snowflake to recreate it. Remove the ‘pick random’ block and replace it with the values that you like. The values are shown in the stage area.


Making Nine Generalized Snowflakes With Randomized Branches


Another iteration of the snowflake program. 

  • This program generates nine random snowflakes because there are two nested ‘for’ loops which creates the rows and columns of snowflakes. This ‘for’ loop block is in the ‘drop down’ library.

  • The “for x” value represent the rows and the “for y” value represents the columns.

  • The interior ‘for’ loop is executed first to create one row of snowflakes.

  • The exterior ‘for loop’ is then executed to create one column of snowflakes.

  • The code bounces back and forth between the ‘for’ loops until all the conditions are met.


Embroidering the Snowflake Design

A snowflake ornament was made by coding a satin stitch around the snowflake design and adding a circle as a hanger. Craft felt with tear away stabilizer was used as backing for the design.  Once embroidered, the design was cut about an ⅛ inch from the satin stitch.  It is not recommended to cut any closer to the satin stitch, as a slip of the scissors might cut the satin stitch threads. A bow and a thread hanger were sewn on to complete the snowflake ornament.



Snowflake Ornaments Designed With The Randomly Generated Code

Sunday, July 16, 2023

A STEM Project: Making a 3-D Paper Model of Sierpinski's Triangle and Programming Sierpinski's Triangle in TurtleStitch

A 3-D Paper Model of Sierpinski's Triangle


Sierpinski's Triangle is a fascinating structure whereby an equilateral triangle is reduced in size by one half to produce a smaller equilateral triangle. 

Starting with an equilateral triangle, divide this into four smaller equilateral triangles using the midpoints of the three sides of the original triangle as the new vertices. Remove the center triangle. You now have three equilateral triangles within the original equilateral triangle.

By repeating the process of dividing the equilateral triangle and removing the center,  the progression will look as above after three divisions or stage 3. This division is a fractal which is self-similar, the small parts are copies of the whole.

 Stage 3 Sierpinski's Triangle

My 3-D representation of Sierpinski's Triangle is created by taping 64 equilateral triangle together.  My equilateral triangle net does not require any tape as there are tabs which keep the triangular net together. 

Here is the PDF. I used 65 lb. cardstock.

Here is the .Studio file for Silhouette Cameo users.

Here is the file as an SVG for Cricut or another paper cutting machine. 

Constructing the 3-D Sierpinski Triangle Model


The equilateral triangle net is folded to create a triangular pyramid. The net is held together by three tabs which are inserted into their corresponding slots. Make 64 triangular pyramids.


 Tape four of the triangular pyramids together to form a Stage one Sierpinski triangle. Shown in the photo above on the right side.


Four of Stage one Sierpinski triangles are needed to make a Stage two Sierpinkski Triangle. In the photo above, four Stage two Sierpinski triangles were made.


By arranging these four Stage two Sierpinski triangles, a Stage three Sierpinski triangle is created.

In the following program in TurtleStitch, I programmed Sierpinski 's triangle to the sixth stage.  https://www.turtlestitch.org/run#cloud:Username=Elaine&ProjectName=Sierpinski%20Triangle%20Progression%20To%20Sixth%20Stage

Sixth Stage Progression Created in TurtleStitch 

To find out the stage of Sierpinski's triangle, count the number of different sized triangles.  Each different sized triangle represent another stage.

In programming this progression, I tried to create a procedure where the path by which each triangle is drawn, is never retraced. I tried to make the program recursive but I failed to do so without retracing my steps. If you would like to see a recursive version of Sierpinski's triangle, Cynthia Solomon has coded it in this Turtlestitch program, https://www.turtlestitch.org/run#cloud:Username=mqj&ProjectName=%40CynthisSolomonPeanoHilbertDragonBendingTreeFlowsnakeSierpinskiTri%26Curve%20Playground


A reimagined Stage 2 Sierpinski triangle created with pursuit triangles

In the following program in TurtleStitch, I tried to be creative and changed the equilateral triangle into a pursuit triangle which spirals inward. 

Saturday, July 15, 2023

Dress Patterns For An American Girl Bitty Baby Doll And A Little Bitty Baby Doll

 

Dress Patterns For An American Girl Bitty Baby Doll And A Little Bitty Baby Doll 


Please note, these dresses can be hand sewn if you do not have a sewing machine using an 1/8 inch stitch length.


Here is the PDF for the dress pattern. Print out the pattern with your printer.  There is a one inch square for reference if the pattern does not get printed correctly.

Here is the .Studio file for Silhouette Cameo users. Cut the pattern piece with your Silhouette.

Here is the file as an SVG. Cut the pattern piece with your Cricut or other paper cutting machine. The file goes beyond the viewable area.  Zoom out to see the entire file

The directions to make both dresses are similar.  The only difference is the back seam is sewn partially for the Bitty Baby. The Little Bitty Baby's skirt lies flat when open.


1. Cut the dress pattern as described on the pattern pieces. I traced the pattern onto the fabric and then cut the fabric.



2. Sew the bodice together at the top seams. There are two bodices.

3. Place the two bodices together and sew the neck seam.  Sew the two arm hole seams.

 
4.Turn the piece right side out.  This is difficult and should be done very slowly as to not tear the seams.

Once the one side is done.  Turn the other side right side out.

Iron the bodice.

5. Sew the side seam together.

Side seam has been sewn and finger pressed open. Repeat for the other side.

Bodice top is complete

6. Iron the bottom seam of the skirt with a 1/4 inch seam twice and sew the bottom edge.

7. Sew the side seams using the same method as before...iron and then sew for the Little Bitty Baby shown in the bottom photo. (This photo shows the gathered version which is the next step.)

The top photo shows the Bitty Baby version.  The raw edges of the side seam are sewn with a zigzag stitch to prevent fraying.  The seam is sewn from the bottom of the skirt, 2 1/2 inches.  The rest of the skirt remains open for the velcro placement. 


8. Skirt pieces are sewn and gathered to fit the corresponding bodice.

9. Pin the gathered skirt to the front bodice.  I like to hand sew this in place for accuracy.

10. Pin the gathered skirt to the back bodice.  I like to hand sew this in place for accuracy.

11.  Topstitch the bodice seam with the sewing machine.

12.  For the Little Bitty Baby, sew 1/2 inch x 3 1/2 inches velcro to the side seams. The fuzzy velcro is on the left side, on the inside of the left bodice.  The hook velcro is on the right side on the outside of the right bodice.



12.  For the Bitty Baby, cut the fuzzy side of a 3/4 inch x 5 inches velcro in half. Sew this velcro to the inside of the left bodice.


Sew this velcro to the inside of the left bodice.

Sew the 3/4 inch wide piece of velcro to the inside of the right  bodice with half of the velcro hooks exposed.

The overlapping velcro attaches to the other side of the velcro and the back seam is flat.

Little Bitty Baby

Back View

Bitty Baby

Back View with Velcro Showing