On "Curves and Surfaces"
Added 2021-11-05 04:07:02 +0000 UTCAfter publishing an article I often find myself reflecting on what worked well and what didn't, which ideas got abandoned and which I really liked. I figured my Patreon is a good place to publish some of those thoughts. It's more of a loose collection of notes than anything structured, but I hope it will provide at least some insight.
It's always a bit unusual with what motivates me to write a blog post about a certain topic. For instance, "Naval Architecture" was inspired by a short kayaking trip – I found it very interesting how the vessel interacts with waves and what affects its balance. With my last article the impetus was a bit different. I've always heard that curvature continuity is important for surfaces, but I couldn't figure out how reflections would look if that continuity wasn't maintained. I've answered that question for myself with a single demo, but "some article about curves" has been on my list for a while and I ended up with "Curves and Surfaces".
When it came to creating the hero demonstration seen on top of the page I originally wanted to use a model of a teddy bear for that purpose. I hoped it would be fun to move its hands or shape its ears, but my Blender modeling skills are severely limited and I wasn't happy with any of my initial creations. I searched for some YouTube tutorials on basic character modeling in Blender and the first part of one of them focused on the face. When I saw the thumbnail it hit me that a face is a great idea for the initial demonstration – one only has to drag two control points to completely change the expression of the face:

This made it a fantastic object to present the concept of control points and the smoothness of subdivision surfaces. After I exported the basic mesh from Blender I spent quite a while playing with the demo myself – it was a lot of fun to deform the face into various expressions.
For the main flow of the article I liked the idea that I would jump back and forth between curves and surfaces on the go. While an extension of a linear segment into a stick dragged through space was, quite literally, straightforward, I had a hard time figuring out how I'd continue into curves. After playing with those first surfaces it was clear that they themselves contain curves, but it was only after I wrote down the guiding equations that I realized that quadratic Bézier curves are created from the diagonal of the input square. I was very happy with how natural that switch from surfaces to curves felt, which then established the universe of proper curves and surfaces.
As usual, I struggled a bit with color choices. I was experimenting with bolder shades like cyan and pink, but few of them fit well and only the purple persisted – I think it mixes with yellow nicely:

Unfortunately, with my design skills I can't beat a simple combination of red, yellow, and blue. On the flip side, one little design thing I was happy with were the little triangles in some of the equations:

I like that they make parts of the equations carry their own plots with them. I originally had it implemented as a mode where one would have to switch between the textual and "triangular" form of the equations, but thankfully I dropped that concept since it was a bit annoying.
My original idea for the corner cutting explanation was a top-down view of a park that has paved paths with sharp corners that after a while undoubtedly get cut by people trying to shorten their journey by walking on grass – there is an entire subreddit dedicated to that phenomenon. Unfortunately some initial rough designs were super disappointing:

I couldn't get the art look good, so I abandoned this concept and used the white piece of paper instead. The paths in a park would be a closer analogy to polygonal paths getting cut, but at least the clean sheet of paper is a better fit for the narration of starting from scratch.
I think I'm the least happy about the section on surface curvatures. Even though they're mathematically important, all those demos of normal and principal curvatures are more of a side note and I don't think they provide that much value. I only kept them for completeness sake and because I didn't want to throw away the work I put in them.
The last demo I worked on was the train track simulation – I made it literally two days before publishing. I originally wanted to show some plots of force over time and then to actually present the transition curves on the tracks, but, as it's often the case near the end, I ran out of steam and just shipped the simple version. In a perfect world the train would e.g. emit smoke as it goes, but it just ended being a yellow semi-rounded rect.
My biggest eureka moment was coming up with the idea of applying the rules of subdivision to curves that fork. This concept came to me after seeing how Catmull-Clark subdivision surfaces naturally handle the cases of arbitrary number of neighbors – I wanted to see if the same idea extends to curves. Luckily, it did. I'm pleased with how well it ended up working, I haven't seen that concept applied before.
While the article is not perfect and could still use some design tweaks, I'm overall fairly happy with how it turned out.