<style type="text/css">a[data-mtli~="mtli_filesize420MB"]:after {content:" (4.20 MB)"}</style><style type="text/css">a[data-mtli~="mtli_filesize420MB"]:after {content:" (4.20 MB)"}</style>{"id":13473,"date":"2025-05-28T00:18:59","date_gmt":"2025-05-27T22:18:59","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=13473"},"modified":"2025-05-28T00:19:01","modified_gmt":"2025-05-27T22:19:01","slug":"fast-iterative-circles-and-ellipses-and-other-figures","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2025\/05\/28\/fast-iterative-circles-and-ellipses-and-other-figures\/","title":{"rendered":"Fast iterative circles (and ellipses, and other figures)."},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<h3 class=\"wp-block-heading\">Fast iterative circles (and ellipses, and other figures).<\/h3>\n\n\n\n<p>Here&#8217;s the entire algorithm to compute points on an elliptical arc, very quickly:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">    while(true)\n    {\n        x += d * y;\n        y -= d * x;\n    }\n<\/pre>\n\n\n\n<p>Attributed to Marvin Minsky, 1972: <a href=\"http:\/\/w3.pppl.gov\/~hammett\/work\/2009\/AIM-239-ocr.pdf\" data-mtli=\"mtli_filesize420MB\">HAKMEM, MIT AI Memo 239<\/a> (HTML version <a href=\"http:\/\/home.pipeline.com\/~hbaker1\/hakmem\/hacks.html#item149\">here<\/a>). Also on a PDP-1, <a href=\"http:\/\/www.computer-history.info\/Page2.dir\/pages\/Mapes.html\">David Mapes<\/a> talks about finding it independently. I&#8217;ve been using this to make circles since I found it by accident in the early 1980s (using a BBC Micro). Nowadays I&#8217;m using it to make music synthesizers (running on ARM Cortex M4).<\/p>\n<cite>Source: <a href=\"https:\/\/cabezal.com\/misc\/minsky-circles.html\">https:\/\/cabezal.com\/misc\/minsky-circles.html<\/a><\/cite><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Fast iterative circles (and ellipses, and other figures). Here&#8217;s the entire algorithm to compute points on an elliptical arc, very quickly: while(true) { x += d * y; y -= d * x; } Attributed to Marvin Minsky, 1972: HAKMEM, MIT AI Memo 239 (HTML version here). Also on a PDP-1, David Mapes talks about&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2025\/05\/28\/fast-iterative-circles-and-ellipses-and-other-figures\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-13473","post","type-post","status-publish","format-standard","hentry","category-senza-categoria"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-3vj","jetpack-related-posts":[{"id":14169,"url":"https:\/\/monodes.com\/predaelli\/2025\/10\/24\/how-to-emulate-hand-drawn-shapes-algorithms-behind-roughjs-shihn-ca\/","url_meta":{"origin":13473,"position":0},"title":"How to emulate hand-drawn shapes \/ Algorithms behind RoughJS | shihn.ca","author":"Paolo Redaelli","date":"2025-10-24","format":false,"excerpt":"How to emulate hand-drawn shapes \/ Algorithms behind RoughJS | shihn.ca A dive into graphics algorithms used in RoughJS - A graphics library that lets you draw in a sketchy, hand-drawn-like, style. How to emulate hand-drawn shapes \/ Algorithms behind RoughJS A dive into graphics algorithms used in RoughJS -\u2026","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2025\/10\/cover.png?fit=480%2C480&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6458,"url":"https:\/\/monodes.com\/predaelli\/2020\/01\/18\/what-is-the-difference-between-forin-and-forof-in-javascript\/","url_meta":{"origin":13473,"position":1},"title":"What is the Difference Between \u2018for\u2026in\u2019 and \u2018for\u2026of\u2019 in JavaScript?","author":"Paolo Redaelli","date":"2020-01-18","format":"link","excerpt":"What is the Difference Between \u2018for\u2026in\u2019 and \u2018for\u2026of\u2019 in JavaScript? What is the Difference Between \u2018for\u2026in\u2019 and \u2018for\u2026of\u2019 in JavaScript? One for enumerables, one for iterables\u2026how should you use each? Jonathan Hsu Dec 4, 2019 \u00b7 3 min read Photo by Filip Mroz on Unsplash Looping has come a long\u2026","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"Jonathan Hsu","src":"https:\/\/i0.wp.com\/miro.medium.com\/fit\/c\/96\/96\/2%2A_KGzadiy9s83D4vzhsCyyg.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":9532,"url":"https:\/\/monodes.com\/predaelli\/2022\/08\/09\/7-python-one-liners-that-will-blow-your-mind\/","url_meta":{"origin":13473,"position":2},"title":"7 Python One-Liners that will Blow Your Mind","author":"Paolo Redaelli","date":"2022-08-09","format":false,"excerpt":"Xiaoxu Gao wrote 7 Python One-Liners that will Blow Your Mind Less is more? Photo by Photos by Lanty from Unsplash The term one-liner comes from comedy where a joke is delivered in a single line. A good one-liner is said to be meaningful and concise. This concept also exists\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/monodes.com\/predaelli\/category\/python\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10560,"url":"https:\/\/monodes.com\/predaelli\/2023\/06\/24\/babylonian-square-root\/","url_meta":{"origin":13473,"position":3},"title":"Babylonian square root","author":"Paolo Redaelli","date":"2023-06-24","format":false,"excerpt":"Compute \u221aa like a #Babylonian....1) Make a guess x\u2080 > 0 for \u221aa2) The average x\u2081 = \u00bd (x\u2080 +a\/x\u2080) is closer to \u221aa than either x\u2080 or a\/x\u20803) Iterating step 2 gives you a sequence x\u2081, x\u2082, x\u2083, ... that converges to \u221aa . From FB","rel":"","context":"In &quot;Senza categoria&quot;","block_context":{"text":"Senza categoria","link":"https:\/\/monodes.com\/predaelli\/category\/senza-categoria\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2023\/06\/babylonian-square-root.webp?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2023\/06\/babylonian-square-root.webp?fit=1200%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2023\/06\/babylonian-square-root.webp?fit=1200%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2023\/06\/babylonian-square-root.webp?fit=1200%2C675&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2023\/06\/babylonian-square-root.webp?fit=1200%2C675&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":8866,"url":"https:\/\/monodes.com\/predaelli\/2021\/10\/31\/write-clean-python-code-using-pipes\/","url_meta":{"origin":13473,"position":4},"title":"Write Clean Python Code Using Pipes","author":"Paolo Redaelli","date":"2021-10-31","format":"link","excerpt":"Write Clean Python Code Using Pipes A Short and Clean Approach to Processing Iterables Now that's an interesting way of coding! Pipes A Short and Clean Approach to Processing Iterables Khuyen Tran 4 days ago\u00b75 min read Motivation map and filter are two efficient Python methods to work with iterables.\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/monodes.com\/predaelli\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2021\/10\/1X1eRTaS8h0nv9SeXIKYPPQ-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2021\/10\/1X1eRTaS8h0nv9SeXIKYPPQ-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2021\/10\/1X1eRTaS8h0nv9SeXIKYPPQ-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2021\/10\/1X1eRTaS8h0nv9SeXIKYPPQ-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":13877,"url":"https:\/\/monodes.com\/predaelli\/2025\/08\/19\/going-faster-than-memcpy\/","url_meta":{"origin":13473,"position":5},"title":"Going faster than memcpy","author":"Paolo Redaelli","date":"2025-08-19","format":"link","excerpt":"Going faster than memcpy Going faster than memcpy While profiling Shadesmar a couple of weeks ago, I noticed that for large binary unserialized messages (>512kB) most of the execution time is spent doing copying the message (using memcpy) between process memory to shared memory and back. I had a few\u2026","rel":"","context":"In &quot;Senza categoria&quot;","block_context":{"text":"Senza categoria","link":"https:\/\/monodes.com\/predaelli\/category\/senza-categoria\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/13473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=13473"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/13473\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=13473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=13473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=13473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}