.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Math::PlanePath::TerdragonCurve 3pm" .TH Math::PlanePath::TerdragonCurve 3pm "2014-09-01" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::PlanePath::TerdragonCurve \-\- triangular dragon curve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Math::PlanePath::TerdragonCurve; \& my $path = Math::PlanePath::TerdragonCurve\->new; \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the terdragon curve by Davis and Knuth, .IX Xref "Davis Knuth, Donald" .Sp .RS 4 Chandler Davis and Donald Knuth, \*(L"Number Representations and Dragon Curves \&\*(-- I\*(R", Journal Recreational Mathematics, volume 3, number 2 (April 1970), pages 66\-81 and \*(L"Number Representations and Dragon Curves \*(-- \s-1II\*(R",\s0 volume 3, number 3 (July 1970), pages 133\-149. .Sp Reprinted with addendum in Knuth \*(L"Selected Papers on Fun and Games\*(R", 2010, pages 571\-\-614. .RE .PP Points are a triangular grid using every second integer X,Y as per \&\*(L"Triangular Lattice\*(R" in Math::PlanePath, beginning .PP .Vb 10 \& \e / \e \& \-\-\- 26,29,32 \-\-\-\-\-\-\-\-\-\- 27 6 \& / \e \& \e / \e \& \-\- 24,33,42 \-\-\-\-\-\-\-\-\-\- 22,25 5 \& / \e / \e \& \e / \e \& \-\-\- 20,23,44 \-\-\-\-\-\-\-\- 12,21 10 4 \& / \e / \e / \e \& \e / \e / \e / \e \& 18,45 \-\-\-\-\-\-\-\-\- 13,16,19 \-\-\-\-\-\- 8,11,14 \-\-\-\-\-\-\-\- 9 3 \& \e / \e / \e \& \e / \e / \e \& 17 6,15 \-\-\-\-\-\-\-\-\- 4,7 2 \& \e / \e \& \e / \e \& 2,5 \-\-\-\-\-\-\-\-\-\- 3 1 \& \e \& \e \& 0 \-\-\-\-\-\-\-\-\-\-\- 1 <\-Y=0 \& \& ^ ^ ^ ^ ^ ^ ^ \& \-3 \-2 \-1 X=0 1 2 3 .Ve .PP The base figure is an \*(L"S\*(R" shape .PP .Vb 4 \& 2\-\-\-\-\-3 \& \e \& \e \& 0\-\-\-\-\-1 .Ve .PP which then repeats in self-similar style, so N=3 to N=6 is a copy rotated +120 degrees, which is the angle of the N=1 to N=2 edge, .PP .Vb 7 \& 6 4 base figure repeats \& \e / \e as N=3 to N=6, \& \e/ \e rotated +120 degrees \& 5 2\-\-\-\-3 \& \e \& \e \& 0\-\-\-\-\-1 .Ve .PP Then N=6 to N=9 is a plain horizontal, which is the angle of N=2 to N=3, .PP .Vb 10 \& 8\-\-\-\-\-9 base figure repeats \& \e as N=6 to N=9, \& \e no rotation \& 6\-\-\-\-7,4 \& \e / \e \& \e / \e \& 5,2\-\-\-\-3 \& \e \& \e \& 0\-\-\-\-\-1 .Ve .PP Notice X=1,Y=1 is visited twice as N=2 and N=5. Similarly X=2,Y=2 as N=4 and N=7. Each point can repeat up to 3 times. \*(L"Inner\*(R" points are 3 times and on the edges up to 2 times. The first tripled point is X=1,Y=3 which as shown above is N=8, N=11 and N=14. .PP The curve never crosses itself. The vertices touch as triangular corners and no edges repeat. .PP The curve turns are the same as the \f(CW\*(C`GosperSide\*(C'\fR, but here the turns are by 120 degrees each whereas \f(CW\*(C`GosperSide\*(C'\fR is 60 degrees each. The extra angle here tightens up the shape. .SS "Spiralling" .IX Subsection "Spiralling" The first step N=1 is to the right along the X axis and the path then slowly spirals anti-clockwise and progressively fatter. The end of each replication is .PP .Vb 1 \& Nlevel = 3^level .Ve .PP That point is at level*30 degrees around (as reckoned with Y*\fIsqrt\fR\|(3) for a triangular grid). .PP .Vb 9 \& Nlevel X, Y Angle (degrees) \& \-\-\-\-\-\- \-\-\-\-\-\-\- \-\-\-\-\- \& 1 1, 0 0 \& 3 3, 1 30 \& 9 3, 3 60 \& 27 0, 6 90 \& 81 \-9, 9 120 \& 243 \-27, 9 150 \& 729 \-54, 0 180 .Ve .PP The following is points N=0 to N=3^6=729 going half-circle around to 180 degrees. The N=0 origin is marked \*(L"0\*(R" and the N=729 end is marked \*(L"E\*(R". .PP .Vb 10 \& * * * * \& * * * * * * * * \& * * * * * * * * \& * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * \& * E * * * * * * * * * * * * * * * * 0 * \& * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * * * * * * \& * * * * * * * * * * * * * * \& * * * * * * * * \& * * * * * * * * \& * * * * .Ve .SS "Tiling" .IX Subsection "Tiling" The little \*(L"S\*(R" shapes of the base figure N=0 to N=3 can be thought of as a rhombus .PP .Vb 4 \& 2\-\-\-\-\-3 \& . . \& . . \& 0\-\-\-\-\-1 .Ve .PP The \*(L"S\*(R" shapes of each 3 points make a tiling of the plane with those rhombi .PP .Vb 10 \& \e \e / / \e \e / / \& *\-\-\-\-\-*\-\-\-\-\-* *\-\-\-\-\-*\-\-\-\-\-* \& / / \e \e / / \e \e \& \e / / \e \e / / \e \e / \& \-\-*\-\-\-\-\-* *\-\-\-\-\-*\-\-\-\-\-* *\-\-\-\-\-*\-\- \& / \e \e / / \e \e / / \e \& \e \e / / \e \e / / \& *\-\-\-\-\-*\-\-\-\-\-* *\-\-\-\-\-*\-\-\-\-\-* \& / / \e \e / / \e \e \& \e / / \e \e / / \e \e / \& \-\-*\-\-\-\-\-* *\-\-\-\-\-o\-\-\-\-\-* *\-\-\-\-\-*\-\- \& / \e \e / / \e \e / / \e \& \e \e / / \e \e / / \& *\-\-\-\-\-*\-\-\-\-\-* *\-\-\-\-\-*\-\-\-\-\-* \& / / \e \e / / \e \e .Ve .PP Which is an ancient pattern, .Sp .RS 4 .RE .SS "Arms" .IX Subsection "Arms" The curve fills a sixth of the plane and six copies rotated by 60, 120, 180, 240 and 300 degrees mesh together perfectly. The \f(CW\*(C`arms\*(C'\fR parameter can choose 1 to 6 such curve arms successively advancing. .PP For example \f(CW\*(C`arms => 6\*(C'\fR begins as follows. N=0,6,12,18,etc is the first arm (the same shape as the plain curve above), then N=1,7,13,19 the second, N=2,8,14,20 the third, etc. .PP .Vb 10 \& \e / \e / \& \e / \e / \& \-\-\- 8/13/31 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- 7/12/30 \-\-\- \& / \e / \e \& \e / \e / \e / \& \e / \e / \e / \& \-\-\- 9/14/32 \-\-\-\-\-\-\-\-\-\-\-\-\- 0/1/2/3/4/5 \-\-\-\-\-\-\-\-\-\-\-\-\-\- 6/17/35 \-\-\- \& / \e / \e / \e \& / \e / \e / \e \& \e / \e / \& \-\-\- 10/15/33 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- 11/16/34 \-\-\- \& / \e / \e \& / \e / \e .Ve .PP With six arms every X,Y point is visited three times, except the origin 0,0 where all six begin. Every edge between points is traversed once. .SH "FUNCTIONS" .IX Header "FUNCTIONS" See \*(L"\s-1FUNCTIONS\*(R"\s0 in Math::PlanePath for behaviour common to all path classes. .ie n .IP """$path = Math::PlanePath::TerdragonCurve\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::TerdragonCurve\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::TerdragonCurve->new ()" .PD 0 .ie n .IP """$path = Math::PlanePath::TerdragonCurve\->new (arms => 6)""" 4 .el .IP "\f(CW$path = Math::PlanePath::TerdragonCurve\->new (arms => 6)\fR" 4 .IX Item "$path = Math::PlanePath::TerdragonCurve->new (arms => 6)" .PD Create and return a new path object. .Sp The optional \f(CW\*(C`arms\*(C'\fR parameter can make 1 to 6 copies of the curve, each arm successively advancing. .ie n .IP """($x,$y) = $path\->n_to_xy ($n)""" 4 .el .IP "\f(CW($x,$y) = $path\->n_to_xy ($n)\fR" 4 .IX Item "($x,$y) = $path->n_to_xy ($n)" Return the X,Y coordinates of point number \f(CW$n\fR on the path. Points begin at 0 and if \f(CW\*(C`$n < 0\*(C'\fR then the return is an empty list. .Sp Fractional positions give an X,Y position along a straight line between the integer positions. .ie n .IP """$n = $path\->xy_to_n ($x,$y)""" 4 .el .IP "\f(CW$n = $path\->xy_to_n ($x,$y)\fR" 4 .IX Item "$n = $path->xy_to_n ($x,$y)" Return the point number for coordinates \f(CW\*(C`$x,$y\*(C'\fR. If there's nothing at \&\f(CW\*(C`$x,$y\*(C'\fR then return \f(CW\*(C`undef\*(C'\fR. .Sp The curve can visit an \f(CW\*(C`$x,$y\*(C'\fR up to three times. \f(CW\*(C`xy_to_n()\*(C'\fR returns the smallest of the these N values. .ie n .IP """@n_list = $path\->xy_to_n_list ($x,$y)""" 4 .el .IP "\f(CW@n_list = $path\->xy_to_n_list ($x,$y)\fR" 4 .IX Item "@n_list = $path->xy_to_n_list ($x,$y)" Return a list of N point numbers for coordinates \f(CW\*(C`$x,$y\*(C'\fR. There can be none, one, two or three N's for a given \f(CW\*(C`$x,$y\*(C'\fR. .SS "Descriptive Methods" .IX Subsection "Descriptive Methods" .ie n .IP """$n = $path\->n_start()""" 4 .el .IP "\f(CW$n = $path\->n_start()\fR" 4 .IX Item "$n = $path->n_start()" Return 0, the first N in the path. .ie n .IP """$dx = $path\->dx_minimum()""" 4 .el .IP "\f(CW$dx = $path\->dx_minimum()\fR" 4 .IX Item "$dx = $path->dx_minimum()" .PD 0 .ie n .IP """$dx = $path\->dx_maximum()""" 4 .el .IP "\f(CW$dx = $path\->dx_maximum()\fR" 4 .IX Item "$dx = $path->dx_maximum()" .ie n .IP """$dy = $path\->dy_minimum()""" 4 .el .IP "\f(CW$dy = $path\->dy_minimum()\fR" 4 .IX Item "$dy = $path->dy_minimum()" .ie n .IP """$dy = $path\->dy_maximum()""" 4 .el .IP "\f(CW$dy = $path\->dy_maximum()\fR" 4 .IX Item "$dy = $path->dy_maximum()" .PD The dX,dY values on the first arm take three possible combinations, being 120 degree angles. .Sp .Vb 5 \& dX,dY for arms=1 \& \-\-\-\-\- \& 2, 0 dX minimum = \-1, maximum = +2 \& \-1, 1 dY minimum = \-1, maximum = +1 \& 1,\-1 .Ve .Sp For 2 or more arms the second arm is rotated by 60 degrees so giving the following additional combinations, for a total six. This changes the dX minimum. .Sp .Vb 5 \& dX,dY for arms=2 or more \& \-\-\-\-\- \& \-2, 0 dX minimum = \-2, maximum = +2 \& 1, 1 dY minimum = \-1, maximum = +1 \& \-1,\-1 .Ve .SS "Level Methods" .IX Subsection "Level Methods" .ie n .IP """($n_lo, $n_hi) = $path\->level_to_n_range($level)""" 4 .el .IP "\f(CW($n_lo, $n_hi) = $path\->level_to_n_range($level)\fR" 4 .IX Item "($n_lo, $n_hi) = $path->level_to_n_range($level)" Return \f(CW\*(C`(0, 3**$level)\*(C'\fR, or for multiple arms return \f(CW\*(C`(0, $arms * 3**$level + ($arms\-1))\*(C'\fR. .Sp There are 3^level segments in a curve level, so 3^level+1 points numbered from 0. For multiple arms there are arms*(3^level+1) points, numbered from 0 so n_hi = arms*(3^level+1)\-1. .SH "FORMULAS" .IX Header "FORMULAS" Various formulas for boundary length and area can be found in the author's mathematical write-up .Sp .RS 4 .RE .SS "N to X,Y" .IX Subsection "N to X,Y" There's no reversals or reflections in the curve so \f(CW\*(C`n_to_xy()\*(C'\fR can take the digits of N either low to high or high to low and apply what is effectively powers of the N=3 position. The current code goes low to high using i,j,k coordinates as described in \*(L"Triangular Calculations\*(R" in Math::PlanePath. .PP .Vb 3 \& si = 1 # position of endpoint N=3^level \& sj = 0 # where level=number of digits processed \& sk = 0 \& \& i = 0 # position of N for digits so far processed \& j = 0 \& k = 0 \& \& loop base 3 digits of N low to high \& if digit == 0 \& i,j,k no change \& if digit == 1 \& (i,j,k) = (si\-j, sj\-k, sk+i) # rotate +120, add si,sj,sk \& if digit == 2 \& i \-= sk # add (si,sj,sk) rotated +60 \& j += si \& k += sj \& \& (si,sj,sk) = (si \- sk, # add rotated +60 \& sj + si, \& sk + sj) .Ve .PP The digit handling is a combination of rotate and offset, .PP .Vb 2 \& digit==1 digit 2 \& rotate and offset offset at si,sj,sk rotated \& \& ^ 2\-\-\-\-\-\-> \& \e \& \e \e \& *\-\-\- \-\-1 *\-\- \-\-* .Ve .PP The calculation can also be thought of in term of w=1/2+I*\fIsqrt\fR\|(3)/2, a complex number sixth root of unity. i is the real part, j in the w direction (60 degrees), and k in the w^2 direction (120 degrees). si,sj,sk increase as if multiplied by w+1. .SS "Turn" .IX Subsection "Turn" At each point N the curve always turns 120 degrees either to the left or right, it never goes straight ahead. If N is written in ternary then the lowest non-zero digit gives the turn .PP .Vb 5 \& ternary lowest \& non\-zero digit turn \& \-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\- \& 1 left \& 2 right .Ve .PP At N=3^level or N=2*3^level the turn follows the shape at that 1 or 2 point. The first and last unit step in each level are in the same direction, so the next level shape gives the turn. .PP .Vb 4 \& 2*3^k\-\-\-\-\-\-\-3*3^k \& \e \& \e \& 0\-\-\-\-\-\-\-1*3^k .Ve .SS "Next Turn" .IX Subsection "Next Turn" The next turn, ie. the turn at position N+1, can be calculated from the ternary digits of N similarly. The lowest non\-2 digit gives the turn. .PP .Vb 5 \& ternary lowest \& non\-2 digit turn \& \-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\- \& 0 left \& 1 right .Ve .PP If N is all 2s then the lowest non\-2 is taken to be a 0 above the high end. For example N=8 is 22 ternary so considered 022 for lowest non\-2 digit=0 and turn left after the segment at N=8, ie. at point N=9 turn left. .PP This rule works for the same reason as the plain turn above. The next turn of N is the plain turn of N+1 and adding +1 turns trailing 2s into trailing 0s and increments the 0 or 1 digit above them to be 1 or 2. .SS "Total Turn" .IX Subsection "Total Turn" The direction at N, ie. the total cumulative turn, is given by the number of 1 digits when N is written in ternary, .PP .Vb 1 \& direction = (count 1s in ternary N) * 120 degrees .Ve .PP For example N=12 is ternary 110 which has two 1s so the cumulative turn at that point is 2*120=240 degrees, ie. the segment N=16 to N=17 is at angle 240. .PP The segments for digit 0 or 2 are in the \*(L"current\*(R" direction unchanged. The segment for digit 1 is rotated +120 degrees. .SS "X,Y to N" .IX Subsection "X,Y to N" The current code applies \f(CW\*(C`TerdragonMidpoint\*(C'\fR \f(CW\*(C`xy_to_n()\*(C'\fR to calculate six candidate N from the six edges around a point. Those N values which convert back to the target X,Y by \f(CW\*(C`n_to_xy()\*(C'\fR are the results for \&\f(CW\*(C`xy_to_n_list()\*(C'\fR. .PP The six edges are three going towards the point and three going away. The midpoint calculation gives N\-1 for the towards and N for the away. Is there a good way to tell which edge will be the smaller? Or just which 3 edges lead away? It would be directions 0,2,4 for the even arms and 1,3,5 for the odd ones, but identifying the boundaries of those arms to know which is which is difficult. .SS "X,Y Visited" .IX Subsection "X,Y Visited" When arms=6 all \*(L"even\*(R" points of the plane are visited. As per the triangular representation of X,Y this means .PP .Vb 1 \& X+Y mod 2 == 0 "even" points .Ve .SH "OEIS" .IX Header "OEIS" The terdragon is in Sloane's Online Encyclopedia of Integer Sequences as, .Sp .RS 4 (etc) .RE .PP .Vb 2 \& A080846 next turn 0=left,1=right, by 120 degrees \& (n=0 is turn at N=1) \& \& A060236 turn 1=left,2=right, by 120 degrees \& (lowest non\-zero ternary digit) \& A137893 turn 1=left,0=right (morphism) \& A189640 turn 0=left,1=right (morphism, extra initial 0) \& A189673 turn 1=left,0=right (morphism, extra initial 0) \& A038502 strip trailing ternary 0s, \& taken mod 3 is turn 1=left,2=right .Ve .PP A189673 and A026179 start with extra initial values arising from their morphism definition. That can be skipped to consider the turns starting with a left turn at N=1. .PP .Vb 4 \& A026225 N positions of left turns, \& being (3*i+1)*3^j so lowest non\-zero digit is a 1 \& A026179 N positions of right turns (except initial 1) \& A060032 bignum turns 1=left,2=right to 3^level \& \& A062756 total turn, count ternary 1s \& A005823 N positions where total turn == 0, ternary no 1s \& \& A111286 boundary length, N=0 to N=3^k, skip initial 1 \& A003945 boundary/2 \& A002023 boundary odd levels N=0 to N=3^(2k+1), \& or even levels one side N=0 to N=3^(2k), \& being 6*4^k \& A164346 boundary even levels N=0 to N=3^(2k), \& or one side, odd levels, N=0 to N=3^(2k+1), \& being 3*4^k \& A042950 V[k] boundary length \& \& A056182 area enclosed N=0 to N=3^k, being 2*(3^k\-2^k) \& A081956 same \& A118004 1/2 area N=0 to N=3^(2k+1), odd levels, 9^n\-4^n \& A155559 join area, being 0 then 2^k \& \& A092236 count East segments N=0 to N=3^k \& A135254 count North\-West segments N=0 to N=3^k, extra 0 \& A133474 count South\-West segments N=0 to N=3^k \& A057083 count segments diff from 3^(k\-1) \& \& A057682 level X, at N=3^level \& also arms=2 level Y, at N=2*3^level \& A057083 level Y, at N=3^level \& also arms=6 level X at N=6*3^level \& \& A057681 arms=2 level X, at N=2*3^level \& also arms=3 level Y at 3*3^level \& A103312 same .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::TerdragonRounded, Math::PlanePath::TerdragonMidpoint, Math::PlanePath::GosperSide .PP Math::PlanePath::DragonCurve, Math::PlanePath::R5DragonCurve .PP Larry Riddle's Terdragon page, for boundary and area calculations of the terdragon as an infinite fractal .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014 Kevin Ryde .PP This file is part of Math-PlanePath. .PP Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Math-PlanePath is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Math-PlanePath. If not, see .