Wolfram Language

Algebra and Number Theory

Turtle Graphics

AnglePath generates the list of 2D points obtained by specifying consecutive relative displacements from the previous point. This list corresponds to the turtle graphics path of the Logo programming language.

Generate a simple turtle graphic.

In[1]:=
Click for copyable input
Graphics[Line[AnglePath[ConstantArray[110 \[Degree], 100]]]]
Out[1]=

Generate a Koch snowflake curve.

In[2]:=
Click for copyable input
Graphics[Line[AnglePath[Array[ThueMorse, 4096] 2 Pi/3]]]
Out[2]=

Generate a dragon curve.

In[3]:=
Click for copyable input
Graphics[Line[ AnglePath[{90 \[Degree], -90 \[Degree]}[[ 1 + Nest[Join[#, {0}, Reverse[1 - #]] &, {0}, 10]]]]]]
Out[3]=

Generate another interesting curve.

In[4]:=
Click for copyable input
Graphics[Line[AnglePath[N@Range[100000]]]]
Out[4]=

Related Examples

de es fr ja ko pt-br ru zh