by raphlinus · 3y ago · 0 comments
Regarding collaboration with Freya, if she is open to it, please get in touch. I do have some ideas.
[1]: A New Shape Control and Classification for Cubic Bézier Curves, Yang and Huang, 1993, PDF cache: https://github.com/paperjs/paper.js/files/752955/A.New.Shape...
While you’re here, it’s a bit of a tangent, but the introductory part of the video talking about lerp reminded me again that not enough people know about (not quite uniformly) interpolating along a circular arc using two lerps and one division:
For complex numbers a (start), m ("midpoint" on the circle), b (end), and t (parameter in [0,1], or in [-∞, ∞] to cover the whole circle),
circle_interp = (a, m, b, t) =>
lerp(a * (b - m), b * (m - a), t) / lerp(b - m, m - a, t)
https://observablehq.com/@jrus/circle-arc-interpolationConveniently, this works for points in a straight line (a circle of infinite diameter) and we never need to explicitly construct the center or radius of the circle.
I was astonished to find this, and even more astonished to find it had never been clearly published anywhere (at least not that I could find after a lot of searching).
[This parametrization of the circle can equivalently be rewritten as a rational quadratic Bézier, but this formula is IMO a lot clearer to understand.]
(I originally dug into Beziers because I was several levels deep into "Processing.js's text-in-a-box fitting is bad, how can I fix that". Queue learning how OpenType works, how TTF/CFF works, how Beziers work, writing up a code playground tutorial before we really had code playgrounds, and then going "...I can use this for more, can't I?"... And thanks to that I've talked to far smarter people with formal training in both the type design and maths communities. I still consider myself an amateur, but an amateur with expert acquaintances =)