Hey there,
Just wondering if it’s possible to generate a curve by drawing a curve as the curvature graph? This would ensure that the curve being generated has good continuity.
Similar idea here found in another post.![]()
Without looking it up, this smells like an unsolvable problem. Each “spine” of a curvature comb is perpendicular to the source curve, with its length equal to the curvature at its source point. Without a source curve to reference, there are an infinite number of solutions to the question “what spine generated this point?”
I suspect, but cannot prove, that even a constrained version of the problem is impossible. Starting with a pair of source curve and curvature comb, I think that any alteration of the comb would have an indeterminate effect on the source curve. Or to put it another way, there are an infinite number of source curves that can generate the same comb profile.
There might be a relaxation/annealing method that attempts to “jiggle” a curve into place when its comb is changed, but that’d still only be an approximation.
That Youtube video shows a clever method but it’s a discretisation of the problem. Use a linear graph to get a list of curvature values, then generate an arc for each one and splice them end to end. The intermediate result therefore has discontinuous curvature, requiring interpolation to make a curve that is almost but not quite G2. It’s also quite impossible to make a closed curve this way.
Alright after trying to script it myself for a while I totally get what you mean haha, it is very hard, if not possible to create an accurate curve based on the curvature graph, even harder to assign both the start and end points to the generated curve. So far I think what was shown in the youtube video is the closest way you can acheive with grasshopper, though I still feel like there should be a mathematically correct way to acheive this…
Don’t forget that you also have to take account of the scale used to generate the graph from a curve…
I made that video a few years back, after trying to make a grasshopper definition to ‘flatten’ a curvature graph to check whether a spline had a linear rate of curvature change.
You are absolutely right, I had to make a series of assumptions about the scale/length etc of the input graph. It was a useful thought exercise but I quickly figured out it was of little practical use.
I believe that’s true for a flat curvature graph, like the one in @andrew9’s example. In a roundabout way, that’s what his method was already doing, but in a discretised fashion. By reducing the gap between samples, the curvature discontinuities would also shrink, approaching zero in the limit. Well now, doesn’t that sound like calculus? ![]()
If my own calculus skills weren’t rusted to dust, I’d give an example, but I did find this nice one on Geogebra which draws the curvature graph of the cosine function. I bet the relationship between these two functions is given by integrals just like the ones given by Gemini.
But it doesn’t translate to the curvature comb because the axes of the graph are warped by the source curve. You end up with g(x) inside f(x) and f(x) inside g(x) and it becomes unsolvable.
It would be difficult to make an interactive tool that allowed one to manipulate the curvature graph, as the result curve might “run away” or “run toward” the mouse pick point and one would end up chasing one’s own tail or, worse, experiencing positive feedback runaway. However, if one were to constrain the endpoints using G1 or G2 (Hermite) continuity conditions, one could build a tool that could be interactive. This has been done for both planar curves and space curves in a body of work published over the years by Yoshida & Saito and by Yoshida (alone, and with other collaborators) that addresses the problem in a fashion similar to that taken by @andrew9 but which outputs B-splines instead of myriad little arc segments, resulting in truly smooth curves having far fewer control points. Since curvature is related to the second derivative of the curve, reverse-constructing a curve from its curvature signature is a matter of finding something akin to the second definite integral and filling in the blanks for the constants of integration, which Yoshida et. al manage by a single parameter (in addition to the curve-end conditions).
Here’s a link to whet your appetite for converting calculus to code:
As for your posted image of a “square circle,” constructing such a curve is easier than trying to control curvature remotely, if one knows a few rules about how curvature derives from control points in a spline. In fact, the “perfect” square-circle (“squircle,” as I call it) is best constructed using a degree-6 single-span curve having 7 control points for each corner quadrant, and using symmetry and/or history to make the other four corners follow along. In the image below I’ve just spaced the control points equidistant, but if you’re trying to display a true mathematically defined hyper-circle, you’d need to do some math to get the intermediate control points in the right places.
More info is available here:
That’s very informative! Thank you for sharing ![]()