{"id":807,"date":"2022-08-25T14:03:33","date_gmt":"2022-08-25T13:03:33","guid":{"rendered":"https:\/\/blog.univ-angers.fr\/mathsinfo\/?p=807"},"modified":"2022-11-20T18:38:56","modified_gmt":"2022-11-20T17:38:56","slug":"chapeau3d","status":"publish","type":"post","link":"https:\/\/blog.univ-angers.fr\/mathsinfo\/2022\/08\/25\/chapeau3d\/","title":{"rendered":"Dessinons un c\u00e9l\u00e8bre chapeau 3D sur la NUMWORKS"},"content":{"rendered":"\n<p>Sur d&rsquo;anciennes revues des <strong>ann\u00e9es 80<\/strong>, on pouvait voir cette <strong>surface 3D<\/strong> ressemblant \u00e0 un <strong>chapeau<\/strong> :<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/micro_36_may_1981.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"1024\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/micro_36_may_1981-791x1024.jpg\" alt=\"\" class=\"wp-image-809\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/micro_36_may_1981-791x1024.jpg 791w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/micro_36_may_1981-232x300.jpg 232w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/micro_36_may_1981-768x994.jpg 768w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/micro_36_may_1981-1187x1536.jpg 1187w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/micro_36_may_1981.jpg 1275w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/a><figcaption>http:\/\/archive.6502.org\/publications\/micro\/micro_36_may_1981.pdf (page 2)<\/figcaption><\/figure><\/div>\n\n\n\n<p>Remarquez que le code du programme (\u00e9crit en BASIC) \u00e9tait donn\u00e9 sur la publicit\u00e9 ! Voici \u00e0 nouveau ce chapeau dans une autre revue :<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/11\/chapeau3d.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/11\/chapeau3d-879x1024.jpeg\" alt=\"\" class=\"wp-image-1120\" width=\"417\" height=\"511\" \/><\/a><figcaption>Sciences &amp; Avenir n\u00b036 (page 25) &#8211; Collection personnelle<\/figcaption><\/figure><\/div>\n\n\n\n<p>Passons \u00e0 sa <a rel=\"noreferrer noopener\" href=\"https:\/\/my.numworks.com\/python\/schraf\/hat\" target=\"_blank\">traduction en Python pour la NUMWORKS<\/a> :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from math import *\nfrom kandinsky import fill_rect, set_pixel\n\n(BL, WH) = ((0, 0, 0), (255, 180, 50))  # Noir et Orange\n\nfill_rect(0, 0, 320, 222, BL)  # Fond noir\n\n(xp, xr) = (120, 1.5 * pi)\nyp = 45\n(xf, zf) = (xr \/ xp, xr \/ yp)\nfor zi in range(-yp, yp):\n  zt = zi * xp \/ yp\n  xl = int(.5 + sqrt(xp * xp - zt * zt))\n  for xi in range(-xl, xl + 1):\n    xt = sqrt(xi * xi + zt * zt) * xf\n    yy = (sin(xt) + .4 * sin(3 * xt)) * yp\n    y1 = int(min(222, max(1, yy - zi + 100)))\n    x1 = 10 + int(min(360, max(0, xi + zi + 150)))\n    set_pixel(x1, 210 - y1, WH)\n    fill_rect(x1, 210 - (y1 - 1), 1, y1, BL)\n<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/chapeau.gif\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"222\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/chapeau.gif\" alt=\"\" class=\"wp-image-811\" \/><\/a><figcaption>R\u00e9sultat final<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Equation de la surface<\/h2>\n\n\n\n<p>En regardant plus attentivement le code, on voit que les <strong>zi<\/strong> (not\u00e9 <strong>y<\/strong> ci-dessous) et <strong>xi<\/strong> (not\u00e9 <strong>x<\/strong>) permettent de calculer <strong>yy<\/strong> (not\u00e9 <strong>z<\/strong>), l&rsquo;\u00e9quation de la surface est :<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-26.png\"><img loading=\"lazy\" decoding=\"async\" width=\"597\" height=\"60\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-26.png\" alt=\"\" class=\"wp-image-819\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-26.png 597w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-26-300x30.png 300w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-26-500x50.png 500w\" sizes=\"auto, (max-width: 597px) 100vw, 597px\" \/><\/a><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-24.png\"><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"456\" src=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-24.png\" alt=\"\" class=\"wp-image-817\" srcset=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-24.png 673w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-24-300x203.png 300w, https:\/\/blog.univ-angers.fr\/mathsinfo\/files\/2022\/08\/image-24-443x300.png 443w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Sur d&rsquo;anciennes revues des ann\u00e9es 80, on pouvait voir cette surface 3D ressemblant \u00e0 un chapeau : Remarquez que le code du programme (\u00e9crit en BASIC) \u00e9tait donn\u00e9 sur la publicit\u00e9 ! Voici \u00e0 nouveau ce chapeau dans une autre &hellip; <a href=\"https:\/\/blog.univ-angers.fr\/mathsinfo\/2022\/08\/25\/chapeau3d\/\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4913,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-807","post","type-post","status-publish","format-standard","hentry","category-twitter"],"_links":{"self":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts\/807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/users\/4913"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/comments?post=807"}],"version-history":[{"count":11,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts\/807\/revisions"}],"predecessor-version":[{"id":1124,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/posts\/807\/revisions\/1124"}],"wp:attachment":[{"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/media?parent=807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/categories?post=807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.univ-angers.fr\/mathsinfo\/wp-json\/wp\/v2\/tags?post=807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}