Hacker News new | ask | show | jobs
by dahart 1277 days ago
That’s fair, compelling uses of quadratics are legitimately hard to find, and usually it’s not significantly more costly to go to cubics. Here are few more reasons I’ve collected: the quadratic is easier to explain and understand, useful from a pedagogical perspective; quadratics, unlike cubics, have an analytic rotation minimizing moving frame (a normal and binormal that minimize twist along the curve); quadratics can be analytically sampled in steps of equal change in tangent angle (very handy for drawing, path rendering, tessellating for GPUs); and quadratics are much easier to ray trace (using a swept-circle or swept-sphere formulation). Ray tracing a swept-sphere cubic is solving an order 10 polynomial, while the quadratic is order 6 - but you can reduce the order to 4 with some constraints, which suddenly allows it to be evaluated analytically (in theory), while the cubic is permanently stuck in iterative numeric methods. One of the reasons I liked investigating the quadratic B-spline is because it suddenly makes clear that the order of a B-spline is nothing more than a smoothing factor. Quadratic and cubic and quartic are all the same curve, more or less, just successively smoother. Maybe that’s unsurprising, but from a practical point of view, it can allow you to reduce or increase the order without changing the high level behavior of your curves. Anyway sorry to geek out, I was just curious - I’ve done some work in ray tracing of hair, which is what led me down this path. I did not use quadratics when I worked in games or films, but looking back on it, I think there might have been good reasons to consider it especially on lower powered hardware, maybe for simulation and procedural animation more than hand-animated stuff…