Nephroid as an envelope, mathematical line art, code for the animation. #shorts
1.4 هزار بار بازدید -
3 سال پیش
-
Nephroid as an envelope, mathematical
Nephroid as an envelope, mathematical line art, code for the animation.
We plot two points revolving on a circle, with one point moving three times as fast as the slow one. Line segments connecting the points are plotted, and the envelope of these line segments forms a nephroid curve or two cusped hypocycloid.
Code for the nephroid animation is written for wxMaxima, but it is useful as pseudocode for any similar system.
wxMaxima code:
kill(all)$
/*two points traveling on a circle of radius 3, one of the points moving three times as fast*/
p1(t):=points([[3*cos(.04*t),3*sin(.04*t)]])$
p1x(t):=3*cos(.04*t)$
p1y(t):=3*sin(.04*t)$
p2(t):=points([[3*cos(.12*t),3*sin(.12*t)]])$
p2x(t):=3*cos(.12*t)$
p2y(t):=3*sin(.12*t)$
/*line connecting the two points*/
line1(t):=parametric((1-i)*p1x(t)+i*p2x(t),(1-i)*p1y(t)+i*p2y(t),i,0,1)$
/*make a list of lists to add to the parametric set at each step*/;
innerlist:[]$
radiuslist:[]$
for j from 1 thru 160 do(
innerlist:append(innerlist,
[line1(j)]
)
)$
templist:[]$
for n from 1 thru 160 do(
for m from 1 thru n do(
templist:append(templist,
[innerlist[m]])
),
radiuslist:append(radiuslist,[templist]),
templist:[]
)$
wxplot_size:[1000,1000]$
wxanimate_framerate:20$
rlist:makelist(i,i,1,160)$
with_slider_draw(
r,rlist,
nticks=1000,
xrange=[-3.2,3.2],
yrange=[-3.2,3.2],
xtics=false,
ytics=false,
color=black,
color=black,
line_width=2,
parametric(3*cos(t),3*sin(t),t,0,2*%pi),
color=blue,
line_width=2,
radiuslist[r],
point_type=7,
point_size=2,
color=red,
p1(r),
p2(r)
);
We plot two points revolving on a circle, with one point moving three times as fast as the slow one. Line segments connecting the points are plotted, and the envelope of these line segments forms a nephroid curve or two cusped hypocycloid.
Code for the nephroid animation is written for wxMaxima, but it is useful as pseudocode for any similar system.
wxMaxima code:
kill(all)$
/*two points traveling on a circle of radius 3, one of the points moving three times as fast*/
p1(t):=points([[3*cos(.04*t),3*sin(.04*t)]])$
p1x(t):=3*cos(.04*t)$
p1y(t):=3*sin(.04*t)$
p2(t):=points([[3*cos(.12*t),3*sin(.12*t)]])$
p2x(t):=3*cos(.12*t)$
p2y(t):=3*sin(.12*t)$
/*line connecting the two points*/
line1(t):=parametric((1-i)*p1x(t)+i*p2x(t),(1-i)*p1y(t)+i*p2y(t),i,0,1)$
/*make a list of lists to add to the parametric set at each step*/;
innerlist:[]$
radiuslist:[]$
for j from 1 thru 160 do(
innerlist:append(innerlist,
[line1(j)]
)
)$
templist:[]$
for n from 1 thru 160 do(
for m from 1 thru n do(
templist:append(templist,
[innerlist[m]])
),
radiuslist:append(radiuslist,[templist]),
templist:[]
)$
wxplot_size:[1000,1000]$
wxanimate_framerate:20$
rlist:makelist(i,i,1,160)$
with_slider_draw(
r,rlist,
nticks=1000,
xrange=[-3.2,3.2],
yrange=[-3.2,3.2],
xtics=false,
ytics=false,
color=black,
color=black,
line_width=2,
parametric(3*cos(t),3*sin(t),t,0,2*%pi),
color=blue,
line_width=2,
radiuslist[r],
point_type=7,
point_size=2,
color=red,
p1(r),
p2(r)
);
3 سال پیش
در تاریخ 1400/04/16 منتشر شده
است.
1,482
بـار بازدید شده