Загрузка данных


restart;
with(plots);
with(plottools);
colors := ["Red", "Orange", "Yellow", "Green", "Cyan", "Blue", "Violet", "Magenta"];
frames := [];
for frame from 0 to 29 do
    phase := (2*frame*Pi)/29;
    t := frame/29;
    R_anim := 1.5 + 0.3*sin(phase);
    r_anim := 0.5 + 0.1*sin(2*phase);
    pts := [];
    for i from 0 to 24 do
        u := 2*i/24*Pi;
        for j from 0 to 19 do
            v := 2*j/19*Pi;
            x := (R_anim + r_anim*cos(v))*cos(u);
            y := (R_anim + r_anim*cos(v))*sin(u);
            z := r_anim*sin(v) + 0.2*sin(3*u + phase)*sin(4*v + phase);
            pts := [op(pts), [x, y, z]];
        end do;
    end do;
    col_idx := 1 + irem(frame, 8);
    col := colors[col_idx];
    torus_pts := pointplot3d(pts, style = point, symbol = box, color = col);
    spiral_pts := [];
    for i from 0 to 30 do
        s := i/30;
        x := cos(2*s*(3 + sin(phase))*Pi)*(1 + 0.2*sin(2*phase));
        y := sin(2*s*(3 + sin(phase))*Pi)*(1 + 0.2*sin(2*phase));
        z := (s - 0.5)*1.4;
        spiral_pts := [op(spiral_pts), [x, y, z]];
    end do;
    spiral_col_idx := 1 + irem(frame + 4, 8);
    spiral_line := plot3d(spiral_pts, style = line, color = colors[spiral_col_idx]);
    scene := display([torus_pts, spiral_line], scaling = constrained, axes = none, orientation = [45 + 3*frame, 35 + 15*sin(phase)]);
    frames := [op(frames), scene];
end do;
display(frames, insequence = true);