# Get all segments of curve with length, arc length and rotation

For tube bending purposes I’m trying to get data on every segment of a curve (a filleted polyline).
What I need are the length of the segment (straight and curved), the bending angle of the arc segments and the rotation between bends.

I’ve attached my grasshopper sketch. So far I’m getting the lengths and angles of each bend, but what would be the best way to get the rotation between the bends? As in “rotate tube for 30 deg clockwise before bending next angle x in distance y”?

curve.gh (7.6 KB)

Sorry, missed to do that.

curve_internalized.gh (7.9 KB)

Thanks, but that’s what I have already. What I’m looking for is the rotation between the bends. The bends happen on different planes and I’m looking for the rotation between those planes.
Like this simple example would contain 2 90 degree bends, but between the first and second, there’s also a 90 degree rotation taking place. I’m looking for a way to automatically get a list of those rotation values.

White group?

plane_rotation_2019Nov10a.gh (12.6 KB)

Thanks! That’s basically what I’m looking for. The only flaw in this version is the rotation value is always positive. Is there a straightforward way to determine whether it clockwise or anti-clockwise?

I’ve always had this trouble getting consistent values from the Angle (between vectors) component, often getting “reflex angles” or numbers off by 90 degrees from expected. I don’t know how to fix that, sorry.

In 3d, angles are always positive and between zero and 180 degrees (or 0 and \pi radians). As soon as the angle gets bigger or smaller than that, there’s a more obvious way to measure it. Negative angles are a purely 2d phenomenon.

You can supply a plane to the vector angle component which locks down the measurement to a certain 2d context, or you can use the Atan2 function to compute an angle based on a difference in y and x values. I believe Atan2 always yields angles in the -180 to +180 range (or rather the [-π, +π] domain.)

1 Like