<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Christian Marques on Medium]]></title>
        <description><![CDATA[Stories by Christian Marques on Medium]]></description>
        <link>https://medium.com/@christian.marques?source=rss-7a313bdb96ad------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u8Q_Xh48n6yos5CWTXb8DQ.png</url>
            <title>Stories by Christian Marques on Medium</title>
            <link>https://medium.com/@christian.marques?source=rss-7a313bdb96ad------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 18:05:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@christian.marques/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Dwarf Fortress: an engineering marvel of the 21st century]]></title>
            <link>https://medium.com/@christian.marques/dwarf-fortress-an-engineering-marvel-of-the-21st-century-2ba3a1e9b95f?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ba3a1e9b95f</guid>
            <category><![CDATA[systems-and-complexity]]></category>
            <category><![CDATA[dwarf-fortress]]></category>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[procedural-generation]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Sun, 31 May 2026 19:12:06 GMT</pubDate>
            <atom:updated>2026-05-31T20:02:56.464Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXJmCC1RiZZl0Vsrd4P3NQ.jpeg" /><figcaption>Engineering efforts in Dwarf Fortress (generated by GPT5)</figcaption></figure><p>It was 2012, and I had just traveled from Portugal to the South of France to pursue my first software engineering job in a big corp — an endeavor that would soon prove unsatisfying, but which ultimately allowed me to meet a wide array of very interesting people. I ended up sharing an apartment with an eccentric Italian engineer and colleague called Lorenzo, and this was the first time I ever heard about <a href="https://www.bay12games.com/dwarves/"><em>Dwarf Fortress</em></a>. He would talk about it often over breakfast and describe it as “the most complex simulation ever made”, flexing his ability to play (and understand) it, a skill that was reserved to 0.01% of the world’s population.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*NZXl6Dnf8lkIJVTD.png" /><figcaption>Original Dwarf Fortress UI - 2006 (Source: <a href="https://www.bay12games.com/dwarves/screens.html">Bay 12 Games</a>)</figcaption></figure><h4>The Barrier of Entry and Emerging Narratives</h4><p>Driven by curiosity, and as it was free and open source, I tried installing it multiple times during that period, only to spend half an hour looking at the <a href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> characters on screen not understanding what was going on, looking up internet guides without any success of making anything meaningful or even understandable, and ending up removing the software soon after that. It’s not a matter of pride, but to be perfectly honest, it was hard to get into it — and being a visually driven person made it much harder.</p><p>This happened multiple times whenever I would hear anyone mention <em>Dwarf Fortress</em>, and always ended up in the same outcome — uninstalling the software after some dozens of minutes experimenting with it. Even knowing that there were mods that would make the game more palatable, the inertia of overcoming that barrier was always bigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*9rkslz96vT6_jHg-.png" /><figcaption>I got frustrated trying to make sense of what was going on (Source: <a href="https://www.bay12games.com/dwarves/screens.html">Bay 12 Games</a>)</figcaption></figure><p>Regardless, during the COVID-19 pandemic, I discovered the YouTuber <a href="https://www.youtube.com/@kruggsmash">Kruggsmash</a> and immediately fell in fascination with these stories and, consequently, the game. It’s strange — falling in love with a game you’re not able to play, thanks to the emerging narratives and a creator who can wrap them up in a really compelling way. But that fascination kept growing, and the more I heard about it, the more curious I became; stories are some of my favorite things in the whole world. That’s why, when in 2022 it was announced that <em>Dwarf Fortress</em> would be released on <a href="https://store.steampowered.com/app/975370/Dwarf_Fortress/">Steam</a> with improved graphics and a fully functional GUI, I immediately put aside 30€ and decided to give it another go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fO3aKPXyg8XncpEt" /><figcaption>The new Steam graphical UI</figcaption></figure><h4>Lifting the Veil on a Monolithic Matrix</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*DJiRYi53PNRCMvS8.jpg" /><figcaption>Dwarf Fortress‘ much awaited (at least by me) Steam Release</figcaption></figure><p>When the download finished and I booted up the Steam version, the veil was finally lifted. With the barrier of impenetrable <a href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> removed and a mouse-driven interface at my fingertips, I could finally see the matrix for what it was. And looking at it through the lens of a software engineer, what I found was a staggering, almost incomprehensible marvel of 21st-century engineering.</p><p>To call <em>Dwarf Fortress</em> a “game” feels like a disservice to the architectural audacity of its codebase. Modern AAA studios spend hundreds of millions of dollars on photo-realistic physics, motion capture and voice acting. <a href="https://en.wikipedia.org/wiki/Tarn_Adams">Tarn</a> and Zach Adams, the brothers behind the game, spent two decades building a simulation so deep that it borders on madness.</p><p>In most software architecture — especially in game development — we rely heavily on abstraction. We use approximations to save memory, reduce processing loads, and keep the codebase manageable. <em>Dwarf Fortress</em> aggressively rejects this philosophy. While the engine uses brilliant algorithmic optimizations just to keep itself from catching fire, the design itself prioritizes simulation fidelity over performance shortcuts. Instead of abstracting data, it relies on a web of deeply integrated, autonomous systems that constantly poll, react, and influence one another. In fact, this refusal to compromise is exactly why long-running forts inevitably suffer from “<a href="https://steamcommunity.com/app/975370/discussions/0/3716062978734840948/">FPS death</a>” — the infamous late-game state where the sheer weight of calculating the path-finding, fluid dynamics, and individual toes of hundreds of dwarves brings even modern, high-end CPUs to a crawling halt.</p><h4>Where Engineering Meets Emergence</h4><p>The magic of <em>Dwarf Fortress</em> lies in how its seemingly disparate systems are designed to interact. There are no “scripted events.” A dragon doesn’t attack your fort because you reached level 10; a dragon attacks because the game’s global history simulator tracked its migration, its hunger parameters, and its attraction to the specific net worth of the gold statues your dwarves recently carved (or in reality, the perceived value of the collected wealth in your fortress).</p><p>The emergent narrative is simply the output of an incredibly complex state machine. Consider how the systems layer together:</p><ul><li><strong>Literal Geology:</strong> Minerals and ores are generated based on real-world geological rules, complete with sedimentary layers, aquifers, and volcanic activity.</li><li><strong>Thermodynamics and Fluid Dynamics:</strong> The engine simulates the flow of water and magma, but also tracks the temperature of individual objects and how heat transfers between materials based on their specific melting and boiling points.</li><li><strong>Granular Anatomy:</strong> The game tracks the skin, fat, muscle, bone, and nerves of every individual body part. If a goblin gets struck in the arm, the engine calculates the velocity of the weapon, the material of the armor, the melting point of the metal, and the shear strength of the bone.</li><li><strong>Psychology:</strong> It tracks the stress levels, memories, artistic preferences, and dietary needs of every single dwarf.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*8UyjFx0Nj3IVjnCnV0e1Eg.gif" /><figcaption>An ocean wave in the original Dwarf Fortress (source: <a href="https://www.reddit.com/r/dwarffortress/comments/18486ij/an_ocean_wave_in_ascii_gif/">Reddit</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*Nr2svB9N0qFVnLwS.png" /><figcaption>Dwarf personality system (source: <a href="https://dwarffortresswiki.org/index.php/Personality_value">Dwarf Fortress Wiki</a>)</figcaption></figure><p>And these are just a few of the systems, there are others such as history, weather, cooking, building, etc.</p><p>There is a <a href="https://dwarffortressbugtracker.com/view.php?id=9195">famous bug</a> in the game’s history where cats were mysteriously dying of alcohol poisoning in the taverns. The community eventually discovered the root cause: dwarves were spilling ale (fluid dynamics), the cats were walking through the puddles (getting alcohol on their fur via the material properties system), and when the cats later groomed themselves, the engine simulated them ingesting the alcohol. Because cats have small body masses, their simulated blood-alcohol content spiked, and they died.</p><p>This “bug” is a real testament to a collision of intersecting systems that most engineers wouldn’t even dare to architect, and certainly wasn’t part of it’s creators plans.</p><h4>When the Simulation Gets Personal</h4><p>Because <em>Dwarf Fortress</em> refuses to spawn resources out of thin air or rely on generic fail-states, the consequences for my own mistakes as a new overseer were vividly, and sometimes hilariously, grim. It didn’t take long for the math to generate my own bizarre tragedies (as it seems to do to so for every new player).</p><p>In one of my early runs (I called this episode — <strong>The Thirsty Hounds</strong>), I completely failed to secure a reliable water source. As the water reserves dried up, the engine’s biological systems kicked in, and one by one, my dwarves dehydrated and died. A standard game-over in any other game — but this simulation doesn’t stop just because the player lost. My fort’s dogs survived the drought. With their masters gone and no food in the stockpiles, the game’s survival and dietary mechanics logically converged: the starving dogs sustained themselves by eating the corpses of my fallen dwarves. It was incredibly macabre, but structurally flawless within the rules of the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*3Q1iZc9TYcB5V_ZvgQa-iA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*U-4pRKzwAvo-N4_tl0aggQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*iC1pobKXvOUcuSAjIKrNZw.jpeg" /><figcaption>A grim sight: Dwarves started dying of thirst and the whole colony ended up becoming food for the starving dogs</figcaption></figure><p>In another playthrough (I called it — <strong>The Bohemian Collapse</strong>), I aimed for a more utopian approach. I built grand taverns and focused on culture, successfully making my fortress a beacon of the arts. The game’s sociology and rumor systems kicked in, word traveled across the simulated world, and soon, droves of bards, poets, and artists migrated to my halls. It was beautiful until the math caught up with me. Because the game strictly tracks real labor, time, and caloric intake, my society collapsed. My fort was packed with people eating my food, drinking my ale, and reciting poetry, while almost no one was hauling stone or planting crops. My civilization collapsed under the weight of an unsustainable, booze-fueled poetry festival.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EjVgqbmfuGAKAUfOHK25Aw.jpeg" /><figcaption>A colony of poets and intellectuals</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7QgtWeFr93NFIDONm6M57Q.jpeg" /><figcaption>Dwarves spending all their time in the tavern and the library — what seems like a joyful cultural renaissance, ended up in full colony collapse (no one was working)</figcaption></figure><p>Finally, there was the time I witnessed the terrifying collision of the game’s psychological stress mechanics and its granular combat anatomy (this time I called it — <strong>The Van Gogh Miner</strong>). One of my most experienced miners — ironically, a dwarf who had developed a severe phobia of enclosed spaces — eventually snapped under the cumulative stress of spending months deep underground. The simulation tracks mental health declines into specific psychological breaks, and he went entirely berserk. Armed with his pickaxe, he turned on his own crew. The engine calculated every single swing, block, and deflection. In the most barbaric moment of the rampage, the combat log calmly detailed how the crazed miner swung his pickaxe, bypassed his victim’s skull, and completely severed the other dwarf’s ear while he was still alive. It was a gruesome, hyper-specific tragedy born entirely out of overlapping arrays and variables. I had to lock him down in the mines so he wouldn’t pose a threat to any other dwarves in the colony, containing and ending the carnage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7bqkzU7hp8lhLGB6yI8hjw.jpeg" /><figcaption>The barbaric cutting of the ear, when a mining Dwarf went berserk from claustrophobia</figcaption></figure><p>It is easy to look at the sleek, cloud-based, micro service-driven tech landscape of the 2020s and think of it as the pinnacle of software. But there is something deeply romantic and endlessly impressive about a monolithic 20 year old C++ codebase, lovingly maintained and expanded by essentially one programmer (major kudos and admiration for <a href="https://en.wikipedia.org/wiki/Tarn_Adams">Tarn Adams</a>) for over two decades.</p><p><em>Dwarf Fortress</em> is a marvel because it achieves the ultimate goal of any complex simulation: emergent narrative driven by uncompromising logic. The intricate, relentless math running beneath the surface — the same math that fed my dwarves to their pets, ruined my economy with artists and drove a poor dwarf to madness — is exactly what creates those beautiful, tragic stories I fell in love with on YouTube years ago.</p><p>It took me a decade, a global pandemic, and a graphical overhaul to finally get past the front door and I’m definitely still a n00b just scratching the surface of this incredible simulation, but now that I’m inside, I can confidently say: Lorenzo was right. From the perspective of a software engineer, the architecture of this project is breathtaking, and the experience of playing it is brilliantly and unapologetically chaotic. As the Adams brothers say: “<a href="https://dwarffortresswiki.org/index.php/DF2014:Losing">Losing is fun!</a>”, but scrutinizing and admiring their “losing-engine” might actually be even more fun than playing it.</p><h3>References</h3><ul><li><a href="https://stackoverflow.blog/2021/12/31/700000-lines-of-code-20-years-and-one-developer-how-dwarf-fortress-is-built/">700,000 lines of code, 20 years, and one developer: How Dwarf Fortress is built</a></li><li><a href="https://stackoverflow.blog/2021/09/21/podcast-377-you-dont-need-a-math-phd-to-play-dwarf-fortress-just-to-code-it/">Podcast 377: You don&#39;t need a math PhD to play Dwarf Fortress, just to code it</a></li><li><a href="https://www.gamedeveloper.com/design/q-a-dissecting-the-development-of-i-dwarf-fortress-i-with-creator-tarn-adams">Q&amp;A: Dissecting the development of Dwarf Fortress with creator Tarn Adams</a></li><li><a href="https://www.polygon.com/features/2019/3/14/18264569/dwarf-fortress-steam-tarn-adams-villains-health-care">The co-creator of Dwarf Fortress is getting older, but his work remains unfinished</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ba3a1e9b95f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating the chaos of modernity with a 3,000-year-old compass]]></title>
            <link>https://medium.com/@christian.marques/navigating-the-chaos-of-modernity-with-a-3-000-year-old-compass-82979e5deb06?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/82979e5deb06</guid>
            <category><![CDATA[quantum-physics]]></category>
            <category><![CDATA[i-ching]]></category>
            <category><![CDATA[digital-wellbeing]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[synchronicity]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Sat, 02 May 2026 22:54:15 GMT</pubDate>
            <atom:updated>2026-05-02T22:54:15.878Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2SPDkrmdLnrlgSyE.jpg" /><figcaption>Zhuang Zhou in front of a waterfall (source: <a href="https://en.wikipedia.org/wiki/Taoism#/media/File:Zhangzi_in_front_of_waterfalls.jpg">Wikipedia</a>)</figcaption></figure><p>We are currently experiencing a profound erosion of cognitive agency, driven not by our technology itself, but by the extractive digital architectures that have come to dominate it. As Jonathan Haidt <a href="https://jonathanhaidt.com/anxious-generation/">explores in <em>The Anxious Generation</em></a>, the “Great Rewiring” of the human psyche has moved us away from intentional presence and into a state of perpetual, fragmented reaction.</p><p>In 2026, the attention economy has reached its peak: a relentless barrage of notifications <a href="https://www.sciencedaily.com/releases/2024/07/240718124709.htm">designed to keep us in a state of reactive “doomscrolling”</a>. Our internal compasses have been hijacked by predictive algorithms that don’t just anticipate our choices — they narrow them into a predetermined funnel that leaves little space for authentic reflection. The challenge of our time isn’t to abandon our devices, but to reclaim them — transforming the screen from a source of noise into a portal for introspection.</p><h3>The Modern Vertigo</h3><p>We are over-stimulated, yet profoundly lost. We have all the world’s “data” at our fingertips, but little clarity. Modern society suffers from a peculiar kind of vertigo: we are fed “answers” before we’ve even formulated our questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6IDVvD8jc4xPS_0C" /><figcaption>Modern life can often feel despairing, with no easy answers (source: <a href="https://unsplash.com/photos/man-hugging-his-knee-statue-IqSaG9zv2e0">Unsplash</a>)</figcaption></figure><p>Search engines and LLMs provide facts, but they cannot provide meaning. In this digital echo chamber, the “self” becomes a data point to be optimized. Here, the art of the <strong>radical pause</strong> — the moment where you simply stop and listen to the internal signal beneath the external noise — has become almost extinct.</p><p>This isn’t a new human struggle; it’s just a faster one. Three thousand years ago, the ancient Chinese sages looked at the chaos of existence and realized that while we cannot control the wind, we can understand the currents. Their solution was the <a href="https://en.wikipedia.org/wiki/I_Ching"><strong><em>I Ching</em></strong> (<em>The Book of Changes</em>)</a>.</p><h3>From Bronze Age Oracles to Binary Logic</h3><p>The <em>I Ching</em> <a href="https://uaya.org/learn/iching/foundations/history/">has spent over three millennia evolving</a> from a series of mysterious symbols used by the Zhou Dynasty into a foundational pillar of global thought. Its origins are a layered blend of mythology and evolution; legend credits the mythical Emperor <strong>Fu Xi</strong> with discovering the eight foundational trigrams from nature’s patterns around 3000 BCE. These were later expanded into the sixty-four hexagrams by <strong>King Wen of Zhou</strong> while he was imprisoned in 1050 BCE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*J0b1gfrYFeSCRKFq" /><figcaption>King Wen of Zhou (source: <a href="https://commons.wikimedia.org/wiki/File:King_Wen_of_Zhou.jpg">Wikimedia</a>)</figcaption></figure><p>Archaeologically, the text emerged from the transition between Bronze Age “oracle bone” divination and the more sophisticated mathematical practice of sorting yarrow stalks. By the time the “Ten Wings” — philosophical commentaries traditionally attributed to <strong>Confucius</strong> — were added, the book had shifted from a simple divination manual into a profound cosmological masterpiece.</p><p>Centuries later, it ignited the Western scientific imagination. <strong>Gottfried Wilhelm Leibniz</strong>, the co-inventor of calculus, <a href="https://www.inverse.com/article/46593-gottfried-wilhelm-leibniz-i-ching-binary-system">discovered that the 64 hexagrams perfectly anticipated the binary logic of 0s and 1s</a>. Long before the first computer was built, the <em>I Ching</em> had already mapped the mathematical DNA of the digital age.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/0*O6XjiA0aA-juwH28.jpg" /><figcaption>372nd birthday of Leibniz and his binary system (Doodle by <a href="https://doodles.google/doodle/gottfried-wilhelm-leibnizs-372nd-birthday/">Google</a>)</figcaption></figure><p>But this structural resonance extends far beyond silicon. Modern thinkers have noted a startling isomorphism between the 64 hexagrams and the <strong>64 codons of the human genetic code</strong>, <a href="https://www.goodreads.com/book/show/78369.The_I_Ching_and_the_Genetic_Code?from_search=true&amp;from_srp=true&amp;qid=MLG3snyT0W&amp;rank=1">suggesting the <em>I Ching</em> may be a biological blueprint</a> as much as a philosophical one. Taking this a step further, visionaries like <strong>Terence McKenna</strong> proposed that the text represents a <strong>fractal of time</strong> — <a href="https://goodreads.com/book/show/191375.The_Invisible_Landscape">a mathematical “Time Wave” that maps the ebb and flow of novelty throughout history</a>. In this view, the <em>I Ching</em> isn’t just a book of advice; it is a map of the very fabric of reality. (if you’re interested in further exploring this last point, feel free to read my article — <a href="https://medium.com/@christian.marques/the-ressurection-of-timewave-zero-276ffcceb23e">The Resurrection of Timewave Zero</a>)</p><h3>A Mirror for the Collective Unconscious</h3><p>In the 20th century, the book shifted from the realm of mathematics to the depths of the human psyche. <strong>Carl Jung</strong> <a href="https://shadowos.io/blog/carl-jung-i-ching-synchronicity">used it to develop his theory of <strong>synchronicity</strong></a>, viewing the oracle as a mirror for the collective unconscious that could reflect a seeker’s inner state through “meaningful coincidence.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/0*tJxc6Mxs5HoLZbOa" /><figcaption>Carl Jung, c. 1935 (source: Wikipedia)</figcaption></figure><p>One of Jung’s primary contributions was this concept of <strong>synchronicity</strong>, which he defined as an <strong>“acausal connecting principle.”</strong> He observed that Western science is almost entirely obsessed with <em>causality</em> — the idea that A must physically cause B. However, Jung realized that the human experience is full of events that are connected by <strong>meaning</strong> rather than cause-and-effect.</p><p>He famously used the example of a patient describing a dream about a golden scarab beetle just as a real scarab-like beetle began tapping on his office window. There was no “cause” for the beetle’s arrival, but the “meaning” of the coincidence was profound. Jung argued that the <em>I Ching</em> operates on this exact same frequency: the “random” toss of the coins isn’t caused by your question, but it is <strong>synchronized</strong> with it.</p><p>Jung viewed a hexagram as a <strong>“snapshot of the moment.”</strong> He believed that whatever is happening at a specific point in time — whether it’s the alignment of the stars, the state of your subconscious, or the fall of the yarrow stalks — all share the same <strong>quality</strong>.</p><p>In <a href="https://www.goodreads.com/book/show/534289.The_I_Ching_or_Book_of_Changes?from_search=true&amp;from_srp=true&amp;qid=SSl7afUbIg&amp;rank=1">his famous foreword to the Richard Wilhelm translation</a>, he compared the <em>I Ching</em> to a photograph: just as a photo captures every detail of a scene in a single instant, the hexagram captures the “psychological weather” of the person asking the question. By consulting the oracle, you aren’t predicting a fixed future; you are becoming conscious of the “present quality” of your life that your ego has been too busy to notice.</p><p>For Jung, the <em>I Ching</em> was the ultimate tool for <strong>individuation</strong> — the process of becoming your true self. He believed that the archetypal images in the 64 hexagrams acted as a mirror for the <strong>Collective Unconscious</strong>. When you read a hexagram, you aren’t reading “fortune telling”; you are looking at a reflection of your own hidden motives, fears, and potentials.</p><p>This resonance made it a staple of the counterculture, <a href="https://en.wikipedia.org/wiki/Music_of_Changes">influencing the avant-garde compositions of <strong>John Cage</strong></a>, the lyrics of <a href="https://www.biroco.com/yijing/dylan.htm"><strong>Bob Dylan</strong></a>,<strong> </strong><a href="https://faroutmagazine.co.uk/beatles-harrison-while-my-guitar-gently-weeps-story-behind-the-song/"><strong>The Beatles</strong></a>, <a href="https://en.wikipedia.org/wiki/Influence_of_the_I_Ching"><strong>Pink Floyd</strong> or <strong>Leonard Cohen</strong></a> and the structural reality of <strong>Philip K. Dick’s</strong> novels — <a href="https://academic.oup.com/litthe/article-abstract/37/2/155/7237524?login=false">who used the <em>I Ching</em> to help create the plot for <em>The Man in the High Castle</em></a>. Other writers like <a href="https://onlinelibrary.wiley.com/doi/abs/10.1111/gequ.70041"><em>Hermann</em> <em>Hesse</em></a><em>, </em><a href="https://en.wikipedia.org/wiki/Influence_of_the_I_Ching"><em>Allen Ginsberg </em>o<em>r Raymond Queneau</em></a><em> </em>explored the <em>I Ching</em> in different ways to expand their literary output<em>. </em>It has never been a static book; it is a living technology for the mind, designed to break the loops of the ego.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*-ag-8JEuOqL2OMHa" /><figcaption>Cover of Music of Changes album, co-composed by the I Ching (source: <a href="https://www.soundohm.com/product/music-of-changes-1">SoundOhm</a>)</figcaption></figure><h3>The Periodic Table of the Psyche</h3><p>The <em>I Ching</em> functions as a mathematical matrix for the 64 fundamental archetypes of change. As <a href="https://en.wikipedia.org/wiki/Hellmut_Wilhelm">Hellmut Wilhelm</a> (son of <a href="https://en.wikipedia.org/wiki/Richard_Wilhelm_(sinologist)">Richard Wilhelm</a>) observed, <em>“The situations depicted in the Book of Changes are the primary data of life — what happens to everybody, every day.”</em></p><p>By stacking eight trigrams — elemental forces like Heaven (initiation), Earth (receptivity), and Thunder (shock) — <a href="https://realitypathing.com/mastering-the-i-ching-a-step-by-step-guide-to-hexagram-analysis/">the system maps every conceivable human scenario</a>. Jung noted that it <em>“does not offer proofs; it only offers perspectives,”</em> acting as a tool to reveal the alignment between our inner state and the outer world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYiJStUJA-WkoQXb_2y53g.png" /><figcaption>How hexagrams are computed using a binary (yin/yang) system</figcaption></figure><p>Unlike static philosophies, this system is inherently kinetic. It tracks the precise moment one archetype evolves into another. In the words of <strong>Richard Wilhelm</strong>, the <em>I Ching</em> views the universe not as a collection of things, but as <em>“a continuous process of change.”</em> Whether navigating a corporate merger in 2026 or a kingdom crisis in 1000 BCE, the underlying patterns of energy remain constant.</p><h3>Bridging the Gap: Why I Built Cleromancer</h3><p>Growing more and more interested in this lineage, I began to see an exciting opportunity. I saw a profound disconnect between this ancient “Book of Changes” and the predictive, narrow-minded algorithms that govern our digital lives. I realized that while our phones are excellent at giving us what we <em>want</em> (more dopamine, more confirmation bias), they are terrible at giving us what we <em>need</em>: a moment of genuine, unconditioned self-reflection.</p><p>I decided to start building <strong>Cleromancer</strong> not as another “app” to be consumed, but as a digital sanctuary — a modern vessel for the “radical pause” that seems to be so necessary nowadays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*Nk1GvmNXHi-T9ky2dOIVQQ.jpeg" /><figcaption>Cleromancer’s welcome screen</figcaption></figure><h4>The Quantum Ritual: Beyond Pseudo-Randomness</h4><p>The first challenge in building this project was the “toss.” In traditional practice, the seeker uses yarrow stalks or bronze (feng shui) coins. This physical ritual isn’t just an aesthetic gimmick, it is the vital bridge between the seeker’s intention and the fundamental unpredictability of the universe. It is a way of inviting Jung’s “meaningful coincidence” into a world that usually feels far too structured.</p><p>Most digital apps attempt to replicate this using “pseudo-random” generators. I initially started with this approach, using standard functions like Math.random(), but I quickly felt a profound sense of cognitive dissonance. These algorithms are essentially clockwork; they are mathematical formulas that are technically deterministic if you know the starting seed. Consulting the <em>I Ching</em> through a standard computer algorithm felt like a hollow gesture—a simulation of chance rather than an encounter with it. It lacked the &quot;weight&quot; of true cosmic synchronicity.</p><p>Serendipitously, while searching for a way to break out of this algorithmic loop, I discovered the <a href="https://random.colorado.edu/"><strong>University of Colorado’s randomness beacon (CURBy)</strong></a>. Unlike a standard computer, <strong>CURBy</strong> generates randomness via a <strong>Bell Test</strong> — a quantum physics experiment involving entangled photons. This isn’t just “very good” randomness; it is <strong>true quantum entropy</strong>. It taps into the inherent non-determinism of the subatomic world — the “spooky action at a distance” that Einstein famously questioned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*nHzir5iydMQ8eRURvBTwLA.jpeg" /><figcaption>Tossing digital coins in Cleromancer</figcaption></figure><p>By integrating this beacon, I was able to replace mechanical chance with the actual, fundamental fluctuations of the cosmos. In <strong>Cleromancer</strong>, the “coin toss” is a digital ritual that ensures every hexagram is not a calculated output, but a unique event emerging from the same unpredictable fabric of reality that the ancient sages sought to understand three thousand years ago. We aren’t just simulating the oracle; we are tapping into the source, and the intention makes a difference.</p><h4>The Mechanics of the Soul</h4><p>In the traditional “Three Coin Method,” the sum of the toss determines if a line is stable or “changing.” These <strong>Changing Lines</strong> are where the real magic of the <em>I Ching</em> happens — they represent energy at its peak, moments where a situation is literally turning into its opposite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*QqLKGIjwFlNqKULbCfwWVw.jpeg" /><figcaption>Changing lines in Cleromancer</figcaption></figure><p>In <strong>Cleromancer</strong>, I wanted to ensure these weren’t just static results. While the app currently focuses on the deep wisdom of individual changing lines, it is designed to treat the <em>I Ching</em> as a kinetic system. The AI models consider the tension of these shifting lines to provide a nuanced, contextual “snapshot” of your inquiry.</p><h4>The LLM as the Modern Sage</h4><p>One of the biggest hurdles for the modern seeker is the language of the classics. The translations by <a href="https://en.wikipedia.org/wiki/James_Legge"><strong>James Legge</strong></a> or <strong>Richard Wilhelm</strong> are masterpieces, but their metaphors can feel distant from the complexities of a 2026 career move or a modern relationship.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*DM5JdZCRYVw4A4r91o3x6g.jpeg" /><figcaption>LLM interpretation on Cleromancer</figcaption></figure><p>I’ve integrated advanced LLMs to act as a bridge. By feeding these models original source texts (of Legge) — and a fresh, automated translation of Wilhelm’s original German specifically commissioned for this project (since I couldn’t obtain the licensing rights to use the original translation)— the AI provides interpretations that remain faithful to the ancient wisdom while speaking to the “here and now.” It offers images and metaphors that act as a mirror for your own intuition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*NPLTNrngPQceRZkvbMynUg.jpeg" /><figcaption>Original I Ching texts (in this case Richard Wilhelm) in Cleromancer</figcaption></figure><h3>Why Every Oracle Needs a Memory</h3><p>If the <em>I Ching</em> is a mirror, then a single reading is merely a glimpse of who you are in a fleeting moment of time. But wisdom doesn’t come from snapshots; it comes from recognizing the patterns in the flow. This is why I am building a <strong>Journaling</strong> feature into <strong>Cleromancer</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*-MNpX2LV929Q8HSmyiS7mA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*vCPYr7b9P6RoxYqI7Zjy3w.jpeg" /><figcaption>Journaling with Cleromancer</figcaption></figure><p>In our current “Feed” culture (Facebook, Instagram, Tiktok), information is designed to be ephemeral — consumed and then instantly replaced by the next notification. Journaling is the antidote to this digital amnesia. By recording your inquiries and your personal interpretations, you are doing more than just “saving data”; you are building a <strong>narrative identity</strong>. You move from asking, <em>“What does this hexagram mean?”</em> to observing, <em>“How have I shifted since the last time I encountered this archetype?” or “How was I feeling when the oracle gave me these answers?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*aTMRy765jYRBdmfVf-y4AQ.jpeg" /><figcaption>Keeping track of all your readings with Cleromancer</figcaption></figure><p>For the <strong>curious</strong>, the journal is a playground for self-discovery. For the <strong>expert</strong>, it is a rigorous log of synchronicity at work. It allows you to turn a series of “meaningful coincidences” into a coherent map of personal growth.</p><h3>Privacy as a Spiritual Requirement</h3><p><strong>Cleromancer</strong> is built with a <strong>privacy-first approach</strong>. Through server-managed encryption, your intentions and reflections are secured from the moment you type them. This is an ethical stance rather than just a gimmick. Your journey of self-reflection should be yours alone, accessible across your devices but invisible to the rest of the world, and this data should NOT be used for any commercial ventures, other than your own self-explorations.</p><h3>The Oracle is a Mirror, Not a Clairvoyant</h3><p><strong>Cleromancer</strong> is a passion project — a one-person endeavor to keep this 3,000-year-old flame alive in a digital world. I built this to be an inclusive home for every level of inquiry: it is for the <strong>curious</strong> looking for a sanctuary from digital noise, the <strong>beginner</strong> seeking a guided entry point into the 64 archetypes, and the <strong>expert</strong> who demands the technical rigor of quantum entropy and classical scholarship.</p><p>Beyond a personal tool for my own self-exploration, I see this project as an educational mission to promote the <em>I Ching</em> as the fascinating and profoundly useful compass that it is. I believe that even in an age of artificial intelligence, these ancient patterns remain our most reliable maps for the human condition and possibly become more relevant (and accessible) than ever before.</p><p>As the roadmap evolves — moving toward a digital recreation of the traditional <strong>50-yarrow-stalk method</strong> and deeper journaling features — the core mission remains the same. The <em>I Ching</em> does not offer proofs; it only offers perspectives. In a world that demands your attention every millisecond, giving yourself the space to reflect is a revolutionary act. The universe is in constant motion, and <strong>Cleromancer</strong> is simply here to help you learn how to flow with it.</p><p>You can begin your own journey at <a href="http://www.cleromancer.app/">www.cleromancer.app</a> or <a href="https://play.google.com/store/apps/details?id=app.vercel.cleromancer">download the mobile app on the <strong>Google Play Store</strong></a>, with an <strong>iOS version</strong> currently in development and coming soon (depending on adoption).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*Up4c1OzNrkx9w4kEVwCumQ.gif" /><figcaption>A short demo of Cleromancer, feel free to try out the real app for yourself</figcaption></figure><p><strong>Cleromancer is now available for the modern seeker.</strong> <em>Version 0.2.30</em> <em>Quantum-powered. Privacy-focused. Ancient-inspired.</em></p><blockquote>“The Book of Changes contains the measure of heaven and earth; therefore it enables us to comprehend the tao of heaven and earth and its order.” — <strong>The Ten Wings</strong> (Confucian Commentaries)</blockquote><h3>References</h3><ul><li><a href="https://www.cleromancer.app/en/about">Cleromancer app</a>, 2026</li><li><a href="https://jonathanhaidt.com/anxious-generation/">The Anxious Generation</a> — Jonathan Haidt, 2024</li><li><a href="https://www.sciencedaily.com/releases/2024/07/240718124709.htm">Can doomscrolling trigger an existential crisis?</a> — Flinders Uni., 2024</li><li><a href="https://en.wikipedia.org/wiki/I_Ching">I Ching</a> — Wikipedia, 2026</li><li><a href="https://uaya.org/learn/iching/foundations/history/">History of the I Ching</a> — Uaya Foundation, 2026</li><li><a href="https://www.inverse.com/article/46593-gottfried-wilhelm-leibniz-i-ching-binary-system">Gottfried Wilhelm Leibniz: How the ‘I Ching’ Inspired His Binary System</a> — Mary von Aue, 2018</li><li><a href="https://www.goodreads.com/book/show/78369.The_I_Ching_and_the_Genetic_Code?from_search=true&amp;from_srp=true&amp;qid=MLG3snyT0W&amp;rank=1">The I Ching and the Genetic Code: The Hidden Key to Life</a> — Martin Schönberger, 1979</li><li><a href="https://goodreads.com/book/show/191375.The_Invisible_Landscape">The Invisible Landscape: Mind, Hallucinogens and the I Ching</a> — Terence McKenna, 1975</li><li><a href="https://www.goodreads.com/book/show/534289.The_I_Ching_or_Book_of_Changes?from_search=true&amp;from_srp=true&amp;qid=SSl7afUbIg&amp;rank=1">The I Ching or Book of Changes</a> — Anonymous, Richard Wilhelm (Translator), 1851</li><li><a href="https://www.psychologytoday.com/us/blog/the-justice-and-responsibility-league/201703/impact-of-the-i-ching-on-carl-g-jung-its">Impact of the I Ching on Carl G. Jung &amp; its implications</a> — Key Sun Ph.D., 2017</li><li><a href="https://www.ichingtlv.com/post/carl-jung">Carl Jung and the I Ching: A tool, not a belief system</a>— Marine S, 2025</li><li><a href="https://shadowos.io/blog/carl-jung-i-ching-synchronicity">Carl Jung and the I Ching: Understanding Synchronicity</a> — Shadow OS, 2026</li><li><a href="https://en.wikipedia.org/wiki/Music_of_Changes">Music of Changes</a> — Wikipedia, 2026</li><li><a href="https://www.biroco.com/yijing/dylan.htm">Bob Dylan and the I Ching</a> — Steve Marshall, 2025</li><li><a href="https://faroutmagazine.co.uk/beatles-harrison-while-my-guitar-gently-weeps-story-behind-the-song/">The Story Behind The Song: The cosmic Eastern influence in ‘While My Guitar Gently Weeps’ by The Beatles</a> — Pubali Dasgupta, 2020</li><li><a href="https://academic.oup.com/litthe/article-abstract/37/2/155/7237524?login=false">Decay, Death, and the Return of Light: The I Ching Yin-Yang Cycle in Philip K. Dick’s The Man in the High Castle</a> — John T P Lai, 2023</li><li><a href="https://onlinelibrary.wiley.com/doi/abs/10.1111/gequ.70041">Hermann Hesse’s Das Glasperlenspiel and I Ching</a> — Chunhua Zhan, 2026</li><li><a href="https://en.wikipedia.org/wiki/Influence_of_the_I_Ching">Influence of the I Ching</a> — Wikipedia</li><li><a href="https://realitypathing.com/mastering-the-i-ching-a-step-by-step-guide-to-hexagram-analysis/">Mastering the I Ching: A Step-by-Step Guide to Hexagram Analysis</a> — Reality Pathing, 2024</li><li><a href="https://random.colorado.edu/">CURBy — CU Randomness Beacon</a> — Department of Physics, University of Colorado, Boulder</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82979e5deb06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ressurection of Timewave Zero]]></title>
            <link>https://medium.com/@christian.marques/the-ressurection-of-timewave-zero-276ffcceb23e?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/276ffcceb23e</guid>
            <category><![CDATA[history]]></category>
            <category><![CDATA[mysticism]]></category>
            <category><![CDATA[terence-mckenna]]></category>
            <category><![CDATA[fractals]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Sun, 22 Mar 2026 11:45:25 GMT</pubDate>
            <atom:updated>2026-03-22T16:52:05.248Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MwCUVFgx5OM7xAPn" /><figcaption>Timelapse photo from <a href="https://unsplash.com/@joegeek">Zhanjiang Chen</a> (source: Unsplash)</figcaption></figure><p>This article is mostly about showcasing a web-app called <a href="https://time-wave-zero.vercel.app/"><strong>Timewave Zero Explorer</strong></a>, but before we go to that, there is a little story to tell:</p><h4>From militant atheism to agnostic pantheism</h4><p>Twenty years ago, my worldview was a fortress of scientific materialism. Shaken loose from a traditional Catholic upbringing and the Sunday school of my youth — which mostly succeeded in pushing me in the opposite direction — I embraced a militant atheism that in retrospective, was as rigid as it was arrogant. To my younger self, the “supernatural” was a category error, and I took pride in dismissing any mystery that couldn’t be quantified or observed.</p><p>But, as it progresses, life has a way of dismantling even the most well-fortified worldviews, and for me, the crack in the wall arrived from a series of collisions with the “weird” side of existence in the form of impactful emotionally humbling life experiences.</p><p>More or less around the same time, and in parallel, the more I delved into science, the more reality became surreal and hard to accept as a mere product of large number randomness and probability. This started during my university years, learning about <a href="https://en.wikipedia.org/wiki/Chaos_theory">chaos theory</a>’s <a href="https://en.wikipedia.org/wiki/Attractor">strange attractors</a> and the exquisite recursive patterns that hide within the heart of randomness like a secret cosmic language (also see my recent article “<a href="https://medium.com/@christian.marques/the-ghost-in-the-mandelbrot-2ea6784e9153">The Ghost in the Mandelbrot</a>” on the same topic). I was also “strangely attracted” to the quantum discoveries that showed that the fundamental building blocks of reality are made not of “stuff” but of observer-dependent probabilities. There was this unsettling, “unreasonable effectiveness” to physics and mathematics that became hard to ignore — the sense that the cosmos could be a manuscript written in a code we were only just beginning to decipher, maybe an over-simplification from a computer science driven mind, but yet, something hard to shake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/0*Pjy3Ybj_xgAt5Pjs" /><figcaption>A <a href="https://en.wikipedia.org/wiki/Conus_textile">conus textile</a> shell, similar in appearance to <a href="https://en.wikipedia.org/wiki/Rule_30">Rule 30</a>, a <a href="https://en.wikipedia.org/wiki/Cellular_automaton">cellular automaton</a> with chaotic behaviour (source: <a href="https://en.wikipedia.org/wiki/File:Textile_cone.JPG">Wikipedia</a>)</figcaption></figure><p>I eventually found some of my answers in <a href="https://en.wikipedia.org/wiki/Baruch_Spinoza"><strong>Baruch Spinoza</strong></a><strong>’s idea of </strong><a href="https://en.wikipedia.org/wiki/Pantheism"><strong>Pantheism</strong></a>, which offered a possible path forward for someone like me: a way to remain a rationalist without being a reductionist. Spinoza didn’t ask me to believe in a bearded man in the sky, he asked me to recognize that Nature and God might be one and the same — a single, infinite, and logical <a href="https://iep.utm.edu/substanc/#SH3a"><strong>Substance</strong></a><strong> </strong>(“<em>Deus sive Natura”</em>). Suddenly, the universe didn’t have to be a cold, empty room where things happened by accident. It could very well be a vast, deterministic masterpiece of which I was a tiny, self-reflecting part, a zoomed-in piece of a great impossible fractal, which made everything much more interesting and palatable (at least for me, personally).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ncmrm7WYIkEw6fjIUH4epw.png" /><figcaption>Baruch Spinoza’s Pantheism (Image generated by Google Nano Banana 2)</figcaption></figure><h4>Discovering McKenna and the Timewave Zero</h4><p>During this period, I discovered <a href="https://en.wikipedia.org/wiki/Terence_McKenna">Terence McKenna</a>, first via “<a href="https://www.goodreads.com/book/show/51660.Food_of_the_Gods">Food of the Gods: The Search for the Original Tree of Knowledge</a>”, but soon becoming completely engrossed by this crazy (in a good way) man’s writings and theories, moving on avidly through his other writings and audio recordings.</p><p>Soon, amidst this fever-dream I bumped into McKenna’s idea of <a href="https://www.fractal-timewave.com/">Timewave Zero</a> (when reading “<a href="https://goodreads.com/book/show/191375.The_Invisible_Landscape">The Invisible Landscape: Mind, Hallucinogens &amp; the I Ching</a>”) — a sort of “mathematical map of history,” a fractal waveform derived from the 64 hexagrams of the <a href="https://en.wikipedia.org/wiki/I_Ching"><em>I Ching</em></a> that tracks the shifting ratio between <strong>Novelty</strong> (complexity and connectivity) and <strong>Habit</strong> (stagnation and entropy). The theory posits that time might not be a linear march but a recursive, self-similar spiral where historical patterns repeat at ever-accelerating scales (some ideas metaphorically borrowed from <a href="https://en.wikipedia.org/wiki/Albert_Einstein">Einstein</a>’s <a href="https://en.wikipedia.org/wiki/General_relativity">General Relativity</a>). This “<a href="https://en-academic.com/dic.nsf/enwiki/397769">Novelty Theory</a>” ultimately predicts a singularity — a point of infinite density where the rate of change becomes so high that history itself reaches a state of “<strong>concrescence</strong>,” pulling all of existence toward a single, transformative destination at the end of the wave.</p><p>This idea was conceived in 1971 at La Chorrera — a remote outpost in the Amazon — where brothers Terence and <a href="https://en.wikipedia.org/wiki/Dennis_McKenna">Dennis McKenna</a>, fueled by <a href="https://en.wikipedia.org/wiki/Psilocybin_mushroom">psilocybin</a> experiences and a conviction that the universe was a nested hierarchy of patterns, sought to “<em>de-occult</em>” the <em>I Ching</em>.</p><p>McKenna’s attraction to the <em>I Ching</em> placed him in a long lineage of “<em>pattern-seekers</em>” who saw the ancient oracle not as a superstitious relic, but as a sophisticated <strong>operating system for reality </strong>(this metaphor is also interesting <strong>, </strong>since McKenna was also a child of the <a href="https://en.wikipedia.org/wiki/Psychedelic_era">70’s psychedelic movement</a> and the <a href="https://www.theguardian.com/commentisfree/2011/sep/06/psychedelics-computer-revolution-lsd">computer science revolution in many ways</a><strong>).</strong> Much like <a href="https://en.wikipedia.org/wiki/Carl_Jung"><strong>Carl Jung</strong></a>, who famously championed the <em>I Ching</em> as the ultimate laboratory for his theory of <a href="https://en.wikipedia.org/wiki/Synchronicity"><strong>Synchronicity</strong></a>, McKenna (like many <em>I Ching</em> users) believed the 64 hexagrams represented the fundamental archetypes of all possible change. He also shared a kinship with <a href="https://en.wikipedia.org/wiki/Philip_K._Dick"><strong>Philip K. Dick</strong></a>, who utilized the book to navigate the “shifted realities” of his novels, seeing it as a tool to peel back the veil of linear time (it is said that he might have used it to build up the plot for “<a href="https://www.goodreads.com/book/show/216363.The_Man_in_the_High_Castle">The Man in the High Castle</a>”).</p><p>For McKenna, however, the fascination was uniquely structural: he viewed the <em>I Ching</em> as a mathematical “lunar calendar” and a binary code that predated modern computing by millennia. He looked at it for the <strong>formal logic of the Infinite Substance</strong>, convinced that the Chinese sages had successfully mapped the fractal “texture” of time itself.</p><p>By mapping the transitions of the <a href="https://en.wikipedia.org/wiki/King_Wen_sequence">King Wen sequence</a> of 64 hexagrams into a set of 384 discrete data points, <a href="https://www.fractal-timewave.com/articles/derivation_10.htm">they “discovered” a fractal wave that they believed governed the flow of novelty through the “<strong>Infinite Substance</strong>”</a> (a very Spinozan idea) of time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*oUVw8s2FE5Sp_G1u.jpg" /><figcaption>Terence McKenna going to La Chorrerra (1971) (source: <a href="https://wilderutopia.com/,">Wilderutopia</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/112/0*Spa5QNggj88899EG.gif" /><figcaption>The 64 Steps: Decoding the Ancient Binary of the I Ching into Data. (source: <a href="https://www.fractal-timewave.com/articles/derivation_10.htm">Peter Meyer’s website)</a></figcaption></figure><p>While exploring this idea of a time fractal, McKenna became convinced that history was not a random walk, but a <a href="https://en.wikipedia.org/wiki/Teleology">teleological pull </a>toward a fixed point of infinite complexity. He initially calculated this “<strong>Zero Date</strong>” through his own mathematical scaffolding, but it was the startling alignment with the <a href="https://en.wikipedia.org/wiki/Mesoamerican_Long_Count_calendar">Mayan Long Count calendar</a> that solidified his vision.</p><p>By anchoring his wave to <strong>December 21, 2012</strong>, McKenna bridged two vastly different ancient systems — the <em>I Ching</em> and Mayan cosmology — suggesting they had both independently decoded the same “spiral of time.” For him, this wasn’t about a literal, cinematic apocalypse; it was about <strong>“concrescence.”</strong> He envisioned a moment where the density of information and novelty would become so extreme that reality itself would undergo a phase transition, collapsing into what he called the <a href="https://trance-scripts.com/2025/05/21/the-transcendental-object-at-the-end-of-time/"><strong>Transcendental Object at the End of History</strong></a><strong>.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhL0yfxDe6jE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhL0yfxDe6jE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhL0yfxDe6jE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d412ab42e137f4cc8fe30d2007484392/href">https://medium.com/media/d412ab42e137f4cc8fe30d2007484392/href</a></iframe><p>Originally published in “<a href="https://goodreads.com/book/show/191375.The_Invisible_Landscape">The Invisible Landscape: Mind, Hallucinogens &amp; the I Ching</a>” (1975) the theory remained a series of dense, manual calculations until it met the technical rigor of <a href="https://www.fractal-timewave.com/"><strong>Peter Meyer</strong></a>. In the late 1980s, Meyer became the project’s essential architect, translating the McKennas’ abstract intuitions into the “<a href="https://www.fractal-timewave.com/the_ft_sw.php"><strong>Fractal Time</strong></a>” software for <a href="https://en.wikipedia.org/wiki/MS-DOS">MS-DOS</a>. He was the one who codified the mathematical nuances to ensure the algorithm could actually run on a processor. Meyer’s work transformed the Timewave from a poetic fragment into a functional, digital artifact, preserving the code that allowed it to survive as a cult phenomenon long after the 2012 terminal point passed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*BPZpoM2sonmWy1xU.png" /><figcaption>A screenshot of the <em>Timewave Zero</em> software (written by Peter J. Meyer) showing the timewave for the 25 years preceding a zero date of December 21, 2012 (source: Wikipedia)</figcaption></figure><h4>Ressurecting the Timewave</h4><p>Recently, I had a resurgence of curiosity and fascination with the I-Ching. In the several explorations and experiments I wanted to do with this fascinating ancient oracle, I suddenly felt the urge to find a modern Timewave Zero explorer on the web. Despite finding a few, I felt there was a lack of a comprehensive and modern-looking implementation, so I decided to delve into the maths and build my own.</p><p>The original Timewave Zero software, refined by Peter Meyer in the late 80s, was a product of its time — built for low-resolution CRT monitors and MS-DOS environments. My objective was to resurrect this artifact not just as a static port, but as a living <strong>3D immersive experience.</strong></p><p>I chose a stack that could handle the heavy lifting of fractal math while maintaining a fluid, “cyberpunk-ish” user experience. I used <strong>React 18</strong> and <strong>TypeScript</strong> as a foundation, using <strong>Vite</strong> for fast development. But the real magic happens in the visualization layer:</p><ul><li><strong>The 3D Logarithmic Vortex:</strong> Using <strong>Three.js</strong> (w/React Three Fiber), I transformed the 1D timeline into a “compressing gyre”. History is no longer a flat line; it is a converging spiral. As you navigate toward the “Concrescence,” the camera dives deeper into the fractal, using some post-processing effects to simulate the intensity of increasing novelty.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*qSpUVJKw3ujLw9IYhHZ1TQ.gif" /><figcaption>The 3D Logarithmic Vortex — explore the timewave as a spiral converging to the “end of human history” at December 21st, 2012</figcaption></figure><ul><li><strong>High-Performance 2D Plotting:</strong> For the rationalist, and to keep the original working solution, I kept a precise <strong>2D Cartesian plot</strong>. Optimized with a high-performance <strong>Canvas rendering system</strong>, it allows for deep historical analysis without the lag typically associated with rendering thousands of fractal data points.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ae4XZgQmfHTKLsw6nGsqug.png" /><figcaption>Timewave Zero Explorer — 2D plot — you can move the mouse to examine the novelty factor on valleys and peaks and use the Find Rhyme button to explore a point in time with its fractal predecessors.</figcaption></figure><p>The mathematical core remains faithful to the <strong>King Wen sequence</strong>. The wave is generated by a <strong>384-point data set</strong> (64 hexagrams × 6 lines), which is then layered onto itself through fractal summation. In the code, this requires navigating scales that are <strong>powers of 64</strong> — ranging from a few days to 22 billion years.</p><p>Scale=64^n</p><p>At each level of magnification, the wave repeats its jagged signature, a mathematical echo that suggests the universe is built on self-similar patterns.</p><p>Perhaps the most “<em>2026</em>” addition to the project is the playful feature of the<strong> AI Archaeologist</strong>, or the “<em>Steward of the </em><a href="https://en.wikipedia.org/wiki/Noosphere"><em>Noosphere</em></a><em>” </em>(yes, nerdy). By integrating an LLM, the explorer does more than just show a curve — it interprets it. The Steward analyzes cross-era data to find <strong>“</strong><a href="https://norsemythologist.com/what-is-the-bifrost/"><strong>Bifrost Bridges</strong></a><strong>”</strong> (yes, more nerdy)— points where the mathematical signature of the deep past “rhymes” with the present. It’s a tool designed to hunt for the <strong>Jungian synchronicities</strong> I once dismissed as mere coincidence and now find fascinating to look at (even though they might still be a mere coincidence).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*u9JxlMGKxHU5VC34nHUGZA.gif" /><figcaption>Exploring the “Find a Rhyme” in the Timewave Zero explorer — given a date, the Steward of the Noosphere helps you find a resonance in time</figcaption></figure><p>Finally, I wanted to add some extra dimensions to the “Substance”:</p><ul><li><strong>Real-time sonification:</strong> Using the <strong>Web Audio API</strong>, I translated the novelty values into a procedural soundscape. When novelty is low (Habit), the audio is a steady, harmonic drone. As novelty spikes, the audio becomes complex, glitchy, and creative — a literal <strong>“sound frequency of creativity.</strong></li></ul><p>Resurrecting the Timewave has proven to be an educational and mystical experience, and more than just a code experiment it was also about resurrecting an obscure idea from the Amazonian jungle to be refined into a high-performance instrument for observing the “<em>infinite masterpiece</em>” Spinoza described. For me personally this proved to be a fascinating journey that allowed me to learn more about mathematical coincidences and the weird place where mathematics meets the mystical side of things (also in the line of my previous article about exploring the Buddhabrot, “<a href="https://medium.com/@christian.marques/the-ghost-in-the-mandelbrot-2ea6784e9153">The Ghost in the Mandelbrot</a>”) .</p><h4>Conclusion</h4><p>Terence McKenna passed away in 2000, never living to see the final descent of his wave or the quiet morning of December 22, 2012, when the world — to all outward appearances — remained stubbornly unchanged. In the immediate aftermath, the Timewave was largely dismissed by critics as a masterclass in confirmation bias, a 64-bit Rorschach test for the mathematically inclined and pseudo-science insanity.</p><p>Yet, as we navigate the hyper-accelerated landscape of 2026, a deeper question remains on my curious mind: <strong>What if the “Singularity” isn’t a single explosive event, but a threshold we have already crossed?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3xX52WsaK2LLSvfr" /><figcaption>The Garden of Earthly Delights by Hieronymus Bosch — might we already be living in the Singularity, with no return? (source: <a href="https://www.thecollector.com/decoding-garden-earthly-delights-hieronymus-bosch/">The Collector</a>)</figcaption></figure><p>Looking through the lens of my explorer, the increasing “weirdness” of our era — the recursive explosion of Artificial Intelligence, the jagged volatility of global geopolitics, and the sense that history is being compressed into a blindingly dense present — suggests that McKenna’s “<strong>Transcendental Object</strong>” might not be a destination, but an environment we are currently inhabiting. Perhaps the Zero Date wasn’t a physical apocalypse, but a point of no return in the <strong>Infinite Substance</strong> of time. Whether the Timewave is a literal law of nature or a beautifully flawed map of the <strong>Collective Unconscious</strong>, it remains a gripping testament to our search for meaning and how sometimes mathematics and human culture bend into some very strange “coincidences” (or maybe it’s again, just pareidolia). It invites us to consider that even if the clock didn’t strike midnight, we might nonetheless be living in the “<strong>Concrescence</strong>,” spiraling ever faster toward a logic we are only just beginning to decode — who knows what expects us now that the ghost is out of the machine? What do you think of this whole crazy idea? Leave a comment and enjoy the Timewave Zero explorer :)</p><h4>About the project</h4><p>Try the <a href="https://time-wave-zero.vercel.app/">Timewave Zero Explorer</a> for yourself!</p><p>The <a href="https://github.com/electricganesha/timewavezero">code to the project is open-source </a>— feel free to scrutinize, improve and repurpose it for your own explorations :)</p><h4>References</h4><ul><li>“<a href="https://goodreads.com/book/show/191375.The_Invisible_Landscape">The Invisible Landscape: Mind, Hallucinogens &amp; the I Ching</a>” — Terence McKenna, Dennis J. McKenna (1975)</li><li><a href="https://www.fractal-timewave.com/">Terence McKenna’s Timewave Zero Theory</a></li><li><a href="https://iep.utm.edu/substanc/">17th Century Theories of Substance</a></li><li><a href="https://en-academic.com/dic.nsf/enwiki/397769">Novelty theory</a></li><li><a href="https://trance-scripts.com/2025/05/21/the-transcendental-object-at-the-end-of-time/">The transcendental object at the end of time</a></li><li>“<a href="https://www.theguardian.com/commentisfree/2011/sep/06/psychedelics-computer-revolution-lsd">Did the use of psychedelics lead to a computer revolution?</a>” — Wendy M Grossman</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=276ffcceb23e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ghost in the Mandelbrot]]></title>
            <link>https://medium.com/@christian.marques/the-ghost-in-the-mandelbrot-2ea6784e9153?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ea6784e9153</guid>
            <category><![CDATA[computer-graphics]]></category>
            <category><![CDATA[fractals]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[webgpu]]></category>
            <category><![CDATA[buddhism]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 00:24:31 GMT</pubDate>
            <atom:updated>2026-02-23T00:32:08.254Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyl3iYVDy5v7ao54Sr4iqA.png" /><figcaption>The Buddhabrot rendered with three.js and WebGPU compute shaders</figcaption></figure><p>A class called Artificial Life given by professor <a href="https://www.di.fc.ul.pt/~lcorreia/">Luís Correia</a> in the University of Lisbon, back in 2009, introduced me to the work of <a href="https://www.stephenwolfram.com/">Stephen Wolfram</a> (A New Kind of Science) and <a href="https://en.wikipedia.org/wiki/Chaos_theory">Chaos theory</a> (the idea that simple rules can lead to complex and unpredictable results in nature). This influential class (and possibly one of my favorites throughout my whole education) often brings me to research these topics a bit further and continue to be eternally fascinated by the strange coincidences in mathematics and the universe.</p><p>Recently (and often enough) I found myself going down the rabbit hole of <a href="https://en.wikipedia.org/wiki/Mandelbrot_set">Mandelbrot fractals</a>, mostly for their intriguing psychedelic visual impact and fascinating history (<a href="http://en.wikipedia.org/wiki/Benoit_Mandelbrot">Benôit Mandelbrot</a> not only coined the term “fractal” but also delved into geological phenomena — like the ruggedness of coastlines — and studied financial markets, trying to find patterns that proved Chaos Theory), I stumbled upon yet another incredible related discovery — the <a href="https://superliminal.com/fractals/bbrot/">Buddhabrot</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*aKkOrNYO_l-vCse8co7CVA.gif" /><figcaption>Zooming into the Mandelbrot set’s so-called ‘Seahorse Valley’, with high iteration. (source: <a href="https://en.wikipedia.org/wiki/Mandelbrot_set">Wikipedia</a>)</figcaption></figure><p>While a lot of people might be familiar with the <a href="https://en.wikipedia.org/wiki/Mandelbrot_set">Mandelbrot set</a> and <a href="http://en.wikipedia.org/wiki/Benoit_Mandelbrot">Benôit Mandelbrot</a>’s super influential book<strong> “</strong><a href="https://en.wikipedia.org/wiki/The_Fractal_Geometry_of_Nature"><strong>The Fractal Geometry of Nature</strong></a>”, I think few people (like myself) might never have heard of the <strong>Buddhabrot</strong>, often referred to as “<em>the shadow</em>” of the Mandelbrot set.</p><p>So it goes that in <strong>1993 </strong>(11 years after Mandelbrot’s seminal work was published), a researcher named <a href="https://superliminal.com/"><strong>Melinda Green</strong></a> decided to look at the Mandelbrot set from the opposite direction. Instead of coloring a pixel based on the <em>result</em> , she began tracking the <strong>histogram of the orbits</strong>. She realized that the points that fly off to infinity leave behind a “<em>trail</em>” of coordinates on the complex plane.</p><p>Melinda Green’s breakthrough was essentially an <strong>“<em>inverse</em>” rendering technique</strong>. By treating the complex plane as a vast grid and incrementing a counter every time an orbit passed through a “<em>cell</em>,” she created a density map of chaotic motion.</p><p>When the first low-resolution renders emerged, the community was both stunned and puzzled. The “<em>Mandelbrot set histogram</em>” (as it was originally called) didn’t look like a geometric shape; it looked like a biological entity or a divine figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vFhP_G00_WtsGMSD.png" /><figcaption>A <em>Buddhabrot</em> iterated to 20,000 times. (source: Wikipedia)</figcaption></figure><p>The name <strong>“Buddhabrot”</strong> was later coined by researcher Dr. <a href="https://linas.org/">Linas Vepstas</a>, who recognized the pareidolia effect (recognizing nonexistent patterns) of a seated deity in deep meditation, very much resembling the famous image of Siddharta Gautama in meditation. While the Mandelbrot set is often described as the “<a href="https://www.spiritualarts.org.uk/mandelbrot-and-the-mind-of-god-the-spiritual-implications-of-fractal-mathematics/">Thumbprint of God</a>,” the Buddhabrot became its spiritual counterpart — a visualization of the “path” or “journey” rather than the destination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/0*0THrfYfTqQphO83k" /><figcaption>Siddhartha Gautama’s famous depiction (from Public Domain Super Heroes)</figcaption></figure><p>Later, researcher <a href="https://www.linkedin.com/in/lori-gardi-a28baa2a/?originalSubdomain=ca"><strong>Lori Gardi</strong></a> expanded this concept into the <strong>“Juddhabrot,”</strong> exploring the fractal’s existence as a 2D projection of a much larger, 4D mathematical object. This historical evolution shifted the Buddhabrot from a mere “plotting trick” to a significant subject of study in both high-dimensional geometry and mysticism (two very contrasting fields that overlap more often than most people might realize).</p><p>And so, also encouraged by my recent experiments with <a href="https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language">TSL</a> and <a href="http://en.wikipedia.org/wiki/WebGPU_Shading_Language">WebGPU</a>, I wondered if it would be possible to render this Buddhabrot using these technologies (considering the recently unlocked power of <a href="https://wikis.khronos.org/opengl/Compute_Shader">WebGPU compute shaders</a>), and thus the <a href="https://buddhabrot.vercel.app/"><strong>Buddhabrot WebGPU Explorer</strong></a><strong> </strong>was born.</p><h3>The maths side</h3><p>To understand the Buddhabrot, I first had to look at the classic fractal equation: <strong>Zn+1​=Zn2​+C</strong>.</p><p>In a standard Mandelbrot render, a pixel is colored based on <em>how fast</em> it escapes. In the Buddhabrot, we need to ignore the points that stay trapped. Instead, we take the “<em>escapers</em>” and re-trace their entire flight path. Every time a point’s orbit passes through a coordinate, we increase that pixel’s brightness.</p><p>The end result is a sort of probability map. The glowing areas are “<em>high-traffic</em>” zones — crossroads where the chaotic paths to infinity most frequently intersect.</p><p>In every iteration, we are essentially testing the “<em>loyalty</em>” of a point <strong>C</strong> to the origin.</p><p>While in a standard fractal, once we know a point escapes, we simply count how many steps it took and color that single pixel, in Buddhabrot we need to be much more “<em>obsessive</em>.” Once a point is identified as an escaper, we need to “<strong><em>rewind time</em></strong>”.</p><p>We start the iteration over and track every single <strong>(Zr,Zi)</strong> coordinate the point visited on its way out. We treat the screen like a black canvas, and every step of that point’s journey is like a glowing grain sand dropped onto a specific coordinate.</p><p>When you repeat this process for millions of random points, a complex density map starts to emerge and the hard to believe “Buddha” shape is actually an emerging property of these patterns. It seems that even though these orbits want to head towards infinity and chaos, they actually tend to cluster and spiral around the same mathematical structures (called “<a href="https://en.wikipedia.org/wiki/Attractor"><em>attractors</em></a>” in Chaos theory) on the way out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*RUnUjMz78Xgo2YrulvpSRg.gif" /><figcaption>The Buddha shape emerging from the void as we increase the iterations (and complexity of the simulation)</figcaption></figure><p>By plotting the “<strong>journey</strong>” instead of the “<strong>destination</strong>”, we see emerge an ethereal “<strong>probabilities landscape</strong>” which is both kind of unbelievable and beautiful to admire.</p><h3>The engineering side</h3><p>Rendering a high-quality Buddhabrot is computationally expensive. You aren’t just checking one point per pixel; you are simulating millions of “<em>flight paths</em>,” each potentially thousands of iterations long.</p><p>Most fractal explorers use <a href="https://wikis.khronos.org/opengl/Fragment_Shader">fragment shaders</a>, where each thread calculates the color of exactly one pixel. This fails for the Buddhabrot because a single point <strong>C</strong> can influence thousands of different pixels across the screen as it orbits.</p><p>I wanted to use this project<strong> </strong>as an excuse to explore<strong> </strong><a href="https://developer.chrome.com/docs/capabilities/web-apis/gpu-compute"><strong>WebGPU Compute Shaders</strong></a><strong> </strong>for the first time and expand a bit on my experience with <a href="https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language">TSL</a> (I’m really loving the ease of writing shaders with this versus <a href="https://wikis.khronos.org/opengl/Core_Language_(GLSL)">GLSL</a>). The idea would be to each GPU thread to pick a random starting point , simulate its entire journey, and then &quot;<em>drop a grain of light</em>&quot; into a global density texture whenever an orbit passes through a coordinate.</p><p>To save GPU cycles, we rely on a dual-pass logic:</p><ul><li><strong>A validation pass</strong>, where we quickly iterate the point to see if it escapes within the maximum limit. If it stays trapped (inside the Mandelbrot set), we discard it immediately.</li><li><strong>A tracing pass </strong>where, if the point escapes, we reset it and run the simulation again. This time, we write to the buffer. This ensures we don’t waste memory bandwidth on points that don’t contribute to the “ghost”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*XTyUmAyCyqWx03Ac-FMTag.gif" /><figcaption>Zooming further into the fractal, diving into recursive Buddhas</figcaption></figure><p>Since Math.random() isn&#39;t available in shaders (both GLSL and TSL), we used a custom <a href="https://en.wikipedia.org/wiki/Xorshift"><strong>Xorshift32 PRNG</strong></a>, and instead of injecting Math.random()as a uniform, I wanted to try and integrate<strong> </strong><a href="https://random.colorado.edu/"><strong>CURBy quantum pulse</strong></a>, both because I was curious about the project, but I also thought it could be interesting to bring a bit of real universal randomness to add to the mystical side of this project.</p><h4>A bit more about CURBy and why it’s special</h4><p>In most digital art, “randomness” is an illusion. Standard libraries like <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random">Math.random()</a> or <a href="https://en.wikipedia.org/wiki/Permuted_congruential_generator">PCG</a> use deterministic algorithms—if you know the starting seed and the algorithm, you can predict every &quot;random&quot; number for the next billion years. In the context of a fractal, this means the supposed &quot;chaos&quot; is actually a predetermined clockwork.</p><p>As mentioned before, on this project, I wanted to put in something truly unpredictable: the <a href="https://random.colorado.edu/"><strong>Colorado University Randomness Beacon (CURBy)</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kwuiU5NOzJTUOlIu.jpg" /><figcaption>Quantum physics — behavior and interaction of tiny particles (source: <a href="https://www.publicdomainpictures.net/en/view-image.php?image=541320&amp;picture=quantum-physics-waves-and-particles">Public Domain Pictures</a>)</figcaption></figure><p>CURBy is a public service (and API) that provides high-entropy “pulses” generated through <a href="https://en.wikipedia.org/wiki/Bell%27s_theorem"><strong>Bell-certified quantum entanglement</strong></a>. They provide verifiable, inherently non-deterministic randomness by deriving bits from the fundamentally unpredictable behavior of entangled photons and providing a mathematical certificate to prove the results are unbiased.</p><p>We use CURBy in practice by injecting a 512-bit quantum pulse as a high-entropy seed into a high-speed <a href="https://en.wikipedia.org/wiki/Xorshift"><strong>Xorshift generator</strong></a>, “unfolding” a single moment of universal unpredictability into the billions of coordinates required for the Buddhabrot. The final render becomes a <strong>non-deterministic snapshot</strong> of the universe at a specific moment in time. In a literal sense, when you explore this Buddhabrot, your computer’s GPU is using the fundamental “noise” of the cosmos to paint the “ghost” of the Mandelbrot set.</p><p><strong>NOTE</strong>: <em>At extreme zooms, 32-bit floating-point precision (the standard for WebGPU) begins to jitter. To mitigate this, we used coordinate normalization — shifting the origin to the center of the zoom window — to squeeze every bit of precision out of the GPU before the “pixelation” of the math becomes visible. Once the magnification exceeds roughly seven decimal places, the gaps between representable numbers become larger than your pixels, causing the math to “snap” and jitter, and making it impossible to zoom in any further on the fractal.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nf0XfFGoLqAS3dL5SqZXXA.png" /><figcaption>Zooming in too much breaks the recursion on our explorer due to floating point limitations (still beautiful though)</figcaption></figure><h3>Extra features</h3><p>To keep up to date with a lot other Buddhabrot implementations, I tried to explore some extra features that would bring a bit more interactivity / educational value and beauty to this project.</p><h4>Juddhabrot</h4><p>To transform the experience from a static observation into an active exploration, we introduced an interactive feature, allowing users to manipulate the 4D rotation of the fractal in real-time. By treating the system as a four-dimensional vector — V=(Zr​,Zi​,Cr​,Ci​) — and applying a user-controlled rotation matrix within the WebGPU compute shader, the engine projects different “slices” of this complex object onto the 2D screen. This interactivity (coined “Juddhabrot” by researcher Dr. Linas Vepstas) turns the “Buddha” into a dynamic shape that morphs into strange geometric lattices, serving as a mathematical metaphor: the shapes we perceive every day are not absolute, but shifting shadows, determined by our chosen perspective in higher-dimensional space, limited by our own senses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*aWech_nHI2-jufYMjxIfRQ.gif" /><figcaption>Rotating in 4D space through the Juddhabrot</figcaption></figure><h4>Orbit tracer</h4><p>To enhance the project’s educational depth, we tried implementing an <strong>orbit tracer</strong>, a real-time interaction that attempts to isolate and visualize the exact escape trajectory of any single coordinate as the user hovers over the complex plane. By rendering this path as a reactive polyline overlaid on the fractal, the tracer reveals that the Buddha’s solid-looking “ribs” are actually an accumulation of countless high-velocity paths, providing a window into chaos where the most intricate structures emerge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*8aaQXe4m-2bAV3fR1z5xXA.gif" /><figcaption>Using the orbit tracker to understand which paths the escape points took on their journey</figcaption></figure><h4>Nebulabrot</h4><p>To try and elevate the visual complexity and aesthetic beauty of the render, we also tried implemented the <strong>Nebulabrot:</strong> a “multi-spectral” rendering feature that mimics how astrophysicists visualize deep-space phenomena. By partitioning the mathematical “energy” into discrete RGB channels based on iteration depth — <strong>Red</strong> for rapid escapes (structural base), <strong>Green</strong> for transitional paths (volume), and <strong>Blue</strong> for high-cycle, long-lived orbits (fine filaments) — the engine creates a composite “energy map” that reveals the internal anatomy of the fractal (a bit like transfer functions with Volume rendering). This false-color technique transforms the monochromatic density plot into a vibrant nebula-like visualization that makes everything look much more interesting than it’s monochrome counterpart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*xiY4roXeCjynUizENdIkpw.gif" /><figcaption>Exploring colors with the Nebulabrot settings</figcaption></figure><h3>The Mathematical Archetype</h3><p>Building this project also prompted me to learn a bit more about some very interesting concepts of Buddhism that link to the Buddhabrot. Here are some of the connections:</p><ul><li><strong>The crown and third eye:</strong> The recursive “mini-brots” often align at the top of the main figure, creating structures that mirror the <a href="https://en.wikipedia.org/wiki/Ushnisha"><strong><em>Ushnisha</em> </strong></a>(the cranial bump representing spiritual wisdom) or the <a href="https://en.wikipedia.org/wiki/Urna"><strong><em>Urna</em> </strong></a>(the third eye) found in traditional Buddhist statuary.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*QeZC2bqrEfA9r0ucybBBMQ.png" /><figcaption>Can you see the <a href="https://en.wikipedia.org/wiki/Ushnisha"><strong><em>Ushnisha</em></strong></a><strong><em> </em></strong><em>and the </em><a href="https://en.wikipedia.org/wiki/Urna"><strong><em>Urna</em></strong></a><strong><em> </em></strong><em>on the Buddhabrot’s “head”?</em></figcaption></figure><ul><li><strong>The mandala of orbits:</strong> When viewed from above or through a 4D rotation, the filaments often form circular, wheel-like patterns. These could be seen as the mathematical equivalents of the <strong>Dharmachakra</strong> (the Wheel of Dharma), where every spoke is a trajectory heading toward the infinite.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMeS8AXfOkxQu94Zd9scgw.png" /><figcaption>The Buddhabrot as seen from the Turning of the Wheel (the 45º rotation)</figcaption></figure><ul><li><strong>The duality of the void: </strong>In Buddhist philosophy, <strong><em>Sunyata</em> </strong>(emptiness or the void) is not “nothingness” but a state of infinite potential. The Buddhabrot visualizes this perfectly — the Mandelbrot set emerges as “solid” order, while the space around it can be seen as a “void” of chaos.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYtm-CmmuZUF_vaYG5-Tow.png" /><figcaption>The Buddhabrot emerges from the void, slowly filling it with light</figcaption></figure><ul><li><strong>Indra’s net</strong> — this is a Buddhist metaphor where every part of the universe reflects every other part. The Buddhabrot could be seen as a temporary, non-repeatable snapshot of cosmic entropy, captured through the lens of a 10th-century icon and 21st-century physics, and that’s kind of mindblowing, at least for me.</li></ul><h3>The mystical side</h3><p>There is something profoundly fascinating and mysterious about watching a Buddhabrot emerge from the grain, even if you consider the recognition of the sacred figure appearing in the fractal as just a pareidolia effect and wishful thinking.</p><p>For me personally, finding out about the mysterious Buddhabrot ended up being a bit more than just mathematical curiosity, and set me thinking not only about the science, but furthermore, about the coincidence of this symbol of eastern spirituality (which interests me immensely) being an emergent pattern of the complex plane, and a sort of mathematical archetype of what <a href="https://en.wikipedia.org/wiki/Carl_Jung"><strong>Carl Jung</strong></a> called <a href="https://iaap.org/jung-analytical-psychology/short-articles-on-analytical-psychology/synchronicity-an-acausal-connecting-principle/">meaningful coincidence (or synchronicity</a>).</p><p>It represents a rare space where the “cold” logic of a computer shader produces an image that feels undeniably “warm” and spiritual. Could it be that we humans are wired to see patterns where they don’t exist? Or could the universe be attempting to show us something more through mathematics and physics? (I think perhaps human society could benefit from paying a bit more attention to Buddhist philosophy and ideas)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KhTKbBkM9ac-VoMx" /><figcaption>Black and grey Buddha statue on top of hill — Hong Kong (source: <a href="https://unsplash.com/photos/black-and-grey-buddha-statue-on-top-of-hill-88IMbX3wZmI">Unsplash — Jamie Street</a>)</figcaption></figure><p>Building this experiment was a journey in itself, from a university class over 15 years ago, through Mandelbrot fractals, ending up exploring compute shaders and quantum randomness, I invite you to <a href="https://buddhabrot.vercel.app/">visit the page </a>and explore the “ghost in the machine” for yourself (in principle it should also work fairly well on your phone, that is the magic of WebGPU and compute shaders).</p><p>Try out the <a href="https://buddhabrot.vercel.app/">Buddhabrot WebGPU explorer here</a>!</p><h3>References</h3><ul><li><a href="https://en.wikipedia.org/wiki/The_Fractal_Geometry_of_Nature">The Fractal Geometry of Nature</a>, Benôit Mandelbrot (1982)</li><li><a href="https://superliminal.com/fractals/bbrot/">https://superliminal.com/fractals/bbrot/</a></li><li><a href="https://www.quantamagazine.org/the-quest-to-decode-the-mandelbrot-set-maths-famed-fractal-20240126/">https://www.quantamagazine.org/the-quest-to-decode-the-mandelbrot-set-maths-famed-fractal-20240126/</a></li><li><a href="https://www.spiritualarts.org.uk/mandelbrot-and-the-mind-of-god-the-spiritual-implications-of-fractal-mathematics/">https://www.spiritualarts.org.uk/mandelbrot-and-the-mind-of-god-the-spiritual-implications-of-fractal-mathematics/</a></li><li><a href="https://iaap.org/jung-analytical-psychology/short-articles-on-analytical-psychology/synchronicity-an-acausal-connecting-principle/">https://iaap.org/jung-analytical-psychology/short-articles-on-analytical-psychology/synchronicity-an-acausal-connecting-principle/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ea6784e9153" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[8 months of monitoring our hamster (Mooey)]]></title>
            <link>https://medium.com/@christian.marques/8-months-of-monitoring-our-hamster-mooey-55834baa10b7?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/55834baa10b7</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[hamster]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[biology]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Sat, 07 Feb 2026 19:48:40 GMT</pubDate>
            <atom:updated>2026-02-07T19:48:40.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*3sMEIDsS6Uv6TpnZf8d9Xg.jpeg" /><figcaption>Mooey Maria Hazel in January 2026</figcaption></figure><p>When <a href="https://medium.com/@christian.marques/the-ultimate-hamster-monitoring-system-45ddec50009a">we first wired a Raspberry Pi into Mooey Maria Hazel’s enclosure</a>, we were mostly driven by curiosity — and a bit of parental amusement. The initial results were fun, reassuring, and occasionally surprising, and leaving for some days without worrying about her was a true blessing (we could keep checking on her from far away). But the real value of the system only became apparent once we stopped <em>checking</em> the data and simply let it accumulate, letting the data tell its own story.</p><p>Eight months later, Mooey has apparently had enough of the micro vibrations and strange lights, as a couple of nights ago, she decided to climb to an apparently impossible place to reach, and bit off the small cables connecting the sensor to the Raspberry Pi.</p><p>She is now almost one year old, and we’re taking this opportunity to give her some peace as a birthday present, and take down the experiment — which leads us to look at the data a bit more carefully and try to make some conclusions.</p><p>Between <strong>May 2025 and February 2026</strong>, Mooey logged:</p><ul><li><strong>~3,800 running sessions</strong></li><li><strong>~566,000 wheel rotation events</strong></li><li><strong>~250 days of near-continuous monitoring</strong></li></ul><p>What started as a weekend project quietly has turned into a longitudinal behavioral experiment.</p><p>This is what we learned.</p><h3>A hamster with an internal clock</h3><p>One of the clearest signals in the data emerged almost immediately: <strong>time of day dominates everything </strong>(unsurprisingly).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uL5uF7Yo_Ut-gLZoOd49sA.png" /><figcaption>Circadian activity heatmap showing only hours with recorded wheel activity. Mooey’s running behavior is tightly constrained to a narrow nightly window, with near-zero activity outside it across eight months.</figcaption></figure><p>When we plotted activity as a heat map — hours on the x-axis, days on the y-axis — a clear pattern appeared. Mooey doesn’t just “mostly” run at night. She runs at <em>very specific times</em>, night after night, week after week.</p><p>Her peak activity window consistently sits between <strong>late evening and the early hours of the morning</strong>, with only minor drift across seasons.</p><p>None of this data contradict what biologists already know about hamsters. Syrian hamsters are a classic model organism for studying circadian rhythms, and their nocturnal, highly habitual behavior is well documented in laboratory settings.</p><p>What surprised us wasn’t <em>what</em> Mooey did, but <em>how cleanly and consistently</em> these patterns emerged from months of passive observation in a normal home environment. Outside of an experimental setting, her activity still collapsed into a narrow, rigid time window with almost no exceptions.</p><p>In that sense, this project quantified just how strong and predictable the knowledge of hamster biology can be when measured continuously, at home, over hundreds of nights.</p><p><strong>Insights:</strong> Mooey isn’t really reacting much to noise, light, or human presence (which really varied throughout the experiment, especially when we were not in the house). She’s running on an internal clock.</p><h3>Not one single kind of run — several</h3><p>At first glance, wheel activity looks like a continuous stream: sometimes short, sometimes long, sometimes fast. But once we grouped sessions by duration, intensity, cadence, and environment, something interesting emerged.</p><p>The sessions clustered naturally into a small number of <strong>distinct “running modes”</strong>:</p><ul><li><strong>Short bursts</strong> — quick visits to the wheel</li><li><strong>Medium sessions</strong> — the default, most common behavior</li><li><strong>Long endurance runs</strong> — sustained, higher-effort sessions</li></ul><p>What we <em>didn’t</em> see was a smooth spectrum. Mooey doesn’t gradually ease from short to long, or from slow to fast. She seems to <strong>pick a mode</strong>, run accordingly, and stop.</p><p>What we found is also consistent with how rodents are known to move: in discrete bouts rather than along a smooth continuum. This suggests that her running behavior is state-driven rather than continuously modulated by fatigue, even if it feels natural to describe it as “choosing a mode.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aB20opq2PlJgEWWT.gif" /><figcaption>One of Mooey’s first runs after we had set up the monitoring system</figcaption></figure><p><strong>Insights:</strong> Even at hamster scale, exercise behavior is discrete and intentional, not random or purely fatigue-driven.</p><h3>More Running Means Longer, Not Faster</h3><p>Another assumption we had early on was that “big nights” meant Mooey was running <em>harder</em>. The data says otherwise.</p><p>Across thousands of sessions:</p><ul><li><strong>Speed varies surprisingly little</strong></li><li><strong>Total work scales almost entirely with session length</strong></li></ul><p>When Mooey wants to do more, she doesn’t sprint — she just stays on the wheel longer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*rxstQhyA-CIlMBZu8bBqTQ.gif" /><figcaption>Hamtaro doing an endurance run</figcaption></figure><p>This mirrors something we often forget as humans: endurance beats intensity for sustained activity and is consistent with how rodents use running wheels in both laboratory and naturalistic studies.</p><p>In rodents given free access to a wheel, voluntary running tends to reflect <em>total time spent active</em> rather than dramatic changes in speed; the dominant variation across days and individuals comes from <em>how long</em> the animal chooses to sustain activity, not how fast it runs.</p><p>Wheel running in rodents is broadly used in research precisely because it yields measures of <strong>when</strong> and <strong>for how long</strong> an animal runs, with less emphasis on rapid intensity spikes than on session duration and accumulated revolutions over time.</p><p><strong>Insights:</strong> Mooey increases workload by extending time, not by pushing speed.</p><h3>Does the Environment Matter?</h3><p>We logged temperature and humidity on every rotation, because we deeply wanted to find correlations between the environment and her activity — thus one of the biggest questions of the experiment was: <em>does the environment influence performance?</em></p><p>The answer is: <strong>yes — but only a little</strong>.</p><ul><li>Higher temperatures are associated with slightly <em>less</em> running</li><li>Higher humidity is associated with slightly <em>more</em> running</li><li>The effects are real, but modest compared to time-of-day</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*rDJ-38z3uHoQIby-" /><figcaption>Hamtaro shows hamsters enjoying a rainy day, but do they really?</figcaption></figure><p>Studies of voluntary wheel running in rodents and other small mammals show that <strong>environmental conditions like temperature and light can influence overall activity levels</strong>, but these effects are generally <strong>modest compared to innate behavioral rhythms</strong> such as circadian timing.</p><p>Environment fine-tunes behavior, but it doesn’t override it. Mooey still runs when she wants to run — just a bit more comfortably under certain conditions.</p><p><strong>Insights:</strong> Comfort matters, but habit matters more.</p><h3>What We Didn’t See (And Why That’s Good)</h3><p>Over eight months, we saw:</p><ul><li>no sudden drops in activity</li><li>no erratic changes in cadence</li><li>no unexplained long-term decline</li></ul><p>From a behavioral standpoint, this is exactly what you’d hope for. The system didn’t just satisfy curiosity — it quietly acted as a long-term wellness monitor, and kept us at ease when we had to be absent from the home for some days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*HKbK2rvQ14CeHk_K" /><figcaption>Hamtaro is a happy, healthy hamster (and so are its owners)</figcaption></figure><h3>Looking Back</h3><p>What began as a fun hardware experiment evolved into something more subtle: a window into routine, habit, and biological rhythm.</p><p>The most surprising lesson wasn’t how <em>much</em> Mooey runs (although that was indeed surprising, looking at the records) — it was how <strong>structured</strong> her behavior is. Night after night, she shows up, chooses a mode, does the work, and hops off.</p><p>Just pure instinct and consistency.</p><p>Here are some of Mooey’s incredible stats:</p><ul><li><strong>Median speed:</strong> ≈ <strong>1.1 km/h </strong>📊</li><li><strong>95th percentile speed:</strong> ≈ <strong>1.6 km/h </strong>🏎️💨</li><li><strong>~ 48.5 minutes</strong> of uninterrupted running (Same session also holds the distance record) 🏃‍♂️</li><li><strong>~ 1.15 km</strong> in one continuous run ♾️</li><li><strong>~ 6.3 km in one night (2025–08–28) </strong>🛣️</li><li><strong>Consistency: </strong>Over ~250 days cruising speed barely changed, preferred activity window barely drifted, session structure stayed stable 🎯</li></ul><h3>The end — as requested by Mooey</h3><p>In the end, the experiment didn’t stop because the data ran out, but because Mooey decided she’d had enough.</p><p>After months of quiet observation, she eventually chewed through the sensor cables (to our surprise , since they were quite out of reach — or so we thought) — a small but decisive act that we chose to interpret less as sabotage and more as feedback.</p><p>From a biological standpoint, this makes sense: hamsters are highly sensitive to subtle environmental disturbances, and constant micro-vibrations, faint indicator lights, or unfamiliar sounds — even ones we barely notice — can become sources of irritation over time.</p><p>Rather than rebuilding the system yet again, we took the hint. The project had already answered its questions, and Mooey had more than earned some peace and quiet. Sometimes the most responsible thing an experimenter can do is stop listening to the data — and start listening to the hamster.</p><p>Eight months. Half a million data points. One very committed runner. 🐹🏃‍♀️ We hope you’ve enjoyed Mooey’s adventure!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*WfGDr8EGZkx-gSxF9p75qw.gif" /><figcaption>Mooey eating turnip leaves</figcaption></figure><h3>Open-sourcing the data</h3><p>We’re making the full dataset from this experiment publicly available as a set of <strong>CSV files</strong>. While it started as a personal project, months of continuous, real-world behavioral data felt worth sharing openly. The data is released as-is, quirks and all, so others can explore it, question it, reuse it, or simply learn from it.</p><p>If it inspires further analysis, replication, or playful experimentation, then the project has gone beyond our own curiosity — which feels like a good place to stop.</p><p><a href="https://transfer.it/t/aqiarw41Ub4A">https://transfer.it/t/aqiarw41Ub4A</a></p><h3>References</h3><ul><li><a href="https://medium.com/@christian.marques/the-ultimate-hamster-monitoring-system-45ddec50009a">The ultimate hamster monitoring system</a></li><li><a href="https://www.jove.com/t/50186/recording-analysis-circadian-rhythms-running-wheel-activity">Recording and Analysis of Circadian Rhythms in Running-wheel Activity in Rodents</a></li><li><a href="https://www.sciencedirect.com/science/article/abs/pii/S0031938498001401">Conservation of locomotor behavior in the golden hamster: effects of light cycle and a circadian period mutation</a></li><li><a href="https://www.sciencedirect.com/science/article/abs/pii/S0149763411002193?utm_source=chatgpt.com">The use of a running wheel to measure activity in rodents: Relationship to energy balance, general activity, and reward</a></li><li><a href="https://digitalcommons.hope.edu/faculty_publications/1470/">The Effects of Ambient Temperature and Lighting Intensity on Wheel-running Behavior in a Diurnal Rodent, the Nile Grass Rat (Arvicanthis niloticus)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55834baa10b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ultimate hamster monitoring system]]></title>
            <link>https://medium.com/@christian.marques/the-ultimate-hamster-monitoring-system-45ddec50009a?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/45ddec50009a</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[dashboard]]></category>
            <category><![CDATA[hamster]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[monitoring-software]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Sun, 01 Jun 2025 11:35:24 GMT</pubDate>
            <atom:updated>2025-06-01T16:06:29.396Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5JaJHC3ujk3V0e0Wp8VXMQ.png" /><figcaption>The Ultimate Hamster Monitoring System</figcaption></figure><p>What happens when your daughter’s hamster runs marathons in the middle of the night? If you’re Mooey Maria Hazel — a very active and curious little hamster, with intrigued and inventive owners — you get your very own custom monitoring system.</p><p>This post walks through a project that began as a simple Raspberry Pi sensor logger and grew into a full-stack dashboard with (quasi) real-time insights into Mooey’s nightly adventures. Whether you’re into hardware hacking, full-stack development, or just enjoy a good hamster story, there might be something here for you.</p><h3>Why Monitor a Hamster?</h3><p>Every night, Mooey leapt onto her wheel like a tiny <a href="https://en.wikipedia.org/wiki/Forrest_Gump">Forrest Gump</a> on a mission — running not from something, but for the sheer joy of it. She’d spin for hours, paws a-blur, eyes gleaming with mysterious purpose, the only sign of her journey the soft noise of paws on cork, engraved in our memory. But how far was she actually going? How fast? One evening, as her wheel squeaked into overdrive, a thought struck us: What if we could track her workouts — like a little hamster <a href="https://en.wikipedia.org/wiki/Whoop_(company)">WHOOP</a>?</p><p>That single question kicked off a project that combines sensors, automation, databases, and modern web technologies to create something both cute and wholesome.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*r2p1h1BFNCM0xwNcTVaigQ.png" /><figcaption>Mooey Maria Hazel in her element</figcaption></figure><h3>Phase 1 — Hardware: Raspberry Pi Hamster Logger</h3><p>We started by building a lightweight sensor logger with the Raspberry Pi.</p><h3>Sensors and Hardware (with cost breakdown)</h3><ul><li><a href="https://www.raspberrypi.com/products/raspberry-pi-3-model-b/"><strong>Raspberry Pi 3 Model B</strong></a><strong> </strong>(~40€) — Reads sensor data and runs Python scripts to process it.</li><li><a href="https://wiki.keyestudio.com/Ks0020_keyestudio_Hall_Magnetic_Sensor"><strong>Keyestudio KS0020 Hall Effect Sensor</strong></a> (~2€) — A <a href="https://en.wikipedia.org/wiki/Hall_effect"><strong>Hall effect</strong></a><strong> sensor</strong> detects the presence of a magnetic field. When a magnet passes near the sensor, it changes its output voltage. This change can be used to detect motion or position — counting each rotation of a hamster wheel as a magnet goes by.</li><li><a href="https://en.wikipedia.org/wiki/Neodymium_magnet"><strong>Neodymium magnet</strong></a><strong> </strong>(~2€) — Used to activate the hall effect sensor.</li><li><a href="https://www.keyestudio.com/products/keyestudio-dht22-am2302temperature-and-humidity-sensor-for-arduino-uno-r3"><strong>Keyestudio DHT22</strong></a><strong> </strong>(~7€) — Measures temperature and humidity inside the enclosure.</li><li><a href="https://en.wikipedia.org/wiki/Jump_wire"><strong>Jump wires</strong></a> (~1€) — Used to connect everything (we used female-female cables for our particular setup)</li></ul><p>The total cost of the material for the project went around 52€, but you can re-use a lot of this stuff for other projects too (I’ve used the Raspberry PI for a bunch of different things from a homemade retro arcade, to a web-server, among others). You can also considerably reduce the costs by using a cheaper micro-controller like a <a href="https://www.raspberrypi.com/products/raspberry-pi-pico/">Raspberry Pico</a>, <a href="https://www.arduino.cc/">Arduino</a>, or even simpler ones such as the <a href="https://wiki.seeedstudio.com/Seeeduino-XIAO/">Seeed</a> or <a href="https://www.keyestudio.com/products/keyestudio-uno-r3-atmega328p-development-board-usb-cable-for-arduino">Keyestudio</a> micro-controllers.</p><h3>Electronics set-up</h3><p><strong>DISCLAIMER: </strong>This was pretty much our first time setting up such an electronics schematic, so apologies in advance for any obvious mistakes (and we welcome feedback on this, it’s probably offensive to the connoisseurs).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMlQMkGHWmH6zjgOvS_9rw.png" /><figcaption>Electronics setup for the project</figcaption></figure><p>Here are some of the lessons that were learned while researching for this first-time electronics adventure:</p><ul><li><a href="https://www.raspberrypi-spy.co.uk/2015/09/how-to-use-a-hall-effect-sensor-with-the-raspberry-pi/">At first it seemed like it wouldn’t be possible to plug the sensors directly to the Pi without resorting to a breadboard with some resistors (due to the voltage difference 5V to 3.3V)</a> but then I found <a href="https://www.reddit.com/r/embedded/comments/1ev5jqt/connecting_a_ah9246pb_hall_effect_sensor_to_a/">some articles on the Raspberry Pi community showing that it could be done by plugging to the 3.3V</a> (If your Keyestudio sensors are feeding 5V into a GPIO pin you may kill your Pi. <strong>You need additional circuitry to reduce 5V to 3.3V </strong>(or feed from the 3.3V pins). You can have multiple feeds from the 5V power pins.</li><li>The temperature and humidity sensor had a couple of quirks when interfacing with the Raspberry Pi python script out-of-the-box (more on that below).</li></ul><h3>Python Script</h3><ul><li>Detects when Mooey starts running based on wheel activity (at first hall effect sensor signal detected, it starts a running session).</li><li>Records timestamped rotation logs and environmental data into the open session.</li><li>Closes the session when Mooey stops running (this happens after a full 60 seconds of inactivity — <em>we considered this as a reasonable default but will probably adjust it based on the gathered data</em>).</li><li>Sends this data to a remote API (the Next.js back-end) for storage.</li></ul><p>Here’s a peek at the core functionality:</p><pre># hamster_session.py<br><br>import RPi.GPIO as GPIO<br>import time<br>from sensors import get_temperature, get_humidity<br>from session import HamsterSession<br><br># --- Configuration ---<br>SENSOR_PIN = 4  # BCM pin for hall sensor<br>INACTIVITY_TIMEOUT = 60  # seconds<br><br># --- Main logic ---<br>GPIO.setmode(GPIO.BCM)<br>GPIO.setup(SENSOR_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)<br><br>print(&quot;Hamster Wheel Session Logger (CTRL+C to exit)&quot;)<br><br>session = HamsterSession()<br><br>try:<br>    while True:<br>        value = GPIO.input(SENSOR_PIN)<br>        if value == GPIO.LOW:<br>            now = time.time()<br>            if not session.active:<br>                session.start_session(now)<br>            temp = get_temperature()<br>            hum = get_humidity()<br>            session.log_rotation(now, temp, hum)<br>            # Debounce: wait for sensor to go HIGH<br>            while GPIO.input(SENSOR_PIN) == GPIO.LOW:<br>                time.sleep(0.01)<br>        else:<br>            if session.active and session.last_activity and (time.time() - session.last_activity &gt; INACTIVITY_TIMEOUT):<br>                session.end_session()<br>            time.sleep(0.05)<br>except KeyboardInterrupt:<br>    print(&quot;Exiting...&quot;)<br>finally:<br>    GPIO.cleanup()</pre><p>An interesting thing that I found was that I wasn’t able to use the <a href="https://piaverous.medium.com/setting-up-dht11-temp-hum-sensor-with-your-raspberry-pi-b408c0d4490f">Adafruit_DHT</a> library with our Raspberry Pi, so I defaulted to <a href="https://forums.raspberrypi.com/viewtopic.php?t=259555">using the </a><a href="https://forums.raspberrypi.com/viewtopic.php?t=259555">dtoverlay Linux driver</a>, which allows you to interface with the temperature and humidity sensor in a different way (but you need to make sure to load the driver before the program runs with sudo dtoverlay dht11 gpiopin=YOUR_SENSOR_PIN</p><pre># sensors.py<br># Utility functions for reading temperature and humidity<br># This requires to run &quot;sudo dtoverlay dht11 gpiopin=YOUR_SENSOR_PIN&quot;<br><br>TEMP_PATH = &quot;/sys/bus/iio/devices/iio:device0/in_temp_input&quot;<br>HUMIDITY_PATH = &quot;/sys/bus/iio/devices/iio:device0/in_humidityrelative_input&quot;<br><br>def read_first_line(filename):<br>    try:<br>        with open(filename, &quot;rt&quot;) as f:<br>            value = int(f.readline())<br>        return True, value<br>    except Exception:<br>        return False, -1<br><br>def get_temperature():<br>    flag, temp = read_first_line(TEMP_PATH)<br>    return temp // 1000 if flag else None<br><br>def get_humidity():<br>    flag, hum = read_first_line(HUMIDITY_PATH)<br>    return hum // 1000 if flag else None</pre><pre>import os<br>import time<br>import requests<br>from dotenv import load_dotenv<br><br># Load environment variables from .env file<br>load_dotenv()<br><br>API_URL = os.getenv(&quot;API_URL&quot;)<br>API_SECRET_TOKEN = os.getenv(&quot;API_SECRET_TOKEN&quot;)<br><br>class HamsterSession:<br>    def __init__(self):<br>        self.active = False<br>        self.rotations = 0<br>        self.rotation_log = []<br>        self.start = None<br>        self.last_activity = None<br>        self.last_temp = None<br>        self.last_hum = None<br><br>    def start_session(self, now):<br>        self.active = True<br>        self.start = now<br>        self.rotations = 0<br>        self.rotation_log = []<br>        self.last_temp = None<br>        self.last_hum = None<br>        print(&quot;Session started at&quot;, time.strftime(&#39;%Y-%m-%d %H:%M:%S&#39;, time.localtime(now)))<br><br>    def log_rotation(self, now, temp, hum):<br>        if temp is None:<br>            temp = self.last_temp<br>        else:<br>            self.last_temp = temp<br><br>        if hum is None:<br>            hum = self.last_hum<br>        else:<br>            self.last_hum = hum<br><br>        temp = float(temp) if temp is not None else -1.0<br>        hum = float(hum) if hum is not None else -1.0<br><br>        self.rotations += 1<br>        self.rotation_log.append({<br>            &quot;timestamp&quot;: float(now),<br>            &quot;temperature&quot;: temp,<br>            &quot;humidity&quot;: hum<br>        })<br>        self.last_activity = now<br><br>        print(f&quot;Rotation {self.rotations}: Temp={temp}°C, Humidity={hum}%&quot;)<br><br>    def end_session(self):<br>        session_end = self.last_activity<br><br>        if self.rotations &lt; 5:<br>            print(f&quot;Session discarded — only {self.rotations} rotations&quot;)<br>            self._reset()<br>            return<br><br>        session_data = {<br>            &quot;images&quot;: [],<br>            &quot;rotationLog&quot;: self.rotation_log<br>        }<br><br>        print(&quot;Session ended at&quot;, time.strftime(&#39;%Y-%m-%d %H:%M:%S&#39;, time.localtime(session_end)))<br>        print(&quot;Session data:&quot;, session_data)<br><br>        try:<br>            headers = {<br>                &quot;Authorization&quot;: f&quot;Bearer {API_SECRET_TOKEN}&quot;,<br>                &quot;Content-Type&quot;: &quot;application/json&quot;<br>            }<br>            response = requests.post(API_URL, json=session_data, headers=headers)<br>            print(&quot;Posted to API, status:&quot;, response.status_code)<br>        except Exception as e:<br>            print(&quot;Failed to post to API:&quot;, e)<br><br>        self._reset()<br><br>    def _reset(self):<br>        self.active = False<br>        self.start = None<br>        self.last_activity = None</pre><p>To keep things reliable, the logger runs as a <strong>systemd</strong> service, so it’s always on — even if the Raspberry Pi reboots.</p><p>You can find the full code solution in <a href="https://github.com/electricganesha/hamster-hardware/">this repository</a>.</p><h3>Assembling the hardware in the enclosure</h3><p>Even though I’m quite good with software, I have an Achilles’ heel when needing to manually build things (especially fragile things, as I’m sort of a brute), so this was one of the hardest parts of the project, only made possible due to my wife’s talent with handy-works.</p><p>One important consideration was that we had to make sure that Mooey wouldn’t be able to access any wiring or the magnet itself, because she would definitely be curious enough to go on and try to eat them. The second important thing was aesthetics as wanted the setup to be minimally visible from the outside (hiding it as much as possible).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*cAN2WxbOxgWKU6dfJ2hTDg.jpeg" /><figcaption>Not looking so shabby from the side — relatively discreet and only visible if you lean (but stable enough not to fall down)</figcaption></figure><p>We ended up using a lot of masking and double-sided tape keep the Raspberry Pi on the ceiling of the cage and the sensors in the right place - it didn’t look amazing, but we stuck with it (no pun intended) for the first days, while we tested the setup. But, as expected, this turned out to not be reliable, as the glue from the tape started becoming less effective as the temperatures rose, so we ended up using plastic clamps to keep everything as stable as possible, with a single cable passed through the top of the cage to feed the Pi, and no cables at the ground level at all. (Kudos to <a href="https://www.instagram.com/angharadhengyu/">Angharad</a> for the patience and excellent work on this)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*5sKWsXXELqvl2hvRXvci3Q.jpeg" /><figcaption>We used a wooden block to make sure the sensor was at the right height to register</figcaption></figure><h3>Phase 2 — Software : Building the Web-app</h3><p>With data flowing in, we needed a place to explore it. Enter the <strong>🐹 Mooey Maria Hazel 🐹 Monitoring Dashboard</strong> — a place where we can comprehensively explore all the data we’ve gathered!</p><p>We used <a href="https://nextjs.org/">Next.js</a> for this purpose since it provides some useful things out of the box, such as <strong>API routes</strong>, a built-in feature to handle backend logic, and the ease of free hosting on <a href="https://vercel.com/">Vercel</a> (the creators of Next.js).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RlcxeImLsoy4u0Uz_rcvCw.png" /><figcaption>Empty results state</figcaption></figure><p>The setup is pretty simple, using a couple of API routes (GET and POST) to create and display sessions, and managing the front-end completely as a client side app. We also used <a href="https://mui.com/material-ui/">MUI</a> (funny, it really sounds like Mooey) to get a simple, clean UI going, and this is also great because you can use the integrated <a href="https://mui.com/x/react-charts/">MUI X Charts</a> to do some simple yet effective plotting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lY5ZGSZHUQKO_OhveeNE1Q.png" /><figcaption>The full dashboard in all its glory</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FSBRZ4Bj1IJDJOs9fbi12Q.png" /><figcaption>About the project</figcaption></figure><p>You can visit the web-app through this link -&gt; <a href="https://hamster-red.vercel.app/">https://hamster-red.vercel.app/</a> (it seems like there was already a <a href="https://hamster.vercel.app/">hamster.vercel.app</a> so Vercel gave us the hamster-red domain name…)</p><h3>Tech Stack</h3><ul><li><strong>Raspberry Pi Sensor Read </strong>(<a href="https://www.python.org/">Python</a>)<strong>: </strong><a href="https://pypi.org/simple/rpi-gpio/">RPi.GPIO</a> + <a href="https://docs.kernel.org/devicetree/overlay-notes.html">Device Tree Overlay</a></li><li><strong>Backend (</strong><a href="https://www.typescriptlang.org/">TypeScript</a>)<strong>:</strong> <a href="http://next.js/">Next.js API</a> routes with <a href="https://www.prisma.io/">Prisma</a></li><li><strong>Database </strong>(SQL)<strong>:</strong> <a href="https://www.postgresql.org/">PostgreSQL</a> (via <a href="https://supabase.com/">Supabase</a>)</li><li><strong>Frontend (</strong><a href="https://www.typescriptlang.org/">TypeScript</a>)<strong>:</strong> <a href="https://nextjs.org/">Next.js</a>, <a href="https://react.dev/">React</a>, <a href="https://mui.com/material-ui/">MUI (Material UI)</a></li><li><strong>Charts (</strong><a href="https://www.typescriptlang.org/">TypeScript</a>)<strong>:</strong> <a href="https://mui.com/x/react-charts/">MUI X Charts</a></li><li><strong>Host</strong>: <a href="https://vercel.com/">Vercel</a></li></ul><h3>Architecture Overview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R8RgMZ7Juw9_8TIWG9I3yA.png" /><figcaption>Hamster Monitoring Architecture</figcaption></figure><p>Everything runs autonomously — once set up, the logger collects and uploads data without manual intervention, and the dashboard stays in sync, handling most of the data transformations.</p><p>You can find the full code solution in <a href="https://github.com/electricganesha/hamster">this repository</a>.</p><h3>Data model</h3><p>This is the data model we’re currently at — we tried making it as minimal and flexible as possible (essentially just logging the data without any inference) as to be able to scale it and infer the data we want in the web-app instead. With this simple model just logging sessions (from first rotation until 60 seconds of inactivity) for each rotation of the wheel a timestamp plus the temperature and humidity levels at that time, we can easily infer the distance (wheel’s circumference x rotations), the speed (distance / duration in seconds), duration of sessions, rotations per minute (rotations / 60) and under which environmental conditions Mooey runs faster, or further (among other things).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*hQJYqZgUXKWYr_re-w9-tA.png" /><figcaption>Data model snapshot from Supabase</figcaption></figure><h3>Features</h3><p>During just the span of a weekend, it was possible to create this whole project with a lot of cool features, such as:</p><ul><li>Sensor integration with Raspberry Pi and Keyestudio sensors</li><li>Session tracking with per-rotation logs (timestamp, temperature, humidity)</li><li>API integration w/Next.js</li><li>Data storage in PostgreSQL (via Supabase)</li><li>Distance and speed (m/s) calculation for each session</li><li>Aggregation and visualization by day</li><li>Filtering by date, distance, speed, temperature, humidity</li><li>Interactive charts for distance, speed, rotations, temperature, humidity</li><li>Responsive table and card views</li><li>Optional image support for sessions (not integrated yet since we need a Raspberry Pi camera for this)</li><li>Integration with Google Analytics to track visits</li></ul><h3>Lessons &amp; Challenges</h3><p>Here is a condensed version of the lessons learned during this short project:</p><ul><li><strong>Sensor debounce:</strong> We noticed that the hall effect sensor sometimes produces noise (phantom rotations), probably requiring some smoothing of the data to avoid corruption.</li><li><strong>Temperature drift:</strong> The DHT22 sometimes gives slightly lagged readings, requiring averaging.</li><li><strong>Service Reliability:</strong> Using systemd on the Pi ensured resilience, but took some trial-and-error to configure correctly, particularly when it comes to producing and analyzing logs.</li><li><strong>Data Visualization:</strong> Turning time-series data into digestible graphs required careful grouping and filtering in both the database and front-end (and multiple iterations to figure out the right format for this — for example, a “Mooey-day” should be counted from 12:00 to 12:00 of the next day, considering she usually starts running before midnight, and finishes around 3/4 AM).</li></ul><h3>Mooey’s Metrics (So Far)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AwTdPa8PAxCHrwrtxF37nQ.gif" /><figcaption>Mooey gathering data</figcaption></figure><p>After just a week of running the system, Mooey had logged:</p><ul><li><strong>Over 120 sessions</strong></li><li><strong>~14 kilometers of total distance</strong></li><li><strong>Peak nightly distance: 3.3km</strong></li><li><strong>Typical running time: ~2 hours per night</strong></li></ul><p>We learned that she runs more when the room is slightly cooler (this was interesting to observe, as we had a sort of “heat wave” and Mooey’s performance dropped considerably during these days — particularly when temperature was high and humidity was low — so drier weather, even though Syrian hamsters come from the region of Aleppo, their natural habitat is the mountain, so they prefer cool weather), and that her favorite activity window is between 11 PM and 4 AM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ReyCzvr8S1ta234D00HPSg.png" /><figcaption>Sessions recorded for week</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmdMB7M4Dpe1KFNi7MVyFQ.png" /><figcaption>Progress charts for the week</figcaption></figure><p>We will definitely enjoy continuing gathering data and might do an edit, or a follow-up post in some months with further analysis if something interesting comes up!</p><h3>Future improvements</h3><p>There are still many, many things that would be fun to do in such a project:</p><ul><li>Add a camera to capture time lapse footage of Mooey’s sessions</li><li>Add alerts for abnormal behavior (e.g., no activity for a night)</li><li>Continue to improve the quality of the data (removing noise, averaging hardware errors, etc)</li><li>Use Infrared or PIR Motion Sensors to detect presence inside the cage beyond just wheel activity</li><li>Visualize at what times of day the hamster is most active with activity heat maps</li><li>Log ambient light levels or sound levels for environmental correlation</li><li>Detect patterns like sprinting, pacing, or anxious behavior using machine learning</li><li>Add metadata or observations to sessions (e.g., “new bedding today”) via session tags or notes</li><li>Use notifications to create alerts via email or web hooks when a new session starts or ends.</li><li>Show a daily/monthly summary of sessions</li><li>Use long-term data trends to detect potential health issues (e.g. sudden drop in activity)</li></ul><p>(not sure a hamster lives long enough for us to have enough time to implement all of these 🙈)</p><h3>Final Thoughts</h3><p>What started as a silly idea became a fun and rewarding full-stack hardware/software project. More importantly, it gave us a new way to connect with Mooey and understand her little world a bit better.</p><p>If you’re looking for a fun side project with just the right mix of code, electronics, and adorable outcomes — build your hamster a dashboard.</p><p>All in all, this project was possible to build within the space of a weekend, with some minor tweaks across the first week to fix some small issues that popped up here and there.</p><p><strong>Got questions or want to build your own hamster tracker?</strong><br>Feel free to fork the code or reach out! Mooey would be thrilled to inspire more data-driven adventures. 🐹📈</p><h3>References</h3><ul><li><a href="https://en.wikipedia.org/wiki/Hall_effect">https://en.wikipedia.org/wiki/Hall_effect</a></li><li><a href="https://www.raspberrypi-spy.co.uk/2015/09/how-to-use-a-hall-effect-sensor-with-the-raspberry-pi/">https://www.raspberrypi-spy.co.uk/2015/09/how-to-use-a-hall-effect-sensor-with-the-raspberry-pi/</a></li><li><a href="https://www.reddit.com/r/embedded/comments/1ev5jqt/connecting_a_ah9246pb_hall_effect_sensor_to_a/">https://www.reddit.com/r/embedded/comments/1ev5jqt/connecting_a_ah9246pb_hall_effect_sensor_to_a/</a></li><li><a href="https://piaverous.medium.com/setting-up-dht11-temp-hum-sensor-with-your-raspberry-pi-b408c0d4490f">https://piaverous.medium.com/setting-up-dht11-temp-hum-sensor-with-your-raspberry-pi-b408c0d4490f</a></li><li><a href="https://forums.raspberrypi.com/viewtopic.php?t=259555">https://forums.raspberrypi.com/viewtopic.php?t=259555</a></li><li><a href="https://oversizedhat.github.io/hamstermonitor/">https://oversizedhat.github.io/hamstermonitor/</a></li><li><a href="https://community.home-assistant.io/t/monitoring-the-family-pet-introducing-the-hamster-tracker/197220">https://community.home-assistant.io/t/monitoring-the-family-pet-introducing-the-hamster-tracker/197220</a></li><li><a href="https://gavd.co.uk/2024/03/nibbles-cam/index.html">https://gavd.co.uk/2024/03/nibbles-cam/index.html</a></li><li><a href="https://www.instructables.com/Turn-your-Raspberry-Pi-into-a-Hamster-Fitness-Trac/">https://www.instructables.com/Turn-your-Raspberry-Pi-into-a-Hamster-Fitness-Trac/</a></li><li><a href="https://www.instructables.com/Project-Floofball-an-IoT-Hamster-Wheel/">https://www.instructables.com/Project-Floofball-an-IoT-Hamster-Wheel/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45ddec50009a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimal Route Crafting: Finding the shortest path on the surface of a mesh]]></title>
            <link>https://blog.promaton.com/optimal-route-crafting-finding-the-shortest-path-on-the-surface-of-a-mesh-8e77dcaea689?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e77dcaea689</guid>
            <category><![CDATA[shortest-path]]></category>
            <category><![CDATA[dijkstras-algorithm]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[computer-graphics]]></category>
            <category><![CDATA[threejs]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Thu, 01 Aug 2024 15:11:39 GMT</pubDate>
            <atom:updated>2024-08-01T15:11:39.290Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lHDN4NvvG0PlHO0t" /><figcaption>Fig. 1 — Optimal Route Crafting: Finding the shortest path on the surface of a mesh</figcaption></figure><h3>Introduction</h3><p>As we are working with 3D dental data at Promaton, we recently had the chance to tackle an interesting project, where we got to explore a solution for finding the shortest path on the surface of a mesh, using our stack (<a href="https://react.dev/">React</a> / <a href="http://three.js/">Three.js</a> / <a href="https://docs.pmnd.rs/react-three-fiber/getting-started/introduction">R3F</a>). After researching and exploring this topic, we quickly realised that we’d have to dive into a custom implementation to better fit our needs, given that the available implementations using<a href="https://threejs.org/"> </a>three.js (our preferred 3D library) seemed not to fit our specific needs. We are now proud to be sharing our journey through this fascinating topic, together with a step-by-step description of our implementation, the demo we created in the process and some interesting conclusions.</p><h3>The problem</h3><p>In the dental domain, we are developing tools to edit the boundaries of a mesh. At first glance, this might seem straightforward, but it inevitably leads to a complex problem in mathematics and software engineering. How can we draw a path between two vertices on a mesh? Which is the most efficient path? These are the types of questions we found ourselves having to answer.</p><p>There are several approaches to solving the problem of path-finding on mesh surfaces. One approach involves adapting traditional grid-based path-finding algorithms [1] [2], such as A* search or breadth-first search, to operate on a mesh representation. However, these methods may encounter challenges in accurately representing the irregular geometry of mesh surfaces and may require extensive preprocessing or manual subdivision of the mesh. Additionally, machine learning techniques [3], such as reinforcement learning or neural networks, offer another avenue for path-finding on meshes by learning navigation policies from data. However, these approaches may require significant computational resources for training and may not always generalize well to diverse mesh environments. Alternatively to these, there is also Dijkstra’s algorithm (using priority queues and weighted edges), which can efficiently handle the irregularities of mesh geometries and provide a straightforward implementation that guarantees the shortest path without extensive preprocessing, offering better scalability and adaptability with lower computational overhead compared to machine learning approaches.</p><h3>The solution</h3><p>As we pondered on all the options described in the previous section and considered our use case and particular circumstances, we chose to approach this problem by implementing a simple node graph with priority queues and weighted nodes to represent mesh vertices. Using Dijkstra’s algorithm, we managed to efficiently calculate the shortest path between points, ensuring both accuracy (Dijkstra always guarantees the shortest path) and real-time performance. By utilizing priority queues (based on binary heaps) to efficiently explore neighbouring nodes, we were able to minimize computational overhead, rendering this solution scalable and adaptable to various mesh complexities, particularly the large and complex STL files from intra-oral scanners (as these are designed to capture the maximum amount of possible data) that we have to deal with.</p><h3>How we did it <strong>(step-by-step)</strong></h3><h4>1. Representing the mesh as a graph</h4><p>This code snippet defines classes for creating a graph representation of a mesh surface to facilitate path-finding. The Node class represents individual vertices on the mesh, storing their index, position (as a Vector3), and connections to neighbouring nodes. Edges between nodes are defined by the Edge class, which includes references to the connecting nodes and a weight indicating the distance between them. The Graph class manages the graph structure, storing node adjacency and providing methods for adding nodes and edges. Additionally, it includes functionality to check graph connectivity and compute the graph from a target mesh. During graph computation, vertex positions are extracted from the mesh geometry, and edges are created between adjacent vertices, with weights determined by their Euclidean distances. This code lays the foundation for efficient path-finding algorithms to navigate the complexities of the mesh surface. It can definitely be improved (for example by implementing a half-edge data structure) to further maximise the efficiency of traversal, something we will be looking into in the near future.</p><pre>// Define a class to represent individual vertices on the mesh<br>class Node:<br> index: Integer<br> value: Vector3<br> edges: List of Edge<br><br> method constructor(index: Integer, value: Vector3, edges: List of Edge = empty list):<br>     this.index = index<br>     this.value = value<br>     this.edges = edges<br><br>// Define a class to represent edges between nodes<br>class Edge:<br> node1: Node<br> node2: Node<br> weight: Number<br><br> method constructor(node1: Node, node2: Node, weight: Number):<br>     this.node1 = node1<br>     this.node2 = node2<br>     this.weight = weight<br><br>// Define a class to manage the graph structure<br>class Graph:<br> adjacencyList: Map of Integer to List of Integer<br> nodes: Map of Integer to Node<br> target: Mesh (optional)<br><br> method constructor():<br>     this.adjacencyList = empty map<br>     this.nodes = empty map<br><br> method clear():<br>     clear this.nodes<br>     clear this.adjacencyList<br><br> // Method to add a new node to the graph<br> method addNode(index: Integer, value: Vector3):<br>     if index not in this.nodes:<br>         newNode = new Node(index, value)<br>         this.nodes[index] = newNode<br>         this.adjacencyList[index] = empty list<br><br> // Method to add a new edge to the graph<br> method addEdge(index1: Integer, index2: Integer, weight: Number = 1):<br>     node1 = this.nodes[index1]<br>     node2 = this.nodes[index2]<br><br>     if node1 is null or node2 is null:<br>         throw error &quot;Node not found&quot;<br><br>     newEdge = new Edge(node1, node2, weight)<br>     node1.edges.append(newEdge)<br>     node2.edges.append(newEdge)<br><br>     if index1 not in this.adjacencyList:<br>         this.adjacencyList[index1] = empty list<br>     if index2 not in this.adjacencyList:<br>         this.adjacencyList[index2] = empty list<br><br>     this.adjacencyList[index1].append(index2)<br>     this.adjacencyList[index2].append(index1)<br><br> // Method to compute the graph from the target mesh<br> method computeGraph():<br>     if this.target is null:<br>         return<br><br>     positions = get attribute &quot;position&quot; from this.target.geometry<br>     indices = get index from this.target.geometry<br><br>     if indices is null:<br>         throw error &quot;Mesh geometry is not indexed. Can only compute indexed geometries.&quot;<br><br>     vertex = new Vector3()<br>     addedEdges = new Set()<br><br>     // Add nodes to the graph<br>     for i from 0 to count of positions:<br>         vertex = get vertex from positions at index i<br>         apply matrix of this.target to vertex<br>         addNode(i, clone of vertex)<br><br>     // Add edges to the graph<br>     for i from 0 to count of indices with step 3:<br>         indexA = get value from indices at index i<br>         indexB = get value from indices at index i+1<br>         indexC = get value from indices at index i+2<br><br>         edgeAB = min(indexA, indexB) + &quot;-&quot; + max(indexA, indexB)<br>         edgeBC = min(indexB, indexC) + &quot;-&quot; + max(indexB, indexC)<br>         edgeCA = min(indexC, indexA) + &quot;-&quot; + max(indexC, indexA)<br><br>         if edgeAB not in addedEdges:<br>             weightAB = distance between nodes at indexA and indexB<br>             addEdge(indexA, indexB, weightAB)<br>             addedEdges.add(edgeAB)<br><br>         if edgeBC not in addedEdges:<br>             weightBC = distance between nodes at indexB and indexC<br>             addEdge(indexB, indexC, weightBC)<br>             addedEdges.add(edgeBC)<br><br>         if edgeCA not in addedEdges:<br>             weightCA = distance between nodes at indexC and indexA<br>             addEdge(indexC, indexA, weightCA)<br>             addedEdges.add(edgeCA)</pre><blockquote><strong>Code-block #1 </strong>— <em>Pseudo-code representation of a mesh as a graph structure with weighted edges. For the Typescript implementation please refer to </em><a href="https://codesandbox.io/p/sandbox/blissful-pasteur-tp83sc?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clyss7yjv00062e6bdu2fi7vy%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clyss7yjv00022e6bijoggf2k%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clyss7yjv00032e6bnw08ca18%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clyss7yjv00052e6bbiwdcj29%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B40%252C60%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clyss7yjv00022e6bijoggf2k%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clyss7yju00012e6bxd3zt2dr%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522clystmoqn00022e6bela7ee9m%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A158%252C%2522startColumn%2522%253A61%252C%2522endLineNumber%2522%253A158%252C%2522endColumn%2522%253A61%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FMeshWrapper.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clyss7yjv00022e6bijoggf2k%2522%252C%2522activeTabId%2522%253A%2522clystmoqn00022e6bela7ee9m%2522%257D%252C%2522clyss7yjv00052e6bbiwdcj29%2522%253A%257B%2522id%2522%253A%2522clyss7yjv00052e6bbiwdcj29%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clyss7yjv00032e6bnw08ca18%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clyss7yjv00032e6bnw08ca18%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A30.4296875%257D"><em>the demo</em></a><em>.</em></blockquote><h4>2. <strong>Implementing Dijkstra’s algorithm</strong></h4><p><strong>Dijkstra’s algorithm</strong> (/ˈdaɪkstrəz/ <em>DYKE-strəz</em>) is an algorithm for finding the<a href="https://en.wikipedia.org/wiki/Shortest_path_problem"> shortest paths</a> between<a href="https://en.wikipedia.org/wiki/Vertex_(graph_theory)"> nodes</a> in a weighted<a href="https://en.wikipedia.org/wiki/Graph_(abstract_data_type)"> graph</a>, which may represent, for example, road networks. It was conceived by computer scientist<a href="https://en.wikipedia.org/wiki/Edsger_W._Dijkstra"> Edsger W. Dijkstra</a> in 1956 and published three years later.</p><p>Dijkstra’s algorithm finds the shortest path from a given source node to every other node. It can also be used to find the shortest path to a specific destination node, by terminating the algorithm once the shortest path to the destination node is known. For example, if the nodes of the graph represent cities, and the costs of edges represent the average distances between pairs of cities connected by a direct road, then Dijkstra’s algorithm can be used to find the shortest route between one city and all other cities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/0*Rx_0EAmmc6mmxU0N.gif" /><figcaption>Fig.2 — Visual representation of Dijktra’s algorithm — Text and image taken from Wikipedia page: <a href="https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm">https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm</a></figcaption></figure><p>The nature of Dijkstra’s algorithm makes it perfect for our use case [4], as this is exactly what we intend to do, finding the shortest path between two nodes of a graph, but in this particular case, the graph is our mesh as described in the previous section.</p><p>The following snippet of code defines a function getShortestPath, that calculates the shortest path between two nodes on a graph, using Dijkstra’s algorithm. The function takes the start and end node indices, along with a map of nodes, where the key is the node index and the value is the node object. Inside the function, a priority queue is used to track nodes with their distances from the start node. The algorithm iterates through the graph, updating distances and previous nodes as it explores the graph. Once the shortest path is found, it constructs and returns an array of nodes representing the path. Additionally, the code includes a PriorityQueue class, implemented as a binary heap, which is used internally by the getShortestPath function to efficiently manage node priorities during traversal. If you’d like to read more about the <a href="https://en.wikipedia.org/wiki/Binary_heap">Binary Heap</a> <a href="https://en.wikipedia.org/wiki/Priority_queue">Priority Queue</a> implementation, please refer to<a href="https://www.techiedelight.com/introduction-priority-queues-using-binary-heaps/"> this article</a>, which served as our inspiration.</p><pre>// Import the Node class<br>import Node from graph<br><br>/**<br> * Calculates the shortest path between two nodes using Dijkstra&#39;s algorithm.<br> * @param startIndex - The index of the start node.<br> * @param endIndex - The index of the end node.<br> * @param nodes - A map of nodes where the key is the node index and the value is the node itself.<br> * @returns An array of node values representing the shortest path, or null if no path is found.<br> */<br>function getShortestPath(startIndex, endIndex, nodes):<br> startNode = nodes.get(startIndex)<br> endNode = nodes.get(endIndex)<br><br> if startNode is null or endNode is null:<br>     print &quot;Start or end node is undefined&quot;<br>     return null<br><br> distances = new Map()<br> previousNodes = new Map()<br> queue = new PriorityQueue()<br><br> distances.set(startNode, 0)<br> queue.enqueue(startNode, 0)<br><br> while not queue.isEmpty():<br>     currentNode = queue.dequeue()<br><br>     if currentNode == endNode:<br>         path = empty list<br>         node = currentNode<br><br>         while node is not null:<br>             path.insert_at_start(node)<br>             node = previousNodes.get(node)<br><br>         return path<br><br>     for each edge in currentNode.edges:<br>         adjacentNode = edge.node1 if edge.node1 != currentNode else edge.node2<br>         currentDistance = distances.get(currentNode)<br><br>         if currentDistance is null:<br>             continue<br><br>         newDistance = currentDistance + edge.weight<br>         adjacentNodeDistance = distances.get(adjacentNode)<br><br>         if adjacentNodeDistance is null or newDistance &lt; adjacentNodeDistance:<br>             distances.set(adjacentNode, newDistance)<br>             previousNodes.set(adjacentNode, currentNode)<br>             queue.enqueue(adjacentNode, newDistance)<br><br> print &quot;Failed to find path&quot;<br> return null<br><br>/**<br> * A priority queue implemented as a binary heap.<br> */<br>class PriorityQueue:<br> elements = empty list of {node, priority}<br><br> /**<br>  * Adds a node to the queue with a given priority.<br>  * @param node - The node to add.<br>  * @param priority - The priority of the node.<br>  */<br> method enqueue(node, priority):<br>     elements.append({node, priority})<br>     bubbleUp(size of elements - 1)<br><br> /**<br>  * Removes and returns the node with the highest priority.<br>  * @returns The node with the highest priority.<br>  */<br> method dequeue():<br>     first = elements[0]<br>     last = elements.pop()<br>     if size of elements &gt; 0:<br>         elements[0] = last<br>         bubbleDown(0)<br><br>     return first.node<br><br> /**<br>  * Checks if the queue is empty.<br>  * @returns True if the queue is empty, false otherwise.<br>  */<br> method isEmpty():<br>     return size of elements == 0<br><br> /**<br>  * Moves a node up in the tree, i.e., towards the root.<br>  * @param index - The index of the node to move up.<br>  */<br> method bubbleUp(index):<br>     while index &gt; 0:<br>         parentIndex = floor((index - 1) / 2)<br>         if elements[parentIndex].priority &lt;= elements[index].priority:<br>             break<br>         swap elements[parentIndex] with elements[index]<br>         index = parentIndex<br><br> /**<br>  * Moves a node down in the tree, i.e., away from the root.<br>  * @param index - The index of the node to move down.<br>  */<br> method bubbleDown(index):<br>     length = size of elements<br>     element = elements[index]<br><br>     swapIndex = null<br><br>     do:<br>         swapIndex = null<br>         leftChildIndex = 2 * index + 1<br>         rightChildIndex = 2 * index + 2<br><br>         if leftChildIndex &lt; length and elements[leftChildIndex].priority &lt; element.priority:<br>             swapIndex = leftChildIndex<br><br>         if rightChildIndex &lt; length:<br>             if swapIndex is null and elements[rightChildIndex].priority &lt; element.priority:<br>                 swapIndex = rightChildIndex<br>             elif swapIndex is not null and elements[rightChildIndex].priority &lt; elements[leftChildIndex].priority:<br>                 swapIndex = rightChildIndex<br><br>         if swapIndex is not null:<br>             elements[index] = elements[swapIndex]<br>             elements[swapIndex] = element<br>             index = swapIndex<br>     while swapIndex is not null</pre><blockquote><strong>Code-block #2 </strong>— <em>Pseudo-code for a Dijkstra’s algorithm implementation and a Priority Queue with Binary Heap. For the Typescript implementation please refer to </em><a href="https://codesandbox.io/p/sandbox/blissful-pasteur-tp83sc?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clyss7yjv00062e6bdu2fi7vy%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clyss7yjv00022e6bijoggf2k%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clyss7yjv00032e6bnw08ca18%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clyss7yjv00052e6bbiwdcj29%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B40%252C60%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clyss7yjv00022e6bijoggf2k%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clyss7yju00012e6bxd3zt2dr%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%252C%257B%2522id%2522%253A%2522clystmoqn00022e6bela7ee9m%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A158%252C%2522startColumn%2522%253A61%252C%2522endLineNumber%2522%253A158%252C%2522endColumn%2522%253A61%257D%255D%252C%2522filepath%2522%253A%2522%252Fsrc%252FMeshWrapper.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clyss7yjv00022e6bijoggf2k%2522%252C%2522activeTabId%2522%253A%2522clystmoqn00022e6bela7ee9m%2522%257D%252C%2522clyss7yjv00052e6bbiwdcj29%2522%253A%257B%2522id%2522%253A%2522clyss7yjv00052e6bbiwdcj29%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clyss7yjv00032e6bnw08ca18%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clyss7yjv00032e6bnw08ca18%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A30.4296875%257D"><em>the demo</em></a><em>.</em></blockquote><h4>3. <strong>Integration and demo</strong></h4><p>Now that we have our mesh represented as a graph, and our simple implementation of Dijkstra’s algorithm, we can set up a plain scene (in our case we’ve generated a basic mountainous terrain from a custom BufferGeometry acting as a Plane to use as our mesh — also using simplex noise and some logic to generate peaks and valleys and colour them accordingly) and apply our solution to this mesh. We’ve also added some interaction which allows users to simply click two consecutive vertices on this scene (those would be the little points displayed all over the mesh) and see the shortest path being generated using this solution.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2Ftp83sc%3Fview%3Dpreview%26module%3D%252Fsrc%252Fcomponents%252FInteractiveBox.tsx&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2Ftp83sc&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2Ftp83sc%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2e386ad0d6292cdd5bc759574770426/href">https://medium.com/media/f2e386ad0d6292cdd5bc759574770426/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4iKCUzffECiinbDjCNZOg.gif" /><figcaption>Fig. 3 — Working demo with the implementation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xks-d-FvJoDx9AzWtT7Jxw.gif" /><figcaption>Fig. 4 — Same demo with a wireframe for more comprehensive geometry understanding</figcaption></figure><h3>Conclusions</h3><p>To wrap this up, this implementation offers a robust and efficient solution for path-finding on mesh surfaces. By combining a simple node graph representation with Dijkstra’s algorithm, we’ve adapted a proven idea, using different technologies to handle the intricacies of mesh geometry with ease. This solution not only achieves the primary objective of finding the shortest path but also sets the stage for further optimizations and enhancements (for example by enhancing the graph structure to use a <a href="https://en.wikipedia.org/wiki/Doubly_connected_edge_list">half-edge structure</a> instead, or by improving the algorithm to follow the groves by enhancing the weighted edges with more information).</p><p>This path-finding solution is already widely used across various domains. In the field of computer graphics and gaming, it can enhance the realism of virtual environments by enabling precise navigation on complex terrains. In robotics and autonomous systems, it can facilitate path planning on irregular surfaces, and in architectural design and urban planning, it might aid in visualizing spatial layouts and simulating movement. Additionally, it is used in scientific simulations, geological modelling, and medical imaging, where accurate path-finding is crucial. In our particular use case, it is helping us find the shortest path in 3D meshes representing medical data, enabling us to build precise medical editing tools.</p><p>Overall, we’re excited to see our solution re-used in other three.js projects that might need such a solution and look forward to the advancements it may inspire in the field of mesh surface path-finding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cyPVyyt-sQmT7cJ0" /><figcaption>Fig. 5— The optimal path valley (Generated by Bing Image Generator)</figcaption></figure><h3>References</h3><h4>Academic:</h4><p>[1] — Corey Trevena (2015), Algorithms Used in Pathfinding and Navigation Meshes 3 Concepts and Terminology: Basic Visual Representations. <a href="https://www.semanticscholar.org/paper/Algorithms-Used-in-Pathfinding-and-Navigation-3-and-Trevena/39a49c8b9863362a8fafa7fac4eab2ae2aff017d">https://www.semanticscholar.org/paper/Algorithms-Used-in-Pathfinding-and-Navigation-3-and-Trevena/39a49c8b9863362a8fafa7fac4eab2ae2aff017d</a></p><p>[2] — Chia-Man Hung &amp; Ruoqi He (2018), Pathfinding in</p><p>3D Space. <a href="https://ascane.github.io/assets/portfolio/pathfinding3d-slides-en.pdf">https://ascane.github.io/assets/portfolio/pathfinding3d-slides-en.pdf</a></p><p>[3] — Fatima-Zahra, H., Farhaoui, Y. (2024). Analyzing the Shortest Path in a 3D Object Using a Reinforcement Learning Approach. In: Farhaoui, Y., Hussain, A., Saba, T., Taherdoost, H., Verma, A. (eds) Artificial Intelligence, Data Science and Applications. ICAISE 2023. Lecture Notes in Networks and Systems, vol 837. Springer, Cham. <a href="https://doi.org/10.1007/978-3-031-48465-0_74">https://doi.org/10.1007/978-3-031-48465-0_74</a></p><p>[4] — Estefania Cassingena Navone (2020), Dijkstra’s Shortest Path Algorithm — A Detailed and Visual Introduction. <a href="https://www.freecodecamp.org/news/dijkstras-shortest-path-algorithm-visual-introduction/">https://www.freecodecamp.org/news/dijkstras-shortest-path-algorithm-visual-introduction/</a></p><h4>Blog / Tutorial:</h4><ul><li>IronEqual (2017), Pathfinding like a King. <a href="https://medium.com/ironequal/pathfinding-like-a-king-part-1-3013ea2c099">https://medium.com/ironequal/pathfinding-like-a-king-part-1-3013ea2c099</a></li><li>Justin Young (2024), Pathfinding Part 1 with Dijkstra’s Algorithm. <a href="https://excaliburjs.com/blog/Pathfinding%20Algorithms%20Part%201/">https://excaliburjs.com/blog/Pathfinding%20Algorithms%20Part%201/</a></li></ul><h4>Other implementations (using three.js):</h4><ul><li><a href="https://github.com/dhruvmisra/Pathfinding-Visualizer-ThreeJS">https://github.com/dhruvmisra/Pathfinding-Visualizer-ThreeJS</a></li><li><a href="http://sruzek.github.io/algorithms/dijkstras.html"><strong>http://sruzek.github.io/algorithms/dijkstras.html</strong></a></li><li><a href="https://dijkstra-threejs.netlify.app/"><strong>https://dijkstra-threejs.netlify.app/</strong></a></li><li><a href="https://github.com/cedricmillet/Dijkstra-threejs"><strong>https://github.com/cedricmillet/Dijkstra-threejs</strong></a></li><li><a href="https://gist.github.com/sdjacobs/3900867adc06c7680d48"><strong>https://gist.github.com/sdjacobs/3900867adc06c7680d48</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e77dcaea689" width="1" height="1" alt=""><hr><p><a href="https://blog.promaton.com/optimal-route-crafting-finding-the-shortest-path-on-the-surface-of-a-mesh-8e77dcaea689">Optimal Route Crafting: Finding the shortest path on the surface of a mesh</a> was originally published in <a href="https://blog.promaton.com/">Promaton</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The onboarding ascent: climbing the peaks of ownership and trust]]></title>
            <link>https://blog.promaton.com/the-on-boarding-ascent-climbing-the-peaks-of-ownership-and-trust-172df3b5b037?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/172df3b5b037</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[onboarding]]></category>
            <category><![CDATA[company-culture]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[3d]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Mon, 20 Nov 2023 12:05:04 GMT</pubDate>
            <atom:updated>2023-11-20T12:31:31.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tYBXmeUqmMbywv8Q" /><figcaption>Fig.0 — The onboarding journey begins (Microsoft Bing Image Creator)</figcaption></figure><p>It’s now roughly six months since I joined Promaton as a front-end engineer working intimately with WebGL/three.js. Despite the course of time, I’m still feeling the excitement from my first weeks, which I’d love to share with you, as it has been one of the most interesting and thrilling onboarding experiences of my career.</p><p>New joiners at Promaton are usually invited to tackle an onboarding project, for about a month’s time, which is typically suggested by the team they will be working with. Generally, it is a relatively open-ended assignment.</p><p>The reasoning behind this is that new joiners can start their life at Promaton by getting familiar with the stack, technologies, processes, and team without the pressure of meddling in production code. This also provides them with more agency, ownership, and accountability for their project, on which they have to work by themselves.</p><p>My onboarding assignment was to build a prototype (or rather proof-of-concept) based on a series of hypotheses that had been determined by my team. The structure of the assignment presented the problems (mostly user experience pain points) and some of the hypotheses that had been brainstormed by the team in order to attempt and improve on these issues. From there, I was given total autonomy to consider how it would be approached. I approached it by researching the existing experience, outlining the user journeys and verifying the described pain points — which then led me to start writing detailed technical documentation, illustrating how the problem would be approached (Fig.1 &amp; 2). I was given the freedom to choose some parts of the stack and design the architecture I felt most comfortable with, and had some technical discussions with the team, helping to validate that the path forward would be a fruitful one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/0*qGQ4OgH8tDumlWI7" /><figcaption>Fig.1 — Choosing the tech stack and solutions</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JG631u-SkI1C7jLN" /><figcaption>Fig.2 — Drawing user journey diagrams</figcaption></figure><p>During the course of a month, I was given the opportunity, freedom and ownership to build a prototype tackling some high-impact user experience issues. This is because we believe that you need to empower people if you want them to reach high-impact goals. Without wanting to go too much into detail, we’re talking about a web application that leverages Promaton’s AI and 3D visualisations to greatly improve dental clinicians’ lives, by saving them time and effort by automating implant and restorative treatment planning and design. I also had a huge amount of support from the extended team, who very promptly were ready to brainstorm, answer questions, suggest solutions and help with various infrastructure-related hurdles.</p><p>During this time, I had the possibility and agency to build this piece of software and experiment with different technologies I had been curious about. I had the chance to decide on the technical options, and in that process also learned a lot about the business context of Promaton, but also about the products, not only the ones owned by my team but also the wider-range portfolio of products, some of which I had to integrate.</p><p>Roughly one month later, I was presenting the prototype (still quite incipient at this point, as you might imagine, Fig.4) to the broader Promaton team, who provided very constructive feedback and widely celebrated the efforts made in this journey. The first iteration was completed successfully and well received. In the middle of this journey, there was also a very fun week-long hackathon, where I completely changed the context for a full week and made a little interactive map for displaying the geolocation data of our API usage — (Fig.3)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hoQbzJQ1Xbp_fZtp" /><figcaption>Fig.3 — Building cool stuff during hackathon amidst onboarding</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kQMjAAsXdqB8TidP" /><figcaption>Fig.4 — First iteration of prototype</figcaption></figure><p>Little did I know that this onboarding project would turn out to be so relevant, that after this intense month, we’d continue to work on it.</p><p>We performed a series of user interviews with real clinicians, and based on that feedback, continued iterating on the prototype for the next couple of months.</p><p>At a point, it became ready (we could consider it a completed second iteration, Fig. 5) to be presented to the extended team and technology leadership of our parent company.</p><p>This led to a brief moment of nervousness for me: showcasing the prototype I had been working on in an all-hands meeting with nearly a hundred people watching.</p><p>However, this quickly dissipated as the team continued to be supportive and constantly reiterated the practical value and potential of the work that had been done.</p><p>It ended up being a successful presentation, the feedback was overwhelmingly positive.</p><p>We now continue to work on this project with greater support from our parent company and continuous positive reception, which is where we are at the moment: performing user interviews and working on a third iteration based on that feedback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a-SAwGighMvRoZbq" /><figcaption>Fig.5 — Second iteration of prototype</figcaption></figure><p>This leads me to the end of the story per se, but I still want to reflect on this journey.</p><p>I believe it not only very well represents a lot of the Promaton values, but also constitutes an interesting onboarding experience that is rarely seen throughout our industry, as usually, engineers joining a new company are typically given menial and routine tasks to start with and get accustomed to the codebase, the processes and the team.</p><p>With this very particular format of onboarding, Promaton is successfully promoting key pillars of its (engineering) culture:</p><ul><li><strong>ownership</strong> (as new joiners are expected to own their onboarding project from start to end and be accountable for it)</li><li><strong>trust</strong> (as the bulk of choices made during this time are the responsibility of the engineer)</li><li><strong>empowerment</strong> (as people are encouraged to present to leadership, discuss and challenge ideas, take the helm of the project)</li><li><strong>building things fast</strong> (prototyping and testing ideas is widely encouraged),</li><li><strong>agility</strong> (continuous iteration and rapid feedback are essential to drive the development further)</li><li><strong>involvement </strong>(as people are encouraged to participate in user interviews, be proactive with UX questions, etc)</li><li><strong>teamwork </strong>(as support and collaboration from peers and other actors within the company are encouraged and welcome)</li></ul><p>Feeling the real impact of your work, being given the opportunity to demonstrate your value and getting overwhelming support from your peers to achieve great results: this is certainly one of the best and most exciting ways to start working in a new company.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SfUaiQ0Tdvw6COCa" /><figcaption>Fig.6 — Reaching the onboarding summit (Microsoft Bing Image Creator)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=172df3b5b037" width="1" height="1" alt=""><hr><p><a href="https://blog.promaton.com/the-on-boarding-ascent-climbing-the-peaks-of-ownership-and-trust-172df3b5b037">The onboarding ascent: climbing the peaks of ownership and trust</a> was originally published in <a href="https://blog.promaton.com/">Promaton</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding Peace in the Silence: A Zen Approach to Being Ghosted by a Recruiter]]></title>
            <link>https://medium.com/@christian.marques/finding-peace-in-the-silence-a-zen-approach-to-being-ghosted-by-a-recruiter-750a7465b888?source=rss-7a313bdb96ad------2</link>
            <guid isPermaLink="false">https://medium.com/p/750a7465b888</guid>
            <category><![CDATA[recruitment]]></category>
            <category><![CDATA[ghosting]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[zen]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Christian Marques]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 14:36:00 GMT</pubDate>
            <atom:updated>2023-06-13T14:36:00.739Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuXYEW790g9EwSH04s-RJg.jpeg" /><figcaption>Image from <a href="https://unsplash.com/@oriento">五玄土 ORIENTO</a></figcaption></figure><p>I’ve recently had a couple of experiences in the job market as a software engineer where after an entire recruitment process, the feedback just didn’t arrive, and emails weren’t replied to, which left me confused and struggling with unexpected feelings of frustration, rejection and self-worth.</p><p>In the world of job searching, it’s not uncommon for candidates to go through an entire recruitment process, only to receive no feedback and have their emails go unanswered. However, there are ways to deal with these situations and let go of negative feelings. Some have found that Eastern philosophies, particularly Zen Buddhism, offer useful philosophical lessons and approaches that can be applied to such situations, as well as many other complex, fast-moving and frustrating situations in life.</p><h3>A brief context on Zen Buddhism</h3><p>Zen Buddhism is a school of Buddhism that originated in China during the Tang dynasty, and later spread to other parts of East Asia, including Japan. It emphasizes the practice of meditation and mindfulness as a means of attaining enlightenment, or a state of deep awareness and understanding.</p><p>Zen Buddhism is often associated with simplicity, directness, and a focus on the present moment. Practitioners of Zen Buddhism seek to cultivate a sense of peace, clarity, and compassion in their lives, and often use meditation and other practices to help them achieve these goals.</p><p>In Zen Buddhism, there is also an emphasis on non-dualistic thinking, or the idea that there is no inherent separation between oneself and the world around them. This perspective encourages practitioners to see the interconnectedness of all things and to approach life with a sense of openness and curiosity.</p><p>Overall, Zen Buddhism is a philosophy and practice that emphasizes mindfulness, compassion, and non-attachment as a means of achieving inner peace and enlightenment. Its principles can be applied to many aspects of life, including dealing with difficult situations like being ghosted by a recruiter.</p><h3>How Zen can help you deal with job market rejection</h3><h4>1. Practice non-attachment</h4><p>Zen Buddhism emphasizes the importance of letting go of attachment to outcomes and accepting things as they are. Try to let go of any expectations you had about the recruiter getting back to you, and accept that they may not have been the right fit for you.</p><h4>2. Practice mindfulness</h4><p>Pay attention to your thoughts and emotions as they arise, without judgment or attachment. Observe any feelings of disappointment or frustration that come up and let them pass without clinging to them. Understand that these feelings are natural and part of being a human being, but practice and direct your non-attachment efforts towards them.</p><h4>3. Focus on the present moment</h4><p>Rather than dwelling on the past or worrying about the future, focus on the present moment. This can help you stay grounded and centered, and may also help you notice other opportunities that arise. Past and future are, in many cases, constructions our minds create. By immersing ourselves fully in the present moment, we cultivate a sense of awareness and clarity that transcends the limitations of time and learn to appreciate the beauty and richness of each passing moment, realizing that the present is the only moment that truly exists. Embracing the present moment allows us to live authentically and fully, unfettered by regrets or anxieties, and to discover the peace that lies within.</p><h4>4. Cultivate compassion</h4><p>Remember that the recruiter who ghosted you is also a human being, with their own struggles and challenges. Try to cultivate compassion for them, rather than anger or resentment. A good way to do so is to try and put yourself in their shoes and empathize with their experience. Recognize that they may be dealing with their own pressures, deadlines, or personal difficulties that led to their actions. By shifting our perspective from one of judgment to understanding, we open ourselves to a deeper sense of compassion.</p><h4>5. Practice gratitude</h4><p>Focus on the things in your life that you are grateful for, rather than dwelling on the disappointment of being ghosted by a recruiter. This can help you maintain a positive outlook and cultivate a sense of contentment and joy. Fortunately, the software industry is a thriving one and even if you didn’t land this particular job, there are still numerous opportunities awaiting you. Instead of fixating on the missed opportunity, redirect your attention towards gratitude for the skills and experiences you possess, as well as the potential for growth and new possibilities. By embracing gratitude, you open yourself up to a world of endless potential and cultivate a resilient spirit that can navigate through life’s challenges with grace and optimism, which definitely result in eventually landing the job you were looking forward to.</p><h3>In conclusion</h3><p>Being ghosted by a recruiter can be frustrating and disappointing, but it’s important to remember that it’s a common occurrence in the job search process. Essentially, being ghosted means that a recruiter you’ve been in contact with suddenly stops responding to your emails or calls, leaving you unsure about the status of your job application or the recruitment process. This can happen for a variety of reasons, such as the recruiter getting busy, the position being filled, or the company changing their hiring plans.</p><p>However, approaching the situation from a Zen Buddhism perspective can help you find peace and acceptance. Zen Buddhism emphasizes the importance of non-attachment to outcomes and accepting things as they are. To deal with being ghosted in a Zen way, you can practice non-attachment by letting go of any expectations you had about the recruiter getting back to you, and accepting that they may not have been the right fit for you. You can also practice mindfulness by paying attention to your thoughts and emotions as they arise, without judgment or attachment, and focus on the present moment rather than dwelling on the past or worrying about the future. Cultivating compassion for the recruiter who ghosted you can also help you move on in a positive way.</p><p>It’s important to remember that being ghosted by a recruiter is not a reflection of your worth or abilities. Instead, it’s a common occurrence that can happen to anyone during the job search process. While it’s understandable to feel frustrated and disappointed, taking advantage of Zen Buddhism techniques can help you find peace and acceptance, and move forward with a positive outlook, stronger than ever.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=750a7465b888" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>