Nephroid from circles animation, mathematical line art, code for the animation. #shorts

Zak's Lab
Zak's Lab
318 بار بازدید - 3 سال پیش - Nephroid from circles animation, mathematical
Nephroid from circles animation, mathematical line art, code for the animation.

We construct a nephroid as the envelope of hundreds of circles, each tangent to a diameter of a large circle, and each with a center located horizontally from the tangent point and with a center on the large circle.  Thus there are two points tracing the curve, and the envelope of the circles forms a nephroid curve, and as a bonus the intersecting circles create a grid that makes the nephroid feel three dimensional.  

Code for the animation is written for wxMaxima, but it is suitable as pseudocode for any similar system.  

wxMaxima code:

kill(all)$
 /*one point travels down a vertical diameter of a circle of radius 3,
the other point is the center of a circle on the larger circle and
tangent to the vertical diameter.  the envelope of the circles forms a nephroid*/

/*note:  animation will have 314 steps to complete as the parameter goes from 0 to 2pi
in increments of .02*/
/*radius of the larger circle*/
R:3$
/*tangent point on the diameter*/
p1(theta):=points([[0,R*cos(theta)]])$
p1x(theta):=0$
p1y(theta):=R*cos(theta)$
/*center of each smaller circle*/
p2(theta):=points([[-R*sin(theta),R*cos(theta)]])$
p2x(theta):=-R*sin(theta)$
p2y(theta):=R*cos(theta)$

/*circle generated by the two points corresponding to angle theta*/
circle(theta):=parametric(p2x(theta)+R*sin(theta)*cos(t),p2y(theta)+R*sin(theta)*sin(t),t,0,2*%pi)$

/*make a list of lists to add to the parametric circles set at each step*/;
innerlist:[]$
circlelist:[]$
for j from 1 thru 628 do(
    innerlist:append(innerlist,
        [circle(.02*j)]
        )
    )$
templist:[]$
for n from 1 thru 628 do(
   
   
        for m from 1 thru n do(
       
        templist:append(templist,
            [innerlist[m]])
        ),
       
    circlelist:append(circlelist,[templist]),
   
    templist:[]
   
    )$  
 wxplot_size:[1000,1000]$  
 wxanimate_framerate:20$  
 rlist:makelist(i,i,1,314)$

 with_slider_draw(  
 r,rlist,  
     
     xrange=[-6.2,6.2],  
     yrange=[-6.2,6.2],  
     xtics=false,
     ytics=false,
   
     nticks=1000,
     color=black,
     line_width=2,
     parametric(R*cos(t),R*sin(t),t,0,2*%pi),
     line_type=dashes,
     parametric(0,t,t,-R,R),
   
     nticks=500,
     color=blue,
     line_width=1,
    line_type=solid,
     circlelist[r],
   
   
     point_type=7,
     point_size=2,
     color=red,
     p1(.02*r),
     p2(.02*r)
   
 );
3 سال پیش در تاریخ 1400/04/21 منتشر شده است.
318 بـار بازدید شده
... بیشتر