Point on a 2D curve at a certain slope

Does anyone know of a simple control in grasshopper to find a point(parameter) on a gently curving 2d curve at a given slope.
I have been experimenting with graphing all slopes on curve at even intervals,then interpoloating data to find my slope, it just seems very involved.I am hoping there is a control or cluster that is readily available.
i have searched the discourse forum and internet with little success.

i have my crappy attempt to post , i am embarrassed that it is so cumbersome.
curve slope attempt.gh (62.3 KB)

phil

Probably not the one component fits all solution you were hoping for, but anyway…You can specify a slope and it will find the corresponding point (with a little leeway for rounding) For purposes of visibility, I scaled your curve x100 in the y direction to do all the geometry.


curve slope attempt-b.gh (53.2 KB)

Method I use in Rhino, not Grasshopper for curves without wiggles:
Create line with the desired slope
CrvDeviation to find the closest and furtherest points
Depending on whether the curve is convex or concave relative to the test line, the point with the same slope is either the closest or futherest point.
Find Slope.3dm (1.5 MB)

2 Likes

I figured I’d try @davidcockey’s method in GH. Definitely simpler than mine. It uses the Curve Proximity component which looks for the closest point between two curves. As mentioned elsewhere, the curve can’t have any squiggles.

curve slope by proximity.gh (47.5 KB)

3 Likes

rhino / (non-grasshopper):
set Cplane by X-Axis
snap to Quadrant
(see screenshot)

grasshopper-concept:
cplane-boundingbox and intersect with curve.
filter start / end - point

but notice: there are some special geometrical cases to filter:

  • 2d-curve might have curvature-changes / direction change and have multiple points that fit.
  • the curve might not have the slope
  • … (maybe some more)

kind regards -tom

David
thanks for the reply, your method is like snapping a line tangent to the curve(like i would do it in solidworks).
however, my curve is a raw ,precision cmm measurement of a master sphere+system noise.
i have a calibration file with thouands of points that represent the error in my probe tip.
this file is two column data (slope and error at that slope) and need to superimpose it on the raw curve data, so i need grasshopper or rhinoscript for automation.

I do like you method though
kind regards
Phil

Ethan
thanks for the quick reply
this method is basically the same as mine. A lot of “stuff” to get a simple answer.
i was surprised that threre was not a stock control available.
Pascal had shown me some of the new slope tools in V7 for surfaces when released,but seems 2d was not on anyones radar.
thanks for looking and giving me ideas.
Phil

Thanks Tom

not sure if i completely understood. Why do you need to find a specific slope ?
can t the information of the calibration be represented (approximated) geometrically ?

another thought - you might benefit from using a line-arc approximation of the initial curve.
then query each segment of this polycurve.

what does the screenshot in your initial post show ? or is your problem already solved ?

Tom
at the risk of sounding rude(which is not my intention), in my original question i was asking if there was a control available to do this, my image was of my version, which works but is cluttered, i was hoping for a pointer to a food 4 rhino download. That said i appreciate what you have posted, my problem is solved already, this is a small aspect of overall project, and was looking for something clean and reliable.
This problem should probably be solved using the 1st derivative of curve and a converging search using a tree,
but that stuff still gives me nighmares whenever i delve into the data tree world.i Know that some of the superstars here would make this so slick, but i am not asking for it to be solved ,unless perhaps if you count an existing control that i was asking about.
i also do appreciate your input, there are always many ways to solve a problem and this place is where i get most of my ideas to solve problems,so thanks for contributing.
Kind regards
Phil

Hi there,

Resurecting an old topic because I am experiencing the same as Philip above.
The proposed solution is quite simple and elegant !
But the approach identified above had one limit: It does not work with wigely curves.

I have a case with a curve which is unfortnuately wiggely.

I was thinking : there must be a more mathematical approach to the challenging task of finding the precise point(S) where a given curve has a x slope (degree or percentage…) ? However I am far from being a math wizzard…
I just thought : A curve is defined by an equation - can this lead to the solution ? I remember that the derivative of a given curve gives us the slope… but lets be honnest : I do not know where I am going and neither how to implement that in Grasshopper - so it is kind of a little SOS if anyone has an idea on how to deal with these math…

Some background. Rhino uses parametric equations for curves with x, y and z each being a function of a parameter u. One of the reasons this method is used is because it works in three dimensions. It is also compatible with the parametric equations used for surfaces. Rhino uses a NURBS forumulation for both curves and surfaces.

With the parametric equations the slope is not equal to simple first derivative. If the curve is planar and parallel to the xy, xz or yz planes then the slope in the two dimensional sense will be equal to dy/du / dx/du; dz/du / dx/du or dz/du / dy/du. In other situations calculating the “slope” is a bit more complicated but can entirely feasible and will depend on how “slope” is defined.

The direction of a 3D curve at a point is usually defined as a vector tangent to the curve at that point.

1 Like

David
My original question was for a 2d planar curve only. That being said i cant remember if i solved it or not. i was hoping for a “reverse” component of eval curve , ie point(s) at a cetain slope.
Phil

1 Like

Understand, but internally all curves in Rhino are 3D parametric curves. No curves in Rhino have the form y = f(x).

This thread is three years old but it’s a slow day…

This version works on two curves at once. ‘Slope_1’ slider sets the target slope on the smooth curve at the bottom, ‘Slope_2’ slider sets the target slope on the wiggly curve (which has multiple points that match the target slope, even though I show only one).

Slope angles are measured relative to X and Y directions respectively and use absolute value, but all of that could be changed.


curve slope_2025Apr28a.gh (58.6 KB)

The difficult part of this code was showing nothing when the range of angles is exceeded.

I had my new best friend chatGPT knock up a vb control, so its not my work but it seems to work on a 2d curve
Phil

slope point on a 2d curve.gh (11.5 KB)
point at a slope.3dm (38.8 KB)

:rofl:

What are the slope (tangent) angles measured against?

Showing multiple points where the angles are found is very good :red_exclamation_mark: Tempted to add that detail but not that interested…

It sort of works using multiple curves but showing multiple points stops working:


slope point on a 2d curve_JO.gh (6.8 KB)

Joseph
in this case a horizontal line is 0 deg
rotate 45 deg ccw and that is 45 deg.

it is only a show and tell as i am novice at this stuff.i only use it to get past momentary hurdles,
as you said , this is 3 years old.

Mhmmm interesting - Is a funny rabbit hole to dive in.

Both solutions (spaghetis script from Joesph, and VB from Philip’s best friend) work in a discrete approach by testing x points along the curve if I am correct ?

I’ve seen worse spaghetti GH. My name is spelled like “Jose” with “ph” added.

Let’s see your version :question:

3 Likes