Do you want to begin at the start point of the polyline, rotate a delta amount in clockwise or counter-clockwise direction - following the polyline -, and split it there, then repeat the previous steps - incrementing delta - until the end is reached?
I want to split the curve every time when the angle sum of the current section is greater than a given value. Image the curve drawn on a sheet of paper and you move a matchbox car along it with your thumb and index finger touching the left and right side of the car at all times. Presumably you can twist your arm 360° â Where are the points where you have to let go? Does it make sense?
Why are there missing segments (gaps) in your results?
You added this clarification after I was well along⌠I saw this in your code but ignored it until I was finished (the group to ânormalize in range (-1 to 1) and subtract ccw anglesâ). That group can easily be added back. Anemone loop in yellow group.
This probably needs more time to verify since some of the results for ânon-convexâ donât look correct.
P.S. This version restores your group to ânormalize in range (-1 to 1) and subtract ccw anglesâ, though Iâm still not sure about the ânon-convexâ polyline?
I believe this version is better. I created a separate GH model to test my understanding of angles with regard to âleft turnsâ vs. âright turnsâ and ended up rotating the first segment 90 degrees, then using the Dot Product of that and the second segment to determine plus or minus.
Oh yeah, and using absolute value (expression âabs(x)â) when comparing to the target angle.
P.S. As a test, you can copy the âangles between segmentsâ group and apply it to the grafted list of segments at the end. Negative numbers are âleft turnsâ (the helix, CCW), positive numbers are CW.
thank you very much for the help. I am currently trying to integrate your solution into my larger script and it is already better. I was wondering though for the âgummy bearâ polyline, shouldnât be all the seams over top of each other if you select 360°? Each layer is a deformed circle and it shouldnât matter how you go around the circle if you get where you started you have turned 360°
edit: forget that
the last image in first post shows it does not work like that
There isnât perfect alignment every 360 degrees, in either curve (helix or âgummy bearâ). The path lengths vary each time around, yet segment lengths are similar, so they donât match up. You can enable preview on the Disc(Discontinuity) component to see all the points.
For the same reason, angles donât add up to the âangle sumâ target either, so when the sum is greater, the sum resets to zero. In that process, I believe one angle is being skipped each time.
Iâve stared at it too long and donât have a fix. Not even sure about my validation. Break time!
This one looks correct to me. The Anemone loop didnât change but I had to rebuild the polyline to get the correct number of segments from the original ânon-convexâ polyline. And a few other changesâŚ
Some of the resulting polyline fragments have only one segment because some angles are greater than the target. Others are quite long. There is a validation group at the bottom, not shown in this image.
NOTE: In the struggle to get code working, some decisions are made in the interest of expediency that should be factored out later. For example:
The ânon-convexâ curve is reparameterized before the Stream Filter while the helix was not. At some point, this difference broke the code so I added reparameterize in three places where it now doesnât need to be.
Insert Items is a data matching thing that could be handled differently, but itâs OK.
The âangles between segments, left and right turns cancelâ group can be clustered as PolyAngle since itâs used again later in the âValidationâ group.