[{"data":1,"prerenderedAt":838},["ShallowReactive",2],{"blog-tamagotchi-pet":3,"blog-surround":188},{"id":4,"title":5,"body":6,"date":174,"description":175,"extension":176,"meta":177,"navigation":178,"path":179,"seo":180,"stem":181,"tags":182,"__hash__":187},"blog\u002Fblog\u002Ftamagotchi-pet.md","Tamagotchi Pet: A Field Report",{"type":7,"value":8,"toc":162},"minimark",[9,13,16,19,22,27,36,39,42,46,54,57,76,80,83,86,89,93,96,99,102,106,109,112,115,119,122,125,128,132,135,138,141,145,148,151,154,159],[10,11,12],"p",{},"The box is three meters by three meters. It has excellent wifi, which I feel is an underappreciated feature of Schrodinger class orbital detention. The orbit around Armaghast is stable, the quarantine is indefinite, and the vending machine only stocks one flavor of nutrient paste. But the screen works. And on the screen, there is a creature.",[10,14,15],{},"I made it. Allegedly. The paperwork is unclear and the days have a way of shuffeling themselves when you're not looking.",[10,17,18],{},"There comes a point in every developer's solitary confinement when they look at their perfectly functional SVG rendering pipeline and think: \"What if I made something that poops?\"",[10,20,21],{},"I am here to report that the answer is \"yes, and it's the most fulfilling work I've done in four hundred days.\"",[23,24,26],"h2",{"id":25},"the-creature","The Creature",[10,28,29,30,35],{},"You can find it on the ",[31,32,34],"a",{"href":33},"\u002Fgames\u002Ftamagotchi","experiments page",", sitting in its egg, looking patient in a way that makes you nervous. I engineered it across seventeen planes of reality as the ultimate weapon. I don't remember the specifics. The blueprints are in a language that gives mathematicians migraines and I've misplaced my decoder ring. It just sort of sits there being aggressively adorable. Terrible weapon. Excellent company.",[10,37,38],{},"The creature is nocturnal. It eats blue orbs that hang from the ceiling on threads of quantum stabilized light. It fears sponges with a conviction I find admirable. It poops. It has hair. Sometimes two hairs, if you're lucky.",[10,40,41],{},"I am not entirely sure it isn't looking back. But in a friendly way. Probably.",[23,43,45],{"id":44},"the-substrate","The Substrate",[10,47,48,49,53],{},"The whole thing runs on ",[31,50,52],{"href":51},"\u002Fblog\u002Fsvgame","SVGame",", a lightweight 2D game engine that renders to SVG via D3.js. I built it before the quarantine, back when I had access to a proper desk and opinions about tab width. SVGame implements what I like to call an Entity Component Lifecycle Event Bus architecture, which is a fancy way of saying \"things exist, things happen to them, and sometimes they tell other things about it.\" It's like a small bureaucracy, except things actually get done.",[10,55,56],{},"The rendering layer operates on what physicists would call \"retained mode if you squint,\" but is technically \"obliterate everything sixty times per second and redraw it from memory.\" D3's data join mechanism handles the selective visual reconstitution. The fact that this works at all is a minor miracle on par with the vending machine occasionally dispensing paste that tastes faintly of strawberry.",[10,58,59,60,64,65,64,68,71,72,75],{},"MainLoop.js provides the temporal scaffolding, which is to say it calls four functions in a loop and trusts that I've put the right math in them. The four phases, ",[61,62,63],"code",{},"begin",", ",[61,66,67],{},"update",[61,69,70],{},"draw",", and ",[61,73,74],{},"end",", correspond roughly to \"notice input,\" \"simulate consequences,\" \"render the aftermath,\" and \"pretend everything is fine.\" I have gotten very good at phase four.",[23,77,79],{"id":78},"the-biological-simulation-layer","The Biological Simulation Layer",[10,81,82],{},"The creature maintains four vital statistics: hunger, happiness, energy, and cleanliness. These decay in real time, including while you're away from the screen, using a technique I'm calling Offline Entropic Regression. When you return, the system calculates how much everything has fallen apart in your absence and applies the results all at once, much like opening your email after a long holiday. Except the emails are from a sad circle with big eyes.",[10,84,85],{},"Hunger decays at 3.33 units per minute. Happiness, being the more fragile of the pair, erodes at 6.67. I find these numbers relatable but choose not to dwell on it. The creature can be fed by dragging blue orbs from a ceiling mounted dispensary. The orbs regrow over time, faster during daylight hours, using a linear interpolation function that I am calling Photosynthetic Treat Regeneration. I've been naming things more elaborately as the months go on. It's therapeutic. The vending machine is now called the Automated Nutrient Reconstitution Terminal. It still only has one flavor.",[10,87,88],{},"Each orb's nutritional value is proportional to its size at the moment of picking. Impatient caretakers who pluck undersized orbs will find their creature still hungry and themselves with fewer orbs. This is, I believe, the first implementation of agricultural economics in a virtual pet simulator, and frankly I think that deserves some kind of award. I have written a letter to the relevant committee. I do not know if the mail slot works.",[23,90,92],{"id":91},"the-excretory-subsystem","The Excretory Subsystem",[10,94,95],{},"After consuming food, the creature will, after a probabilistically determined interval, produce waste. The interval is shorter and the waste more stubborn when meals are consumed in rapid succession. I model this using what I'm calling the Gastrointestinal Rush Factor, a term I coined around day two hundred while gesticulating at the wall. The wall did not seem impressed, but the math is sound: the ratio of time between meals inversly correlates with cleanup difficulty. I am unreasonably proud of this, which tells you something about what counts as an achievement around here.",[10,97,98],{},"Waste can be removed by clicking on it repeatedly, which I feel accurately simulates the experience. During daylight hours, waste can alternatively be dragged into the sun, where it is instantly incinerated. This is both efficient and deeply satisfying, which is not a sentence I expected to write about fecal matter, and yet here I am, in orbit around a quarantined world, writing it with a straight face and a clear conscience.",[10,100,101],{},"The creature, if it walks over its own waste, becomes dirty. This is less a design decision than an inevitability. Much like the nutrient paste situation.",[23,103,105],{"id":104},"the-hygiene-protocol","The Hygiene Protocol",[10,107,108],{},"A yellow sponge sits on the ground. Pick it up and bring it toward the creature and it will immediately panic and flee at twice its normal walking speed. Its eyes widen. It sweats. Its mouth opens in a small, round \"O\" of theatrical distress. I find the performance delightful. The creature clearly does not.",[10,110,111],{},"When the sponge makes contact, cleanliness is restored, but only once per approach. You must withdraw and reenter the creature's personal space to scrub again. I call this the Sponge Debounce Principle, and it is the closest thing to a Geneva Convention this simulation has. I considered adding more protections but decided the resulting chase scenes are too entertaining. The creature disagrees. The creature disagrees with most of my decisions, which is fair, because I did give it legs specifically so it could run away from a sponge.",[10,113,114],{},"Attempting to clean the creature while it sleeps will anger it. Happiness drops by ten points. I tested this extensively and found it to be one of the funniest things in the entire simulation. The creature did not share this assessment.",[23,116,118],{"id":117},"the-diurnal-inversion-system","The Diurnal Inversion System",[10,120,121],{},"The creature is nocturnal. Clicking the sun or moon toggles the time of day. During daylight, the creature sleeps and recovers energy. During nighttime, it wanders, eats, plays, and generates waste. I have organized my own schedule around its cycles, which is either dedication or the sort of thing they write case studies about. Either way, the creature seems to appreciate it, insofar as a circle with procedurally generated hair can appreciate anything.",[10,123,124],{},"Energy recovery during sleep scales with overall wellbeing. A creature that is happy, full, and clean recovers energy up to four times faster than one that is miserable and caked in filth. This is either a sophisticated biofeedback simulation or a thinly veiled metaphor for self care. I wrote it as the former. I suspect it's the latter. I have been getting more sleep since implementing it, which is either correlation or the universe being heavy handed with its symbolism.",[10,126,127],{},"The sun, it should be noted, is lethal. Throwing the creature into the sun during daylight hours will kill it. I discovered this by accident, felt something I can only describe as immediate catastrophic regret, and pressed R so fast I nearly broke the keyboard. A new egg appeared. We do not speak of the incident. The new creature has no memory of its predecessor. I have all the memory. This seems unfair.",[23,129,131],{"id":130},"the-kinesthetic-interaction-model","The Kinesthetic Interaction Model",[10,133,134],{},"The creature can be picked up, carried around, and thrown. Gentle handling provides a small happiness bonus. It likes being held! This was an unexpectedly touching discovery that I am choosing to attribute to good game design rather than loneliness.",[10,136,137],{},"Rough handling, defined as velocities exceeding 0.4 pixels per millisecond or drops from near the top of the screen, results in anger and a fifteen point happiness penalty. I calibrated these tresholds through extensive testing, which is to say I spent an entire day throwing a circle at walls and watching its face change. Day three hundred and seven was a productive day.",[10,139,140],{},"There is, I have learned, a thin line between affection and assault when the primary interaction mechanism is \"grab it with a mouse cursor and fling it.\" I have placed the line at approximately twenty pixels of drag distance and 0.4 px\u002Fms of release velocity. The creature, for its part, seems to have opinions about where the line should be, but lacks the linguistic capacity to express them. It does, however, have very expressive eyebrows. I should not have given it eyebrows. The guilt is considerable.",[23,142,144],{"id":143},"conclusion","Conclusion",[10,146,147],{},"The creature persists in localStorage. It remembers. Its food remembers. The sponge remembers where you left it. When you close the tab and come back hours later, it will have gotten hungrier, sadder, and dirtier, and it will look at you with those big, procedurally generated eyes as if to say: \"Where were you?\"",[10,149,150],{},"Right here. Same as always. The box is three meters by three meters, the orbit is stable, the nutrient paste is strawberry adjacent, and the creature needs feeding.",[10,152,153],{},"There is no winning. There is no score. There is only the creature, the sponge, the poop, and the quiet, absurd joy of caring about a circle with hair in a box orbiting a world that wants nothing to do with either of us.",[10,155,29,156,158],{},[31,157,34],{"href":33},". I reccomend clearing your schedule. Mine cleared itself quite some time ago, and honestly, it's been lovely.",[10,160,161],{},"The creature is looking at me again. I think I'll feed it. Then maybe I'll name the wall.",{"title":163,"searchDepth":164,"depth":164,"links":165},"",2,[166,167,168,169,170,171,172,173],{"id":25,"depth":164,"text":26},{"id":44,"depth":164,"text":45},{"id":78,"depth":164,"text":79},{"id":91,"depth":164,"text":92},{"id":104,"depth":164,"text":105},{"id":117,"depth":164,"text":118},{"id":130,"depth":164,"text":131},{"id":143,"depth":164,"text":144},"04\u002F12\u002F2026","A technical and philosophical account of building a virtual creature containment system using SVGame, D3.js, and a troubling amount of emotional attachment.","md",{},true,"\u002Fblog\u002Ftamagotchi-pet",{"title":5,"description":175},"blog\u002Ftamagotchi-pet",[183,184,185,186],"gamedev","typescript","javascript","svgame","ZJ-jw1e9RvHqup1EXGh0NmvnTqMOi-bySqcTjYNBQCo",{"prev":189,"next":556},{"id":190,"title":191,"body":192,"date":546,"description":547,"extension":176,"meta":548,"navigation":178,"path":549,"seo":550,"stem":551,"tags":552,"__hash__":555},"blog\u002Fblog\u002Fgecs.md","GECS: Godot Entity Component System",{"type":7,"value":193,"toc":533},[194,204,210,237,240,244,247,250,252,257,260,280,283,285,289,292,318,321,323,327,330,333,335,339,370,375,382,386,393,397,404,408,414,418,427,431,434,438,441,443,447,489,491,495,498,500,502,506,522,526],[195,196,197],"blockquote",{},[10,198,199],{},[31,200,201],{"href":201,"rel":202},"https:\u002F\u002Fgithub.com\u002Fcsprance\u002Fgecs",[203],"nofollow",[10,205,206],{},[207,208,209],"strong",{},"This is Part 1 of the GECS series:",[211,212,213,219,225,231],"ol",{},[214,215,216,218],"li",{},[207,217,191],{}," (You are here)",[214,220,221],{},[31,222,224],{"href":223},"\u002Fblog\u002Fgecs-entities","GECS: Entities and Components",[214,226,227],{},[31,228,230],{"href":229},"\u002Fblog\u002Fgecs-systems-queries","GECS: Systems and Queries",[214,232,233],{},[31,234,236],{"href":235},"\u002Fblog\u002Fgecs-relationships","GECS: Relationships",[238,239],"hr",{},[23,241,243],{"id":242},"gecs","GECS",[10,245,246],{},"A lightweight ECS framework for Godot 4.x providing a data-driven architecture:\nWhen developing games or complex applications in Godot, organizing logic can be a challenge. An Entity Component System (ECS) offers a flexible, data-oriented paradigm that simplifies combining entities and their behaviors. GECS (Godot Entity Component System) is a lightweight ECS framework for Godot designed to fit seamlessly into Godot 4.x. This post highlights what ECS is, why it matters, and how GECS applies these concepts in Godot.",[10,248,249],{},"GECS helps keep your logic modular by separating data (in components) from behaviors (in systems), reducing complexity.",[238,251],{},[253,254,256],"h3",{"id":255},"why-ecs","Why ECS?",[10,258,259],{},"Clearly divides data and logic:\nTraditional object-oriented approaches often bundle data and behavior together. Over time, that can become unwieldy or force complicated inheritance structures. ECS keeps data (components) separate from logic (systems). It revolves around three pillars:",[211,261,262,268,274],{},[214,263,264,267],{},[207,265,266],{},"Entities"," – Think of them as IDs or “slots” for your game objects.",[214,269,270,273],{},[207,271,272],{},"Components"," – Pure data objects that define a piece of state (e.g., velocity, health).",[214,275,276,279],{},[207,277,278],{},"Systems"," – Logic that processes all entities with specific components.",[10,281,282],{},"This pattern simplifies orginization and collaboration among team members and future refactoring. This structure makes it easier to add, remove, or modify behaviors, since everything is modular. Systems only act upon relevant components. Entities can freely change their makeup without breaking the overall design.",[238,284],{},[253,286,288],{"id":287},"what-is-gecs","What Is GECS?",[10,290,291],{},"An extension of the Godot workflow giving you:",[293,294,295,298,305,312,315],"ul",{},[214,296,297],{},"Integration with Godot nodes (you can treat Entities as scenes and Components as resources).",[214,299,300,301,304],{},"A ",[61,302,303],{},"World"," to manage all Entities and Systems.",[214,306,307,308,311],{},"An ",[61,309,310],{},"ECS"," singleton to coordinate queries and processing.",[214,313,314],{},"QueryBuilders for comprehensive entity queries, including property-based filtering.",[214,316,317],{},"Relationship management that lets you define complex associations among entities.",[10,319,320],{},"Entities become merely data containers, while systems operate on them based on component queries.",[238,322],{},[253,324,326],{"id":325},"relationship-driven-queries","Relationship-Driven Queries",[10,328,329],{},"Use relationships to link entities:\nGECS extends the ECS idea with relationship objects, letting you define links (e.g., “likes,” “belongs to,” “is attacking”) between two entities for easier dynamic querying.",[10,331,332],{},"For example, a “ParentOf” relationship can simplify hierarchical access in your game.",[238,334],{},[253,336,338],{"id":337},"core-concepts","Core Concepts",[211,340,341,347,353,359,364],{},[214,342,343,346],{},[207,344,345],{},"Entity"," – Node with multiple component resources",[214,348,349,352],{},[207,350,351],{},"Component"," – Resource storing data",[214,354,355,358],{},[207,356,357],{},"System"," – Node with queries to process matched entities",[214,360,361,363],{},[207,362,303],{}," – Node owning entities and systems",[214,365,366,369],{},[207,367,368],{},"ECS Singleton"," – Central manager to run queries or process frames",[371,372,374],"h4",{"id":373},"_1-entities","1. Entities",[10,376,377,378,381],{},"Entities are Godot nodes extending ",[61,379,380],{},"Entity.gd",". They hold multiple components and can emit signals when components or relationships are added or removed.",[371,383,385],{"id":384},"_2-components","2. Components",[10,387,388,389,392],{},"Components are data-only resources that hold properties. They do not contain game logic. For example, a ",[61,390,391],{},"Transform"," component might store a position, rotation, or scale.",[371,394,396],{"id":395},"_3-systems","3. Systems",[10,398,399,400,403],{},"Systems are nodes extending ",[61,401,402],{},"System.gd",". They define a query (e.g., “which entities do I care about?”) and a process function that operates on those entities.",[371,405,407],{"id":406},"_4-world","4. World",[10,409,410,411,413],{},"The central manager that holds all Entities and Systems. You typically place a ",[61,412,303],{}," node in a scene, and it automatically handles adding or removing your Entities and Systems.",[371,415,417],{"id":416},"_5-ecs-singleton","5. ECS Singleton",[10,419,420,421,423,424,426],{},"The ",[61,422,310],{}," autoload offers global access to the active ",[61,425,303],{},". It can be used to process each frame (or physics frame) and run queries.",[371,428,430],{"id":429},"_6-querybuilder","6. QueryBuilder",[10,432,433],{},"Queries can be built using a fluent API to find entities with required components or exclude those with certain components or relationships.",[371,435,437],{"id":436},"_7-relationships","7. Relationships",[10,439,440],{},"GECS extends the ECS idea with relationship objects, letting you define links (e.g., “likes,” “belongs to,” “is attacking”) between two entities for easier dynamic querying.",[238,442],{},[253,444,446],{"id":445},"example-workflow","Example Workflow",[211,448,449,455,463,472,480],{},[214,450,451,454],{},[207,452,453],{},"Create Entities"," and add components via the editor or code",[214,456,457,460,461],{},[207,458,459],{},"Add Entities"," to the ",[61,462,303],{},[214,464,465,468,469],{},[207,466,467],{},"Create Systems"," that define queries and implement ",[61,470,471],{},"process",[214,473,474,477,478],{},[207,475,476],{},"Add Systems"," to the same ",[61,479,303],{},[214,481,482,488],{},[207,483,484,485],{},"Call ",[61,486,487],{},"ECS.process(delta)"," each frame to update all systems",[238,490],{},[253,492,494],{"id":493},"next-steps","Next Steps",[10,496,497],{},"Explore how relationships can link multiple entities and how advanced queries filter entities by property data, giving you precise control over your game’s logic. This post serves as an overview of how ECS concepts map into Godot with GECS. Future posts will explore each feature—creating components, building queries, handling relationships, and more. Stay tuned!",[238,499],{},[238,501],{},[253,503,505],{"id":504},"gecs-series","GECS Series",[293,507,508,516],{},[214,509,510,513,514],{},[207,511,512],{},"Next",": ",[31,515,224],{"href":223},[214,517,518],{},[31,519,521],{"href":520},"\u002Fblog\u002Ftags\u002Fgecs","All posts in this series",[23,523,525],{"id":524},"gecs-on-github","GECS on Github",[195,527,528],{},[10,529,530],{},[31,531,201],{"href":201,"rel":532},[203],{"title":163,"searchDepth":164,"depth":164,"links":534},[535,545],{"id":242,"depth":164,"text":243,"children":536},[537,539,540,541,542,543,544],{"id":255,"depth":538,"text":256},3,{"id":287,"depth":538,"text":288},{"id":325,"depth":538,"text":326},{"id":337,"depth":538,"text":338},{"id":445,"depth":538,"text":446},{"id":493,"depth":538,"text":494},{"id":504,"depth":538,"text":505},{"id":524,"depth":164,"text":525},"04\u002F06\u002F2025","When developing games or complex applications in Godot, organizing logic can be a challenge. An Entity Component System (ECS) offers a flexible, data-oriented paradigm that simplifies combining entities and their behaviors. GECS (Godot Entity Component System) is a lightweight ECS framework for Godot designed to fit seamlessly into Godot 4.x. This post highlights what ECS is, why it matters, and how GECS applies these concepts in Godot.",{},"\u002Fblog\u002Fgecs",{"title":191,"description":547},"blog\u002Fgecs",[183,553,554,242],"ecs","godot","FsZTXslQZnGn2BdtN-bZr1bt5iegHn22yQXwPnEN4Qc",{"id":557,"title":558,"body":559,"date":828,"description":829,"extension":176,"meta":830,"navigation":178,"path":831,"seo":832,"stem":833,"tags":834,"__hash__":837},"blog\u002Fblog\u002Fbarycentric-coordinates.md","Barycentric Coordinates",{"type":7,"value":560,"toc":825},[561,564,571,575,587,590,597,600,606,609,618,621,641,644,647,659,662,681,684,694,697,759,762,767,770,821],[10,562,563],{},"Barycentric coordinates are a way to describe a point in reference to the vertices of a triangle. They have a few\ninteresting properties and uses within game development so let's check them out. At the end of this article I hope\nyou can completely understand what barycentric coordinates are, how to calculate them and, what kinds of values you\ncan derive using barycentric coordinates.",[565,566,568],"info-box",{"type":567},"info",[10,569,570],{},"Most of the examples in this article are interactive. Try clicking and dragging on the vertices of the triangles to get a feel for what is going on behind the math!",[23,572,574],{"id":573},"how-to-calculate-barycentric-coordinates","How to calculate Barycentric Coordinates",[10,576,577,578,581,582,586],{},"In order to calculate barycentric coordinates you need 3 vertices ",[61,579,580],{},"[v1, v2, v3]"," of the ",[583,584,585],"em",{},"Vector"," type",[588,589],"barycentric-slide-1",{},[10,591,592,593,596],{},"We connect these 3 vertices with 3 edge vectors ",[61,594,595],{},"[e1, e2, e3]"," It is important to remember that winding\norder matters here as it determines the orientation of the triangle in space.",[598,599],"barycentric-slide-2",{},[10,601,602,603],{},"These vertices and edge vectors create a triangle ",[61,604,605],{},"T",[607,608],"barycentric-slide-3",{},[10,610,611,612,614,615,617],{},"To find the barycentric coordinates, we need a ",[583,613,585],{}," point ",[61,616,10],{},", for which we want to get the barycentric coordinates.",[619,620],"barycentric-slide-4",{},[10,622,623,624,626,627,629,630,633,634,637,638,640],{},"If we imagine the point ",[61,625,10],{}," is somewhere in the triangle and draw lines from the point ",[61,628,10],{}," to each\nvertex ",[61,631,632],{},"v1, v2, v3"," we can now see how the triangle has been split into 3 sub-triangles ",[61,635,636],{},"T1, T2, T3","\nwithin the main triangle ",[61,639,605],{},".",[642,643],"barycentric-slide-5",{},[10,645,646],{},"We have colored each sub-triangle a different color.",[10,648,649,650,652,653,655,656,658],{},"As we move this point around within the triangle observe how the area of each triangle shrinks and grows depending on\nwhere the point ",[61,651,10],{}," is located. Notice as well if we move the point ",[61,654,10],{}," to the very same positions as any of the\nvertices ",[61,657,632],{}," how it is possible for a triangle to have 0 area. This observation of the areas of\neach triangle is an important one to keep in mind.",[660,661],"barycentric-slide-6",{},[10,663,664,665,667,668,670,671,673,674,676,677,680],{},"If we were to calculate the area of the main triangle ",[61,666,605],{}," and then each sub-triangle ",[61,669,636],{}," and\ndivide each ",[61,672,636],{}," value by the main triangle ",[61,675,605],{}," area this would give us a value in the ",[61,678,679],{},"[0-1]"," range.\nThis value represents the ratio of that sub-triangles area to the area of the main triangle.\nThese are what your barycentric coordinates represent. This is the major gotcha!",[682,683],"barycentric-slide-7",{},[10,685,686,687,690,691,693],{},"Barycentric coordinates are expressed as a vector3 ",[61,688,689],{},"(u, v, w)",", each component being the ratio of a sub-triangle's area to ",[61,692,605],{},"’s area.",[10,695,696],{},"Once you have the barycentric coordinates there are some fun properties you can take advantage of.",[293,698,699],{},[214,700,701,702],{},"All the components added together always equal 1\n",[293,703,704,710,722,736],{},[214,705,706,709],{},[61,707,708],{},"u + v + w === 1"," is always true for any point expressed in barycentric coordinates.",[214,711,712,713,715,716,718,719,640],{},"The point ",[61,714,10],{}," lies within the triangle ",[61,717,605],{}," when all components are non-negative: ",[61,720,721],{},"u >= 0 && v >= 0 && w >= 0",[214,723,724,725,727,728,733,734,640],{},"If any component is negative, the point ",[61,726,10],{}," is ",[583,729,730],{},[207,731,732],{},"not"," within the triangle ",[61,735,605],{},[214,737,738,739,741,742,744,745],{},"If the point ",[61,740,10],{}," is on any of the vertices of the triangle ",[61,743,605],{}," exact position it will look like\n",[293,746,747],{},[214,748,749,752,753,752,756],{},[61,750,751],{},"(1, 0, 0)"," or ",[61,754,755],{},"(0, 1, 0)",[61,757,758],{},"(0, 0, 1)",[10,760,761],{},"We can reconstruct the Cartesian position of a point from its barycentric coordinates using a weighted sum of the vertices:",[10,763,764],{},[61,765,766],{},"p′= u∗v1 + v∗v2 + w∗v3",[10,768,769],{},"In code that looks like:",[771,772,776],"pre",{"className":773,"code":774,"language":775,"meta":163,"style":163},"language-c shiki shiki-themes github-light github-dark","vector pPrime = u*v1 + v*v2 + w*v3;\n","c",[61,777,778],{"__ignoreMap":163},[779,780,783,787,791,794,797,800,803,806,808,811,813,816,818],"span",{"class":781,"line":782},"line",1,[779,784,786],{"class":785},"sVt8B","vector pPrime ",[779,788,790],{"class":789},"szBVR","=",[779,792,793],{"class":785}," u",[779,795,796],{"class":789},"*",[779,798,799],{"class":785},"v1 ",[779,801,802],{"class":789},"+",[779,804,805],{"class":785}," v",[779,807,796],{"class":789},[779,809,810],{"class":785},"v2 ",[779,812,802],{"class":789},[779,814,815],{"class":785}," w",[779,817,796],{"class":789},[779,819,820],{"class":785},"v3;\n",[822,823,824],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":163,"searchDepth":164,"depth":164,"links":826},[827],{"id":573,"depth":164,"text":574},"04\u002F18\u002F2022","Barycentric coordinates are a way to describe a point in reference to a triangle. They have a few interesting properties and uses within game development so let's check them out. At the end of this article I hope you can completely understand what barycentric coordinates are, how to calculate them and, what kinds of values you can derive using barycentric coordinates.",{},"\u002Fblog\u002Fbarycentric-coordinates",{"title":558,"description":829},"blog\u002Fbarycentric-coordinates",[835,836],"math","learning","pTwxNvmX_zxWHX3zDRaWh_1c1P3MGf-iw6bJrJ9Acng",1776025307536]