diff --git a/2nd_annee_prepa/Maths/DMAvril1er/DM.pdf b/2nd_annee_prepa/Maths/DMAvril1er/DM.pdf index 27fba71..e96e10d 100644 Binary files a/2nd_annee_prepa/Maths/DMAvril1er/DM.pdf and b/2nd_annee_prepa/Maths/DMAvril1er/DM.pdf differ diff --git a/2nd_annee_prepa/TIPE/diapo.pdf b/2nd_annee_prepa/TIPE/diapo.pdf index 296a7a0..6c2b8d6 100644 Binary files a/2nd_annee_prepa/TIPE/diapo.pdf and b/2nd_annee_prepa/TIPE/diapo.pdf differ diff --git a/2nd_annee_prepa/TIPE/diapo.typ b/2nd_annee_prepa/TIPE/diapo.typ index 1655e10..d181e16 100644 --- a/2nd_annee_prepa/TIPE/diapo.typ +++ b/2nd_annee_prepa/TIPE/diapo.typ @@ -5,7 +5,7 @@ #place( dx: -20mm, box(fill: rgb("#171568"), height: 15mm, width: 110%)[ - #place(dx: -5mm, right + horizon, [#h(18mm) Gaspar Daguet, n=°XXXXXXX]) + #place(dx: -5mm, right + horizon, [#h(18mm) Gaspar Daguet, n=°21528]) ], ) ], @@ -15,7 +15,7 @@ #place( dx: -5mm, box(height: 100%, width: 105%)[ - #scale(place(image("./image/methamorphose.jpg")), x: 111%) + #scale(place(image("./image/methamorphose.jpg"), dx: -1mm), x: 111%) #place( dx: -7mm, right + horizon, @@ -63,9 +63,7 @@ + La pseudosphère + La projection - + Projeté des droites - + Non conservation des longueurs - + Conservation des angles + + Projection des droites ] @@ -117,7 +115,7 @@ dy: 6cm, figure( scale(image("./image/pringels.png"), x: 80%, y: 80%), - caption: place(center + bottom, dy: -7mm, text(20pt)[un pringle]), + caption: place(center + bottom, dy: -7mm, text(20pt)[une chips]), ), ) @@ -158,9 +156,10 @@ dx: 7mm, dy: 0mm, $ - P : cases([0; 2pi] times RR_+ &--> " " RR^3, - " "(u,v) &arrow.r.long.bar vec( cos(u)/ch(v), sin(u)/ch(v), v - th(v)) - ) + P : cases( + [0; 2pi] times RR_+ &--> " " RR^3, + " "(u,v) &arrow.r.long.bar vec(cos(u) / ch(v), sin(u) / ch(v), v - th(v)) + ) $, ) } @@ -180,7 +179,7 @@ horizon + left, dx: 1.5cm, dy: -4cm, - [On note ] + $display((diff P)/(diff u) = P_u)$, + [On note ] + $display((diff P) / (diff u) = P_u)$, ) #place( horizon + left, @@ -220,7 +219,7 @@ dy: 13mm, [La courbure en $p in [0; 2pi] times RR_+$] + $ - K(p) = (cal(L)(p)cal(N)(p) - cal(M)(p)^2) / (E(p)G(p) - F^2) + K(p) = (cal(L)(p)cal(N)(p) - cal(M)(p)^2) / (E(p)G(p) - F(p)^2) $, ) #v(7cm) @@ -311,12 +310,12 @@ Idée de la projection de Mercator : column-gutter: 2cm, align: horizon, [ - Or : $ B = (diff u)/ch(v) $ + Or : $ B = (diff u) / ch(v) $ ], [ Donc $ - A = cal(E) / B = th(v) diff v + A / B = cal(E) / B^2 = sh(v) diff v $ ], ), @@ -338,16 +337,36 @@ Idée de la projection de Mercator : #{ set text(30pt) place( - center + horizon, + dy: 15mm, + dx: 2cm, + left + top, [ La projection : $ - C : cases([0; 2pi] times RR_+--> RR^2, " " p = (u,v) arrow.long.bar vec(u,ch(v))) + C : cases([0; 2pi] times RR_+--> RR^2, " " p = (u,v) arrow.long.bar vec(u, ch(v))) $ ], ) } +#{ + set text(30pt) + place( + dy: -15mm, + dx: 2cm, + left + bottom, + [ + Celle de Mercator : + $ + M: cases([0;2pi] times [-pi;pi] --> RR^2, p = (u,v) arrow.long.bar vec(u, ln(tan(v / 2 + pi / 4)))) + $ + ], + ) +} +#place( + right + horizon, + image("image/projTerrePS.png", height: 18cm), +) #pagebreak() @@ -359,17 +378,11 @@ Idée de la projection de Mercator : figure(image("./image/cadir.png", width: 40%)), ) -#place( - horizon, - dx: 2cm, - align( - center, - text(red, stroke: 0.1pt)[ - Mettre les bornes de la carte !!\ - genre $0 -> 2 pi$ et $arrow.t_1^(+oo)$ - ], - ), -) +#place($ 1 $, dx: 1.5cm, dy: 15cm) +#place(sym.arrow.t, dx: 1.2cm) +#place($ +oo $, dx: 0.5cm, dy: 0.9cm) +#place($0$, dx: 2.04cm, dy: 15.7cm) +#place($ 2pi $, dx: 12.2cm, dy: 15.7cm) #place( right + horizon, @@ -395,10 +408,6 @@ Idée de la projection de Mercator : #pagebreak() -Trouver un moyen pour projter une image - -#pagebreak() - = 4) Projeté des droites #pagebreak() @@ -411,9 +420,7 @@ Trouver un moyen pour projter une image [ Équation des droites : - Méridiens : $g : t |-> P(u,t)$ - - Autres droites : $ - g : t |-> P(t, ch(sqrt(k^2 - (t + c)^2))) - $ + - Autres droites : $ g : t |-> P(t, ch(sqrt(k^2 - (t + c)^2))) $ ], ) @@ -518,6 +525,9 @@ Trouver un moyen pour projter une image #pagebreak() +== 4) projeté des droites + + #place( left + horizon, dx: 1.5cm, @@ -536,28 +546,34 @@ Trouver un moyen pour projter une image ), ) -#pagebreak() -= 5) Conservation des angles #pagebreak() -== 5) conservation des angles +== 4) projeté des droites -faut que je travaille -#pagebreak() - -#place(image("image/Tissot.png")) #place( + dx: 2cm, + image("image/Tissot.png"), +) +#place( + dx: -2cm, right, image("image/TissotPS.png"), ) +#pagebreak() + #place( center + horizon, - [ - Merci\ - De votre attention - ], + image("prog/merci.png", width: 200%), ) + +#pagebreak() + += Annexes + +#pagebreak() + +== Annexes diff --git a/2nd_annee_prepa/TIPE/geo/Sans titre.ggb b/2nd_annee_prepa/TIPE/geo/Sans titre.ggb index 5b52170..6d6acf4 100644 Binary files a/2nd_annee_prepa/TIPE/geo/Sans titre.ggb and b/2nd_annee_prepa/TIPE/geo/Sans titre.ggb differ diff --git a/2nd_annee_prepa/TIPE/image/projTerrePS.png b/2nd_annee_prepa/TIPE/image/projTerrePS.png new file mode 100644 index 0000000..91022e8 Binary files /dev/null and b/2nd_annee_prepa/TIPE/image/projTerrePS.png differ diff --git a/2nd_annee_prepa/TIPE/image/projTerrePS.webp b/2nd_annee_prepa/TIPE/image/projTerrePS.webp new file mode 100644 index 0000000..d0f8ad3 Binary files /dev/null and b/2nd_annee_prepa/TIPE/image/projTerrePS.webp differ diff --git a/2nd_annee_prepa/TIPE/prog/cercle.jpg b/2nd_annee_prepa/TIPE/prog/cercle.jpg new file mode 100644 index 0000000..3318d16 Binary files /dev/null and b/2nd_annee_prepa/TIPE/prog/cercle.jpg differ diff --git a/2nd_annee_prepa/TIPE/prog/mercator2.jpg b/2nd_annee_prepa/TIPE/prog/mercator2.jpg new file mode 100644 index 0000000..0386c77 Binary files /dev/null and b/2nd_annee_prepa/TIPE/prog/mercator2.jpg differ diff --git a/2nd_annee_prepa/TIPE/prog/merci.png b/2nd_annee_prepa/TIPE/prog/merci.png new file mode 100644 index 0000000..7810c04 Binary files /dev/null and b/2nd_annee_prepa/TIPE/prog/merci.png differ diff --git a/2nd_annee_prepa/TIPE/prog/proj.py b/2nd_annee_prepa/TIPE/prog/proj.py index 5151350..f6e4278 100644 --- a/2nd_annee_prepa/TIPE/prog/proj.py +++ b/2nd_annee_prepa/TIPE/prog/proj.py @@ -1,91 +1,42 @@ +import matplotlib.pyplot as plt import numpy as np -import pygame -from PIL import Image -from scipy.interpolate import RegularGridInterpolator +from mpl_toolkits.mplot3d import Axes3D -def pseudo_sphere(u, v): - """ Génère les coordonnées de la pseudo-sphère sans la partie inférieure """ - x = np.cos(u) / np.cosh(v) - y = np.sin(u) / np.cosh(v) - z = v - np.tanh(v) - return x, y, z +def dec(v): + if v < 0: + return -np.arccosh(1 - v) + else: + return np.arccosh(v + 1) -def project_image_on_pseudo_sphere(image_path, u_res=1000, v_res=1000): - """ Projette une image sur la pseudo-sphère avec une nouvelle projection optimisée """ - # Charger l'image et la faire pivoter de 90° - img = Image.open(image_path).convert('RGB') - img = img.rotate(-90, expand=True) # Rotation de 90° - img = img.resize((v_res, u_res)) # Réduction de la résolution pour un meilleur rendu - img_data = np.array(img) - - # Créer la grille de la pseudo-sphère en supprimant la partie inférieure - u = np.linspace(0, 2 * np.pi, u_res) - v = np.linspace(0, 2, v_res) # Suppression de la partie inférieure (v > 0) - U, V = np.meshgrid(u, v, indexing='ij') - X, Y, Z = pseudo_sphere(U, V) - - # Nouvelle projection de l'image - u_norm = (U - U.min()) / (U.max() - U.min()) - v_norm = (np.cosh(V) - np.cosh(V).min()) / (np.cosh(V).max() - np.cosh(V).min()) - points = np.array([u_norm.flatten(), v_norm.flatten()]).T - - # Création de l'interpolateur d'image - u_idx = np.linspace(0, 1, u_res) - v_idx = np.linspace(0, 1, v_res) - interpolator_r = RegularGridInterpolator((u_idx, v_idx), img_data[:, :, 0]) - interpolator_g = RegularGridInterpolator((u_idx, v_idx), img_data[:, :, 1]) - interpolator_b = RegularGridInterpolator((u_idx, v_idx), img_data[:, :, 2]) - - colors = np.zeros((u_res * v_res, 3), dtype=np.uint8) - colors[:, 0] = interpolator_r(points) - colors[:, 1] = interpolator_g(points) - colors[:, 2] = interpolator_b(points) - colors = colors.reshape((u_res, v_res, 3)) - - # Initialiser pygame - pygame.init() - screen = pygame.display.set_mode((600, 600)) - pygame.display.set_caption("Projection sur Pseudo-Sphère") - clock = pygame.time.Clock() - - angle_x, angle_y = 0, 0 - - # Affichage de la projection avec rotation optimisée - running = True - while running: - screen.fill((0, 0, 0)) - rot_x = np.array([[1, 0, 0], [0, np.cos(angle_x), -np.sin(angle_x)], [0, np.sin(angle_x), np.cos(angle_x)]]) - rot_y = np.array([[np.cos(angle_y), 0, np.sin(angle_y)], [0, 1, 0], [-np.sin(angle_y), 0, np.cos(angle_y)]]) - - pixels = pygame.PixelArray(screen) - for i in range(u_res): - for j in range(v_res): - vec = np.array([X[i, j], Y[i, j], Z[i, j]]) - vec = rot_x @ vec - vec = rot_y @ vec - x, y = int((vec[0] + 1) * 300), int((vec[1] + 1) * 300) - if 0 <= x < 600 and 0 <= y < 600: - pixels[x, y] = tuple(colors[i, j]) - - del pixels # Libérer les pixels pour appliquer les modifications - pygame.display.flip() - - for event in pygame.event.get(): - if event.type == pygame.QUIT: - running = False - elif event.type == pygame.KEYDOWN: - if event.key == pygame.K_LEFT: - angle_y -= 0.1 - if event.key == pygame.K_RIGHT: - angle_y += 0.1 - if event.key == pygame.K_UP: - angle_x -= 0.1 - if event.key == pygame.K_DOWN: - angle_x += 0.1 - - clock.tick(60) # Augmentation du taux de rafraîchissement - - pygame.quit() +# Surface 3D (exemple : une sphère) +theta = np.linspace(0, 2 * np.pi, 500) +phi = np.linspace(-7, 7, 500) +for i in range(len(phi)): + phi[i] = dec(phi[i]) +print(phi) +theta, phi = np.meshgrid(theta, phi) +r = 1 +x = r * np.cos(theta) / np.cosh(phi) +y = r * np.sin(theta) / np.cosh(phi) +z = phi - np.tanh(phi) -# Exemple d'utilisation -project_image_on_pseudo_sphere("/home/jvj/gith/typst-file/Typstfile/2nd_annee_prepa/TIPE/image/diffprojS/Equirectangular_projection_SW.jpg") +# Projection personnalisée (exemple : projection cylindrique) +image = plt.imread("/home/jvj/Telechargements/merci.jpg") +u = (theta - np.min(theta)) / (np.max(theta) - np.min(theta)) # Normalisation +v = (phi - np.min(phi)) / (np.max(phi) - np.min(phi)) +image = image[::-1] +texture = image[ + (v * (image.shape[0] - 1)).astype(int), (u * (image.shape[1] - 1)).astype(int) +] + +# Affichage +fig = plt.figure() +ax: Axes3D = fig.add_subplot(111, projection="3d") +ax.set_axis_off() +ax.view_init(elev=4, azim=-180, roll=0) +ax.set_xlim(-3, 3) +ax.set_ylim(-3, 3) +ax.plot_surface(x, y, z, facecolors=texture / 255.0, rstride=1, cstride=1) + +plt.savefig("result.png", format="png", dpi=1000) +#plt.show() \ No newline at end of file