diff --git a/transfert-temps-min-original.mp4 b/transfert-temps-min-original.mp4 index c46bf2d026ac83e044f9188c9fa18ded9c0e197b..f04d57306b68f1bb46d77a46c489be71e970b77a 100644 Binary files a/transfert-temps-min-original.mp4 and b/transfert-temps-min-original.mp4 differ diff --git a/transfert-temps-min.gif b/transfert-temps-min.gif index 95bb97ce4c5fe3cc8ab80ec5f3793d4b66861685..8d7fcc522183bffa02dfc3ed9e80d125be6b82d0 100644 Binary files a/transfert-temps-min.gif and b/transfert-temps-min.gif differ diff --git a/transfert-temps-min.ipynb b/transfert-temps-min.ipynb index da6c2c94f999fb17c811de47c8d9346debb1930a..9f622f93ea9902b2bb45f060c63e1f907bc2abe1 100644 --- a/transfert-temps-min.ipynb +++ b/transfert-temps-min.ipynb @@ -101,6 +101,7 @@ "metadata": {}, "outputs": [], "source": [ + "rayon_Terre = 6371;\n", "sc_sat = 1000;" ] }, @@ -436,10 +437,10 @@ "# Décor\n", "function background(w, h, xmin, xmax, ymin, ymax, \n", " X1_orb_init, X2_orb_init, X1_orb_arr, X2_orb_arr,\n", - " cx, cy, S, Δx, Δy, cam_x, cam_y, cam_zoom, opi, opf)\n", + " cx, cy, S, Δx, Δy, cam_x, cam_y, cam_zoom, opi, opf, times, time_current)\n", "\n", " # Fond\n", - " px = plot(background_color=:gray16, legend = false, aspect_ratio=:equal, \n", + " px = plot(background_color=:gray8, legend = false, aspect_ratio=:equal, \n", " size = (w, h), framestyle = :none, \n", " left_margin=-25mm, bottom_margin=-10mm, top_margin=-10mm, right_margin=-10mm,\n", " xlims=(xmin, xmax), ylims=(ymin, ymax) #, \n", @@ -468,17 +469,23 @@ " \n", " # Terre\n", " θ = range(0, 2π, 100)\n", - " rT = 6371 #- 1000\n", + " rT = rayon_Terre #- 1000\n", " xT = cx .+ rT .* cos.(θ)\n", " yT = cy .+ rT .* sin.(θ)\n", " nn = length(xT)\n", " plot!(px, xT, yT, color = :dodgerblue1, seriestype=:shape, linewidth=0) \n", " \n", " # Soleil\n", + " i_current = argmin(abs.(times.-time_current))\n", + " e = π/6\n", + " β = range(π/4+e, π/4-e, length(times))\n", + " ρ = sqrt((0.8*xmax-cx)^2+(0.8*ymax-cy)^2)\n", + " cxS = cx + ρ * cos(β[i_current])\n", + " cyS = cy + ρ * sin(β[i_current]) \n", " θ = range(0, 2π, 100)\n", " rS = 2000\n", - " xS = 0.8*xmax .+ rS .* cos.(θ)\n", - " yS = 0.8*ymax .+ rS .* sin.(θ)\n", + " xS = cxS .+ rS .* cos.(θ)\n", + " yS = cyS .+ rS .* sin.(θ)\n", " plot!(px, xS, yS, color = :gold, seriestype=:shape, linewidth=0) \n", " \n", " # Point de départ\n", @@ -572,7 +579,7 @@ " annotationcolor=:white, annotationfontsize=14,\n", " annotationhalign=:left)\n", "\n", - " txt = @sprintf(\"Distance à la Terre [km] = %5.2f\", sqrt(x1[i_current]^2+x2[i_current]^2))\n", + " txt = @sprintf(\"Distance à la Terre [km] = %5.2f\", sqrt(x1[i_current]^2+x2[i_current]^2)-rayon_Terre)\n", " annotate!(px, subplot = subplot_current, a, b, txt, \n", " annotationcolor=:white, annotationfontsize=14,\n", " annotationhalign=:left)\n", @@ -625,6 +632,21 @@ " yT = 0.28 .+ rT .* sin.(θ)\n", " plot!(px, subplot=subplot_current, xT, yT, color = :dodgerblue1, seriestype=:shape, linewidth=0) \n", " \n", + " subplot_current = subplot_current+1\n", + " xx = 0.0\n", + " yy = 0.02\n", + " plot!(px,\n", + " inset = (1, bbox(xx, yy, 0.12, 0.05, :bottom, :right)),\n", + " subplot = subplot_current, \n", + " bg_inside = nothing, legend=:false,\n", + " framestyle=:none\n", + " ) \n", + " \n", + " s1 = \"Réalisation : Olivier Cots (2022)\"\n", + " txt = s1\n", + " annotate!(px, subplot = subplot_current, 0, 0, txt, \n", + " annotationcolor=:gray, annotationfontsize=8, annotationhalign=:left)\n", + " \n", " return subplot_current+1\n", "\n", "end;" @@ -864,7 +886,8 @@ " \n", " px = background(w, h, xmin, xmax, ymin, ymax, \n", " X1_orb_init, X2_orb_init, X1_orb_arr, X2_orb_arr,\n", - " cx, cy, S, Δx, Δy, cam_x, cam_y, cam_zoom, op_initi[i_current], op_final[i_current])\n", + " cx, cy, S, Δx, Δy, cam_x, cam_y, cam_zoom, \n", + " op_initi[i_current], op_final[i_current], times, time_current)\n", "\n", " trajectoire!(px, times, x1, x2, θ, th, time_current, cx, cy, pt) \n", " \n", @@ -879,9 +902,12 @@ " end\n", "\n", " # enregistrement\n", - " gif(anim, \"transfert-temps-min.mp4\", fps=fps);\n", + " nom = \"transfert-temps-min-original.mp4\"\n", + " gif(anim, nom, fps=fps);\n", " gif(anim, \"transfert-temps-min.gif\", fps=fps);\n", "\n", + " #return nom\n", + " \n", "end;" ] }, @@ -1204,7 +1230,7 @@ "metadata": {}, "outputs": [], "source": [ - "#nFrame = 100; fps = 10\n", + "#nFrame = 10; fps = 1\n", "nFrame = 2000; fps = 20\n", "animation(pre_transfert_data, transfert_data, post_transfert_data, nFrame=nFrame, fps=fps)" ] @@ -1215,7 +1241,10 @@ "metadata": {}, "outputs": [], "source": [ - ";ffmpeg -y -i transfert-temps-min.mp4 -vf format=yuv420p transfert-temps-min-encode.mp4" + "convert = `ffmpeg -y -i transfert-temps-min-original.mp4 -vf format=yuv420p transfert-temps-min.mp4`\n", + "if nFrame > 1\n", + " run(convert)\n", + "end" ] }, { diff --git a/transfert-temps-min.mp4 b/transfert-temps-min.mp4 index 16ebbcd1d84dc55fbc7bd8989d6572b43c8af317..4f45ed17def8cdd2dbcd8e7706589b052ef10ecb 100644 Binary files a/transfert-temps-min.mp4 and b/transfert-temps-min.mp4 differ