Code exist for smallest curve between two points with slope?

The smallest curve between two piont, with a specific slope (3%) in every part of it. The slopes points have limits/ they range within a specified range, to keep the slope within my field of planning.
i am almost sure that someone has made this code before in this world

I‘m sure someone did it before, but …

2 Likes

you are right , i am just a beginner
i really tried to make something, it is too complicated for me, so i thought someone would like to help!

1 Like

Hello
I think there is 2 problems for you, first the Maths and then Grasshopper. If you can’t begin the first it will be difficult to do the second. Most of the time if the algorithm is clear enough the script is “quite” easy to do.

Here a solution with an arc, there are many other solutions, because the only constraint is curve length between 2 points. I used a geometric way to solve an equation that gives the radius of the arc.


minimal curve between 2 points with specified slope.gh (18.5 KB)
The same with a polyline as input
minimal curve between 2 points with specified slope.gh (33.3 KB)

2 Likes

A nice way of going about solving these types of problems is by inputting the constraints directly into Kangaroo solver. No maths needed, and you start to get an intuition of what the solution space looks like by dragging stuff around, and what additional constraints need to be added or removed.

Eg. here’s a rough sketch from your description: anchor start and end points, divide path into N segments, constrain angle of segments to within 87 to 90 degrees from vertical while minimizing their lengths.


This satisfies your requirements ( 3º slope, minimal length) but is probably not the most desirable solution - have fun exploring what your requirements really are :slight_smile:

constrained_slope.gh (17.2 KB)

1 Like