{"id":2375,"date":"2018-02-07T02:17:19","date_gmt":"2018-02-07T02:17:19","guid":{"rendered":"http:\/\/ellignostage.test\/?p=2375"},"modified":"2021-05-26T12:51:44","modified_gmt":"2021-05-26T17:51:44","slug":"un-exemple-dimplementation-des-angles-deuler-en-c","status":"publish","type":"post","link":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/","title":{"rendered":"Un Exemple d&rsquo;Impl\u00e9mentation des Angles d&rsquo;Euler en C++"},"content":{"rendered":"\n<p>J&rsquo;adore le langage C++ et comme programmeur scientifique il y a certaines choses que j&rsquo;aime plus que d&rsquo;autres.&nbsp;Dans le domaine de la programmation scientifique la surcharge des&nbsp;op\u00e9rateurs&nbsp;ou plus&nbsp;commun\u00e9ment&nbsp;appel\u00e9&nbsp;\u00ab\u00a0overload\u00a0\u00bb&nbsp;est&nbsp;d\u00e9finitivement&nbsp;une&nbsp;caract\u00e9ristique&nbsp;que je trouve pratique.&nbsp;<span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n\n\n\n<p>Permet&nbsp;de&nbsp;r\u00e9impl\u00e9menter&nbsp;les&nbsp;op\u00e9rateurs&nbsp;+,-,+= etc&nbsp;qui sont des&nbsp;op\u00e9rations&nbsp;que&nbsp;la majeure partie&nbsp;des types&nbsp;math\u00e9matique&nbsp;supporte.&nbsp;&nbsp;Au niveau de la programmation,&nbsp;on veut&nbsp;\u00eatre&nbsp;en mesure&nbsp;d\u2019avoir un&nbsp;\u00e9quivalent&nbsp;(par exemple je veux&nbsp;multiplier&nbsp;2 matrices&nbsp;A=B*C.&nbsp;Ainsi un utilisateur de notre librairie&nbsp;math\u00e9matique&nbsp;3D pourrait&nbsp;\u00e9crire&nbsp;dans son programme&nbsp;<span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n\n\n\n<p><b>Matrice A,B,C<\/b>&nbsp;et effectuer la&nbsp;multiplication B*C de la&nbsp;m\u00eame&nbsp;mani\u00e8re qu\u2019il le ferait analytiquement.<span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240}\">&nbsp;<\/span><\/p>\n\n\n\n<p><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:240}\">&nbsp;<\/span>Prenons le cas des rotations,&nbsp;une rotation est&nbsp;d\u00e9finie&nbsp;par une matrice et que l&rsquo;on applique sur un objet pour le faire tourner.&nbsp;Un exemple sont les&nbsp;angles d&rsquo;Euler&nbsp;largement utilises&nbsp;dans les moteurs de jeux&nbsp;vid\u00e9o&nbsp;pour leur&nbsp;efficacit\u00e9.&nbsp;Dans une simulation 3D de corps rigides, on applique constamment des rotations sur les objets physiques&nbsp;pour les animer, notre class de rotation doit supporter&nbsp;plusieurs&nbsp;op\u00e9rations&nbsp;\u00ab\u202f*,*=\u202f\u00bb.&nbsp;Grace&nbsp;\u00e0&nbsp;la surcharge des&nbsp;op\u00e9rateurs&nbsp;en C++, il est facile de reproduire cette&nbsp;op\u00e9ration&nbsp;math\u00e9matique.<\/p>\n\n\n\n<pre class=\"wp-block-code prettyprint lang-cpp\"><code class=\"\" data-line=\"\">namespace Sfx {\n namespace Mth {\n\/\/ ________________________________________________________\n \/\/\nclass EulerAngles \n{\n   public:\n     typedef double Scalar;\n\n     \/\/\n     \/\/ Ctor summary\n     \/\/\n\n     \/\/ default ctor\n     EulerAngles() \n     : fPhi  ( 0.0), \n       fTheta( 0.0), \n       fPsi  ( 0.0) \n     {}\n\n     \/\/ ...\n     EulerAngles( Scalar phi, Scalar theta, Scalar psi ) \n     : fPhi(phi), \n       fTheta(theta), \n       fPsi(psi)\n     { Rectify();}            \n\n     \/\/ ...\n     template\n     EulerAngles( IT begin, IT end) { SetComponents( begin, end); }\n\n     \/\/ NOTE:\n     \/\/ The compiler-generated copy ctor, copy assignment, and dtor are OK.\n\n     void Rectify();\n\n     \/\/\n     \/\/ ======== Construction From other Rotation Forms ==================\n     \/\/\n\n     explicit EulerAngles( const Rotation3D &amp; r)  { Mth::convert( r, *this);}\n     explicit EulerAngles( const Quaternion &amp; q)  { Mth::convert( q, *this);}\n     explicit EulerAngles( const AxisAngle  &amp; a ) { Mth::convert( a, *this);}\n     explicit EulerAngles( RotationZ const  &amp; r ) { Mth::convert( r, *this);}\n     explicit EulerAngles( RotationY const  &amp; r ) { Mth::convert( r, *this);}\n     explicit EulerAngles( RotationX const  &amp; r ) { Mth::convert( r, *this);}\n\n     EulerAngles &amp;\n       operator = ( Rotation3D const  &amp; r ) { return operator= ( EulerAngles(r)); }\n\n     EulerAngles &amp;\n       operator = ( AxisAngle const &amp; a ) { return operator= ( EulerAngles(a)); }\n\n     EulerAngles &amp;\n       operator = ( Quaternion const  &amp; q ) {return operator= ( EulerAngles(q)); }\n\n     EulerAngles &amp;\n       operator = ( RotationZ const &amp; r ) { return operator= ( EulerAngles(r)); }\n\n     EulerAngles &amp;\n       operator = ( RotationY const &amp; r ) { return operator= ( EulerAngles(r)); }\n\n     EulerAngles &amp;\n       operator = ( RotationX const &amp; r ) { return operator= ( EulerAngles(r)); }\n\n .....\n\n    \/\/\n     \/\/ ========= Multi-Rotation Operations ===============\n     \/\/\n\n     EulerAngles operator * ( const Rotation3D  &amp; r) const;\n     EulerAngles operator * ( const AxisAngle   &amp; a) const;\n     EulerAngles operator * ( const EulerAngles &amp; e) const;\n     EulerAngles operator * ( const Quaternion  &amp; q) const;\n     EulerAngles operator * ( const RotationX  &amp; rx) const;\n     EulerAngles operator * ( const RotationY  &amp; ry) const;\n     EulerAngles operator * ( const RotationZ  &amp; rz) const;\n\n     \/\/ _____________________________________________\n     \/\/\n     template \n     EulerAngles &amp; operator *= ( const R &amp; r) { return *this = (*this)*r;}\n};\n} }\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Le langage C++ offre de nombreuses caract\u00e9ristiques qui le rende bien adapte pour la programmation scientifique. En particulier la surcharge des op\u00e9rateurs, permet d&rsquo;\u00e9crire du code qui mod\u00e9lise les types math\u00e9matiques de mani\u00e8re naturel. Je pr\u00e9sente une class C++ de notre environnement de programmation qui met en \u00e9vidence cette caract\u00e9ristique  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-2375","post","type-post","status-publish","format-standard","hentry","category-trucs-et-astuces"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Un Exemple d&#039;Impl\u00e9mentation des Angles d&#039;Euler en C++ - Elligno<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Un Exemple d&#039;Impl\u00e9mentation des Angles d&#039;Euler en C++ - Elligno\" \/>\n<meta property=\"og:description\" content=\"Le langage C++ offre de nombreuses caract\u00e9ristiques qui le rende bien adapte pour la programmation scientifique. En particulier la surcharge des op\u00e9rateurs, permet d&#039;\u00e9crire du code qui mod\u00e9lise les types math\u00e9matiques de mani\u00e8re naturel. Je pr\u00e9sente une class C++ de notre environnement de programmation qui met en \u00e9vidence cette caract\u00e9ristique\" \/>\n<meta property=\"og:url\" content=\"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Elligno\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-07T02:17:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-26T17:51:44+00:00\" \/>\n<meta name=\"author\" content=\"Elligno\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Elligno\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/\"},\"author\":{\"name\":\"Elligno\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#\\\/schema\\\/person\\\/95f2e5f7a779215bc13c98f05efafc8b\"},\"headline\":\"Un Exemple d&rsquo;Impl\u00e9mentation des Angles d&rsquo;Euler en C++\",\"datePublished\":\"2018-02-07T02:17:19+00:00\",\"dateModified\":\"2021-05-26T17:51:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/\"},\"wordCount\":303,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#organization\"},\"articleSection\":[\"Trucs et astuces\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/\",\"url\":\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/\",\"name\":\"Un Exemple d'Impl\u00e9mentation des Angles d'Euler en C++ - Elligno\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#website\"},\"datePublished\":\"2018-02-07T02:17:19+00:00\",\"dateModified\":\"2021-05-26T17:51:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/un-exemple-dimplementation-des-angles-deuler-en-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/elligno.com\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Un Exemple d&rsquo;Impl\u00e9mentation des Angles d&rsquo;Euler en C++\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/elligno.com\\\/fr\\\/\",\"name\":\"Elligno\",\"description\":\"Site dev elligno\",\"publisher\":{\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/elligno.com\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#organization\",\"name\":\"Elligno Inc\",\"url\":\"https:\\\/\\\/elligno.com\\\/fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/elligno.com\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/favicon.png\",\"contentUrl\":\"https:\\\/\\\/elligno.com\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/favicon.png\",\"width\":256,\"height\":256,\"caption\":\"Elligno Inc\"},\"image\":{\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/elligno.com\\\/fr\\\/#\\\/schema\\\/person\\\/95f2e5f7a779215bc13c98f05efafc8b\",\"name\":\"Elligno\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5d5d65a6272025dfbdbf8600bd75d9abcc5eede7e37fe620531e2d2c00f91464?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5d5d65a6272025dfbdbf8600bd75d9abcc5eede7e37fe620531e2d2c00f91464?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5d5d65a6272025dfbdbf8600bd75d9abcc5eede7e37fe620531e2d2c00f91464?s=96&d=mm&r=g\",\"caption\":\"Elligno\"},\"sameAs\":[\"https:\\\/\\\/elligno.com\"],\"url\":\"https:\\\/\\\/elligno.com\\\/fr\\\/author\\\/panel-65ui89\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Un Exemple d'Impl\u00e9mentation des Angles d'Euler en C++ - Elligno","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/","og_locale":"fr_FR","og_type":"article","og_title":"Un Exemple d'Impl\u00e9mentation des Angles d'Euler en C++ - Elligno","og_description":"Le langage C++ offre de nombreuses caract\u00e9ristiques qui le rende bien adapte pour la programmation scientifique. En particulier la surcharge des op\u00e9rateurs, permet d'\u00e9crire du code qui mod\u00e9lise les types math\u00e9matiques de mani\u00e8re naturel. Je pr\u00e9sente une class C++ de notre environnement de programmation qui met en \u00e9vidence cette caract\u00e9ristique","og_url":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/","og_site_name":"Elligno","article_published_time":"2018-02-07T02:17:19+00:00","article_modified_time":"2021-05-26T17:51:44+00:00","author":"Elligno","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Elligno","Dur\u00e9e de lecture estim\u00e9e":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/#article","isPartOf":{"@id":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/"},"author":{"name":"Elligno","@id":"https:\/\/elligno.com\/fr\/#\/schema\/person\/95f2e5f7a779215bc13c98f05efafc8b"},"headline":"Un Exemple d&rsquo;Impl\u00e9mentation des Angles d&rsquo;Euler en C++","datePublished":"2018-02-07T02:17:19+00:00","dateModified":"2021-05-26T17:51:44+00:00","mainEntityOfPage":{"@id":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/"},"wordCount":303,"commentCount":0,"publisher":{"@id":"https:\/\/elligno.com\/fr\/#organization"},"articleSection":["Trucs et astuces"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/","url":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/","name":"Un Exemple d'Impl\u00e9mentation des Angles d'Euler en C++ - Elligno","isPartOf":{"@id":"https:\/\/elligno.com\/fr\/#website"},"datePublished":"2018-02-07T02:17:19+00:00","dateModified":"2021-05-26T17:51:44+00:00","breadcrumb":{"@id":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/elligno.com\/fr\/un-exemple-dimplementation-des-angles-deuler-en-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/elligno.com\/fr\/"},{"@type":"ListItem","position":2,"name":"Un Exemple d&rsquo;Impl\u00e9mentation des Angles d&rsquo;Euler en C++"}]},{"@type":"WebSite","@id":"https:\/\/elligno.com\/fr\/#website","url":"https:\/\/elligno.com\/fr\/","name":"Elligno","description":"Site dev elligno","publisher":{"@id":"https:\/\/elligno.com\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/elligno.com\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/elligno.com\/fr\/#organization","name":"Elligno Inc","url":"https:\/\/elligno.com\/fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/elligno.com\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/elligno.com\/wp-content\/uploads\/2021\/06\/favicon.png","contentUrl":"https:\/\/elligno.com\/wp-content\/uploads\/2021\/06\/favicon.png","width":256,"height":256,"caption":"Elligno Inc"},"image":{"@id":"https:\/\/elligno.com\/fr\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/elligno.com\/fr\/#\/schema\/person\/95f2e5f7a779215bc13c98f05efafc8b","name":"Elligno","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/secure.gravatar.com\/avatar\/5d5d65a6272025dfbdbf8600bd75d9abcc5eede7e37fe620531e2d2c00f91464?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5d5d65a6272025dfbdbf8600bd75d9abcc5eede7e37fe620531e2d2c00f91464?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5d5d65a6272025dfbdbf8600bd75d9abcc5eede7e37fe620531e2d2c00f91464?s=96&d=mm&r=g","caption":"Elligno"},"sameAs":["https:\/\/elligno.com"],"url":"https:\/\/elligno.com\/fr\/author\/panel-65ui89\/"}]}},"_links":{"self":[{"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/posts\/2375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/comments?post=2375"}],"version-history":[{"count":0,"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/posts\/2375\/revisions"}],"wp:attachment":[{"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/media?parent=2375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/categories?post=2375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elligno.com\/fr\/wp-json\/wp\/v2\/tags?post=2375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}