# Point at change of curve direction

Hi Good people,

I would like to place a point where a line/curve change the direction. Is in Dynamo any node for that or do you have any suggestion how to do ti?

Best Regards,

Hi,

can you please post an example (a drawing, a screenshotâ€¦) of what do you exactly mean/want?

What do you mean for direction, the tangent vector? If itâ€™s a curve itâ€™s changing at every point, if itâ€™s a polyline itâ€™s changing at every segment.

Hi Luca,

Thank you for the feedback!

here is short example. With the lineâ€¦

You just need Curve.EndPoint.
If you have a polycurve, you need first to use Geometry.Explode to get the segments.

â€¦then I use node start and end point of line to get the pointsâ€¦
how can I filter/get points where is direction changed??

Compare the vectors of each lineâ€™s tangent at start and mid points as one method.

Ok, maybe now I got what you meant. You have Polycurves where each segment is actually made of multiple parallel contiguos lines, right?

Partially as @JacobSmall said, I would compare tangent vector at the end of a segment to the one at the beginning of the next one.

In this case I made a Polycurve with apparently 3 segments, but actually the last one is made of 3 lines (total 5).

End to beginning wonâ€™t catch curves that change radius but start tangent.

Tangent at the end of the first line to midpoint at the second will.

@JacobSmall good point, I was only thinking about linear segments, not for example lines and arcs together (point A).

But still this doesnâ€™t work in other cases, in point B the vectors at the middle of the arc and at the beginning of the line are the same, so it would not be recognized as discontinuity.

Moreover Iâ€™m getting troubles with node List.Equals or Vector.IsAlmostEqualTo, they donâ€™t work as expected.
An easy solution would be to have a node that joins 3 segments with same direction in one line, but this doesnâ€™t exist, I am correct? Even when I join polycurves, Dynamo still recognize the previous subcurves

The tangent at endpoint of segment B is a vector approaching 0,-1,0. The tangent at parameter 0.5 of segment. C is 1,0,0. Ergo a change in plane.

The actual condition where the midpoint is parallel to the previous endpoint does exist though, not in simple lines and tangential arcs though (draw a speed bump in section, or a complex spline). Testing the start point and the endpoint would work in most simple geometries (misses splines). A comparison between the length of the curve and the distance between the start and endpoint can also help for that one.

That said, knowing that there are infinite tangent vectors on a curve, we might be able to pull non-linear curve start and endpoints as a inclusion method. Hard to say without knowing more of what @adnandjâ€™s end game is though.

My bad, I was not precise enough in my example. What I meant was this (although it depends if we read/draw the curves from right to left or in the other way round):

I assumed the topic was related to find the non-smooth change of direction in a curve, like a cusp for example. In this case the only way is to analyze the direction of the curve at the point to find where, as in Mathematical Analysis is said, the directional derivative changes sign.

According to this definition I would classified the cases as follow:

Anyway the problem is a bit more complex, because it also depends on the drawing direction of the curve (end and start point might be messed up)

I perfectly agree

2 Likes

Hi @lucamanzoni and @JacobSmall,

thank you for your feedback. I had a little bit more of work and did not have time to play with Dynamoâ€¦

So more details about my use caseâ€¦
I would like to analyse curves, which usually contains segments in different ways and lenghts (simple example attached in previous post).
With analyse I mean to divide a curve (to segment lenghts which is user input, to 90 angle corners and other corners).