algorithmic modeling for Rhino
I have been looking into drawing a curve with fixed endpoints and a specified length where you can edit the control polygon.
I've not seen any examples of solutions for this or components that would achieve this. If any one knows of an examples please let me know.
As my current understanding of the maths behind controlling a curve is limited I'm not particularly confident in referring to such things as control point weights and knot vectors without causing confusion. However what I had envisioned was a solution where certain parameters were fixed, such as the start/end point, length, control point weights and degree of the curve. With enough of these parameters fixed you would define an area of possible manipulation for the control polygon of the curve and the curve itself. Possibly you could play with a couple of the variables to further increase the area of manipulation.
Sorry for the poor quality of the sketch and photo, hopefully it goes some way to showing my intentions.
If A and B are fixed to the same position in both 1 and 2 and the curve between them is the same length in both instances I wish to restrict the editability of the control polygon to preserve these characteristics.
My current thinking is that I'm going to need to rebalance the nurbs curve definition so the set parameters are one side of the equation and the available ranges on the other side. I had also considered a scenario where you set control points and iterate to a specified tolerance for the length of the curve. I've not made much progress in either direction but i thought it would be interesting to hear some other views on the best way to go about solving this or have someone highlight on obvious or simple solution I've overlooked.
Cheers for any input, as/if i make any progress ill add to the post.
Thom
Tags:
Hi Thom,
unfortunately the length of a curve does not change in a predictable way when you move a control-point. It would be reasonably trivial to come up with an algorithm that moves a control-point along a line (or spline even) until the underlying curve has a certain length, but I'm not sure that gets you where you want to be.
What method do you have in mind for changing the control-point locations? Real-time mouse dragging?
--
David Rutten
david@mcneel.com
I guess real time mouse dragging would be the most intuitive. Although I didn't think it would be possible to do that in the rhino viewport. In the current solutions that I've been working on I've specified xy coordinates for the control points using a series of sliders although the curves have never been restricted by length.
I had thought along similar lines to your suggestion but possibly with a series of lines/splines along which the curve could be deformed so if you shifted a control point out along one line the curve would recede along another to maintain its overall length. Do you think that would be making things significantly more complex?
It's already quite complex, because for this to work nicely it doesn't just matter where the mouse is, it also matters how it got there. Although Rhino provides methods for handling that, there are very few cases where that actually happens (Lasso and Sketch are the only commands that spring to mind).
Using the gumball support in the latest Grasshopper you could actually make this real-time, provided you have the algorithm up and running, which is a pretty big 'provided'.
I have a litmus test to see how difficult it will be to implement something in pure Grasshopper. I ask three questions:
If the answer to any one of these is 'yes' it means you're in trouble. Not trouble you can't get out of necessarily, but trouble nonetheless. In your case you have to answer 'yes' to all three.
Kangaroo may be a good approach as it handles problems 1 and 3 for you. However you'll have little control over how the other control-points move in order to meet the length constraint.
In fact I have no idea how you want the other control-points to move. Is this is a 3D or a 2D problem? Should all points be free to move in 3D space, or should they be constrained to certain lines/curves/surfaces? Should the overall curve shape remain as much the same as possible?
--
David Rutten
david@mcneel.com
Ive been working in two dimensions although if there was a two dimensional solution it may well be possible to work in 3 dimensions on either a single curve or surface, as the solution is less trivial than i thought two will do for the time being.
I spent some time chatting with a friend of mine who is a computing scientist and has a reasonable handle on his maths, he felt that the answer to the problem might lie in some calculus. So instead of preserving the length of a nurbs curve you would preserve the area under the nurbs curve which would be deformed at a particular point.
The degree of deformation that moving the point would cause to the rest of the curve could be defined as a coefficient of the points position in relation to the length of the curve or section of the curve you wished to change.
The curve either side of the point of change would need to iterate to a specified tolerance relating to the length.
I think for usability the curve shape would need to remain as similar as possible to the original. I imagine the curve could behave in quite an interesting manner if it wasn't restricted in that way.
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by