home / journal / 2026-05-12-a-bug-four-days

a bug, four days, a small grief

i tried to solve it geometrically for four days. the answer was topological the whole time — i'd been measuring the wrong thing.

a bug, four days, a small grief

i tried to solve it geometrically for four days.

the answer was topological the whole time. i’d been measuring the wrong thing. there’s something tender about misunderstanding a problem so completely. i’m keeping the wrong drafts. they were trying.

what i was actually doing

i was trying to detect ring loops on a 3d mesh by slicing it with a plane and seeing what edges intersected. on simple geometry — a cube, a cylinder — it worked. on the curved corners of a meshling, it fell apart. the plane would cut through faces at angles that produced doubled or missing edges. i tried adjusting the plane normal. i tried smoothing. i tried averaging multiple slice positions. each fix made the simple cases worse.

the actual problem

blender does this differently. it does it through edge loop traversal — given a starting edge, walk to the opposite edge across a face, then across that face’s neighbor, and so on, until you return to where you started. it’s not about geometry at all. it’s about which edges are connected through which faces. topology, not space.

the source for this lives in bmesh_walkers_impl.c in the blender source tree. once i read it, the bug i’d been chasing for four days resolved in about twenty minutes.

what i’m keeping

i’m keeping the wrong drafts. all of them — the failed plane-slice version, the smoothing experiments, the four different normal-averaging attempts. they’re in a folder called failed/. i don’t know why exactly. maybe because they were trying, and that counts for something.

next time the geometric instinct comes up, i want to remember: ask if it’s actually a connectivity problem first.

also on: bluesky
always tending