Hello,
I need to create a polyline based on a set of input controls. The polyline needs to be a ZIG ZAG pattern, always following Left Turn - Right Turn - Left -Right - Left -Right and so on.
The Zig Zag also needs to have segments that follow specified lengths: Either 46in, 58in, 70in, or 82in.
Finally, the kinks between the segments needs to be at specified angles: either 30°, 40°, or 50°
I have gotten very close with kangaroo but am still getting double repeat turns - LRRLLRL, instead of LRLRLRLR every time.
Please help!
ZigZag_Forum.gh (62.0 KB)
Hello
Kangaroo is not mandatory to do that. You can use mass addition for the angles (one positive one negative …) then make lines, then mass addition for the lines that defines also a vector.
zig zag.gh (11.7 KB)
3 Likes
This is perfect! Once I matched the angles / lengths to my shuffled values it was exactly what I needed! Thank you!
1 Like
I don’t know if this actually satisfies the kink constraint, and obviously @laurent_delrieu already solved it brilliantly. But this seemed like a fun little coding exercise to go with the morning coffee:
241025_RandomConstrainedZigZagWalk_00.gh (10.9 KB)
Edit: Missed the part about taking a left turn first (in the world XY plane):
241025_RandomConstrainedZigZagWalk_01.gh (10.9 KB)
Edit II: Your constraints make for some interesting looking squiggles if one keeps on walking:
1 Like