Changing Curve Slope

This is a 2 part question. I have included a screen shot to aid in this question along with the Rhino file. My goal is to change a curve to a certain slope such as 10%.

  1. If I want to change the flat curve by moving the end point vertically 8 feet so that the curve has the same slope along the entire curve how do I do this? If I grab the control point at the end it simply wants to move the end of that segment. I want to move the entire curve at the same slope as I change the vertical location of the last point on the curve. The “Final Point” represents 8 feet. The length of the curve is 80 feet. So if I raise the end of the curve up 8 feet such that the slope is the same throughout the curve then I end up with a 10% slope on the curve. How do I do this by moving the end point vertically?

  2. Let’s say I didn’t want to move the end point around by dragging it vertically, then is there a way to change the slope of the curve by somehow matching it to the slope of another line such as the “10% Slope Line”? I’m searching for a technique where I can select the sloped profile line and the target curve and have the target curve end up with the slope profile of the first line selected. Is there a way to do this?


    Slope Along Path.3dm (19.1 MB)

There are several ways to do this, in the attached are two ‘classics’.

  1. Extrude the curve to height and use InterpolateCrvOnSrf on the resulting surface from corner to corner. In this case it helps to rebuild the curve with a large number of points.

  2. Extrude the curve to height, use CreateUVCrv with the surface, draw a diagonal on resulting rectangle, then re-apply that to the surface using ApplyCrv.

Slope Along Path Example.3dm (1.9 MB)

3 Likes

another method might be the command fin. here you need any kind of base surface.

4 Likes

Fin does not create a congruent slope: After experimenting with the Fin, InterpolateCrvOnSrf, and CreateUVCrv/ApplyCrv commands I discovered that the Fin command does not work for this but the other two do because the Fin command does not keep the same slope throughout the entire curve. I drew a vertical line at the mid point of the curve (40’) of 4’ to analyze the slope of the resulting curve at the mid point. Fin had a gap so the slope was much higher on the first half of the curve compared to the last half. The other two commands kept the same slope throughout.

Faster Technique Found: Both the InterpolateCrvOnSrf and CreateUVCrv/ApplyCrv techniques require me to calculate the height of the curve and inserting a point there prior to creating the new curve. What if you didn’t want to do this calculation to speed up time but you had the slope as two line objects as I had above? You use the Flow command. Select the line object that represents the slope you want, then select the line on the cplane below the sloped line close to where that line and the sloped line meet, and then select the curve on the cplane.as the target. Draw a vertical line from the original curve up to the new one and trim the excess. No calculations needed.

sorry, i just threw it in as some raw meat. nevertheless i have one more quick raw meet to offer, try flow, the result does not look accelerated to me. here you of course take the already angled line and flow it along the curved.

Hi Mike - see how this one does - FlowAlongSrf the angled line from one surface to another, with History. The surfaces are extruded from rebuilt base line and curve.

Slope Along Path_Maybe.3dm (573.6 KB)

You can adjust the height/slope of the angled line to adjust how it looks on the curvey surface.

-Pascal

1 Like

ExtrudeCrv the curve vertically into a surface.
UnrollSrfUV the extruded surface.
Draw a line on the unrolled surface with the desired slope.
FlowOnSrf the line onto the extruded surface
Slope Along Path DC01.3dm (3.1 MB)
This method should be (almost) insensitive to the parameterization of the base curve.

2 Likes

Simple method:

ExtrudeCrv the base curve vertically.
ShortPath on the extruded surface ffrom the corner to the point.

The shortest path on an unrolled developable surface is always a straight line.
A curve extruded in a straight line is always a developable surface.
A curve of constant slope on the extruded surface will be a straight line on the unrolled surface.

1 Like

Then there is the Grasshopper way…

Just reference your curve, and set the height via slider. Use as many samples as you want. Guaranteed to be constant slope as the heights are linearly interpolated along the length of the curve.

ConstantSlopeCrv.gh (11.9 KB)

2 Likes

Here’s a try at a slope checker…

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

1 Like

And here is a slightly more sophisticated version that lets you set a start height relative to the curve as well as the end height. It will make a constant interpolated path between the two settings. If the original curve is flat, the slope will be constant from start to end (the slope can also be downward). If the original curve is in 3D, it will follow that curve in 3d but with the interpolation between the start and end heights added (or subtracted if the values are negative).

ConstantInterpolatedCrv.gh (13.7 KB)

1 Like

It appears you and I replied close to the same time. In my reply I suggested using Flow after further research because then you don’t have to do the height calculation in order to facilitate the slope.

oh my, it appears i have failed utterly, first i suggest nonsense, then i suggest what i have blissfully ignored which you have come up with already :thinking: :flushed: sorry bout that was a chaos day, but you have so many suggestions now. just to point out once more what @davidcockey posted i believe shortpath may indeed be a good suggestion if you have the height points already maybe the least involving also assuring continuity. i wonder if flow keeps a good continuity at all

No worries. Flow does in fact stay consistent in it’s slope. Here’s the screenshot comparing the 4 techniques. The red midline is 4 feet high and the last vertical is 8 feet high.

Check elsewhere besides the midpoint. You will most likely find some slight differences. Do all of the procedures in the same spot (on different layers perhaps). Then compare all of the results one on top of the other.

Good point. For everyone’s knowledge I did in fact add a 2 foot vertical at 20 feet down (25%) the line and a 6 foot vertical at 60 feet and took screenshots. I’m not surprised the InterpolateCrvOnSrf was off because it interpolates of course. The same goes for CreateUVCrv…it’s an estimate from what I have experienced. Fin’s way off of course. So if you need precision for things such as designing roads, paths, etc, then Flow is the one to use. It is right on at 20, 40, 60, and 80 feet.




I tried FlowAlongSrf as well and that seems to interpolate the points. See the screenshot. Flow is still the clear winner here for accuracy.

Hi Mike - FlowAlongSrf in the example I posted above seems pretty consistent:

-Pascal

ShortPath works great if you know the height that the curve has to be at the end point. So you have to do the calculation before hand.

So if I know the height before hand then it’s ShortPath. If I don’t then it’s Flow. Both of these are dead on accurate if this level of accuracy is needed which is in my application.

The FlowAlongSrf, InterpolateCrvOnSrf, and CreateUVCrv all do create really close results. Good enough for most applications that don’t have to have the slope dead on.

Note that the Grasshopper definition is both parametric - you can set the height to anything you want and vary it as you need - as well as being guaranteed to be accurate et every sample point along the curve - and you can set any number of samples you like. As it samples by equal length increments, the solution is independent of the original’s curve parametrization, which is what affects some of the other solutions.