Rotating rectangles to align with vectors along curve

I divided a curve and moved a rectangle to each point and tried to rotate the rectangles so the align perpendicular to the curve. My problem is that some of the rotation angles need to be negative for the orientation to be correct. You can see the problem along the first and last turn of the curve. I can’t seem to figure out how to call out the specific angles and make them negative while still keeping the script parametric. Please help!

Rotating Rectangles.gh (19.7 KB)

There are many other ways and this is one way.


Rotating Rectangles_re.gh (8.4 KB)

1 Like


RotatingRectangles_2019Jul21a.gh (6.7 KB)

2 Likes

Thanks! This is exactly what I needed.