How can a node remember it's previous position?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
Consider the following MWE:
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at (newnumber,current) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
Here is the output:
My question is: How can the green node remeber it's previous position, so that the desired result looks like a dotted green line?
tikz-pgf nodes code-review remember
add a comment |Â
up vote
4
down vote
favorite
Consider the following MWE:
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at (newnumber,current) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
Here is the output:
My question is: How can the green node remeber it's previous position, so that the desired result looks like a dotted green line?
tikz-pgf nodes code-review remember
1
This is probably suboptimal, but at each iteration you could docoordinate (greennoden) at (newnumber,current);
then put thenode
in aforeach nn in 2,...,n
and usenode [...] at (greennodenn) ;
... It's not remembering its last position, but you are saving every position and drawing them at each iteration.
– Phelype Oleinik
23 mins ago
Nice work, you could have started with a hexagon and stopped like Archimedes with a regular 96 side polygon.
– AndréC
5 mins ago
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Consider the following MWE:
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at (newnumber,current) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
Here is the output:
My question is: How can the green node remeber it's previous position, so that the desired result looks like a dotted green line?
tikz-pgf nodes code-review remember
Consider the following MWE:
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at (newnumber,current) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
Here is the output:
My question is: How can the green node remeber it's previous position, so that the desired result looks like a dotted green line?
tikz-pgf nodes code-review remember
tikz-pgf nodes code-review remember
asked 31 mins ago


current_user
2,6411428
2,6411428
1
This is probably suboptimal, but at each iteration you could docoordinate (greennoden) at (newnumber,current);
then put thenode
in aforeach nn in 2,...,n
and usenode [...] at (greennodenn) ;
... It's not remembering its last position, but you are saving every position and drawing them at each iteration.
– Phelype Oleinik
23 mins ago
Nice work, you could have started with a hexagon and stopped like Archimedes with a regular 96 side polygon.
– AndréC
5 mins ago
add a comment |Â
1
This is probably suboptimal, but at each iteration you could docoordinate (greennoden) at (newnumber,current);
then put thenode
in aforeach nn in 2,...,n
and usenode [...] at (greennodenn) ;
... It's not remembering its last position, but you are saving every position and drawing them at each iteration.
– Phelype Oleinik
23 mins ago
Nice work, you could have started with a hexagon and stopped like Archimedes with a regular 96 side polygon.
– AndréC
5 mins ago
1
1
This is probably suboptimal, but at each iteration you could do
coordinate (greennoden) at (newnumber,current);
then put the node
in a foreach nn in 2,...,n
and use node [...] at (greennodenn) ;
... It's not remembering its last position, but you are saving every position and drawing them at each iteration.– Phelype Oleinik
23 mins ago
This is probably suboptimal, but at each iteration you could do
coordinate (greennoden) at (newnumber,current);
then put the node
in a foreach nn in 2,...,n
and use node [...] at (greennodenn) ;
... It's not remembering its last position, but you are saving every position and drawing them at each iteration.– Phelype Oleinik
23 mins ago
Nice work, you could have started with a hexagon and stopped like Archimedes with a regular 96 side polygon.
– AndréC
5 mins ago
Nice work, you could have started with a hexagon and stopped like Archimedes with a regular 96 side polygon.
– AndréC
5 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
Just build up a list successively.
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
ifnumn=2
xdefLstnewnumber/current
else
xdefLstLst,newnumber/current
fi
foreach X/Y in Lst
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at
(X,Y) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
I was just about to propose an uglier version of this ^^
– BambOo
15 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
Just build up a list successively.
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
ifnumn=2
xdefLstnewnumber/current
else
xdefLstLst,newnumber/current
fi
foreach X/Y in Lst
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at
(X,Y) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
I was just about to propose an uglier version of this ^^
– BambOo
15 mins ago
add a comment |Â
up vote
3
down vote
Just build up a list successively.
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
ifnumn=2
xdefLstnewnumber/current
else
xdefLstLst,newnumber/current
fi
foreach X/Y in Lst
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at
(X,Y) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
I was just about to propose an uglier version of this ^^
– BambOo
15 mins ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
Just build up a list successively.
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
ifnumn=2
xdefLstnewnumber/current
else
xdefLstLst,newnumber/current
fi
foreach X/Y in Lst
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at
(X,Y) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
Just build up a list successively.
documentclass[border=5pt,tikz]standalone
begindocument
foreach n in 2,3,...,20
begintikzpicture
useasboundingbox (-6,-4) rectangle (2,1);
pgfmathsetmacronumber2*n
node at (1.5,.5) $n = pgfmathprintnumbernumber$;
pgfmathsetmacrosamples360/n
pgfmathsetmacrosampleslimit360-samples
pgfmathsetmacropii3.14
pgfmathsetmacrolimit360/samples-1
pgfmathsetmacrocurrent(pii/n)*limit
node[left] at (-1.5,.5) tiny
begintabularlll
$A_mathrmreal$ &=& 3.14 \
$A_mathrmcurrent$ &=& pgfmathprintnumbercurrent
endtabular
;
foreach x in 0,samples,...,sampleslimit
pgfmathsetmacroarcanglesamples/2
fill[red] (x:1) arc(x:x+arcangle:1) -- (0,0) -- cycle;
fill[blue] (x+arcangle:1) arc(x+arcangle:x+2*arcangle:1) -- (0,0) -- cycle;
pgfmathsetmacrolimit360/samples-1
foreach x in 0,1,...,limit
pgfmathsetmacroshiftx*2*sin(samples/4)
pgfmathsetmacrohshiftlimit*sin(samples/4)
fill[xshift=-hshift cm,red,xshift=shift cm,yshift=-1.5cm] (-90-samples/4:1) arc(-90-samples/4:-90+samples/4:1) -- (0,0) -- cycle;
fill[blue,yshift=-1.5cm,xshift=-hshift cm,xshift=shift cm] (-90-samples/4:1) -- (0,0) arc(90-samples/4:90+samples/4:1) -- cycle;
draw[xshift=-6cm,yshift=-4cm,<->] (0,3.5) -- (0,0) -- (4,0);
pgfmathsetmacronewnumbern/5
ifnumn=2
xdefLstnewnumber/current
else
xdefLstLst,newnumber/current
fi
foreach X/Y in Lst
node[xshift=-6cm,yshift=-4cm,fill=green,circle,inner sep=1pt] at
(X,Y) ;
draw[xshift=-6cm,yshift=-4cm,red,dashed] (0,pii) --+ (3.7,0) node[above left] $A_mathrmreal = pi$;
endtikzpicture
enddocument
answered 21 mins ago


marmot
63.8k468137
63.8k468137
I was just about to propose an uglier version of this ^^
– BambOo
15 mins ago
add a comment |Â
I was just about to propose an uglier version of this ^^
– BambOo
15 mins ago
I was just about to propose an uglier version of this ^^
– BambOo
15 mins ago
I was just about to propose an uglier version of this ^^
– BambOo
15 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454378%2fhow-can-a-node-remember-its-previous-position%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
This is probably suboptimal, but at each iteration you could do
coordinate (greennoden) at (newnumber,current);
then put thenode
in aforeach nn in 2,...,n
and usenode [...] at (greennodenn) ;
... It's not remembering its last position, but you are saving every position and drawing them at each iteration.– Phelype Oleinik
23 mins ago
Nice work, you could have started with a hexagon and stopped like Archimedes with a regular 96 side polygon.
– AndréC
5 mins ago