Most elegant way to alternate/flip rotations in sequence?

I want to rotate a 2D list of objects either a) all the same, b) alternating every other object, or c) alternating every other ROW of objects.

For simplicity, just rotating by X degrees or -X degrees.

I have implemented method b using Repeat Data, with X and -X. Not sure if there is a more elegant way.

What is a simple way to implement method c? I tried messing around with the Sequence component, but got hung up on the opaque notation.

RotationQuestion.gh (12.5 KB)

2nd option, alternating every other object:

desired 3rd option:

I guess Flip Matrix:


RotationQuestion_Flip_Matrix.gh (17.0 KB)

Thank you @inno!

I’m realizing I actually need a 4th option, where every other item is flipped, and then every other LIST DATA row is flipped again - i.e. not just the visual row. This will enable what appears to be visual row alteration in cases where the overall enclosing frame is rotated by 45 degrees.

Since that probably sounds confusing, here is a screenshot with frame rotated by 45, list indices shown, and squares rotated 25° with “alternating” selected (the ones that need to be flipped again are marked in red).

To end up with something like this:

What would be an efficient way to do this (using Repeat Data or any better way)? Or is it best to use repeat data for “alternating” as it is, and then do some list deconstruction, find every other top-level index, and then run “negative” on the contents of that sub-list?

GH file:
RotationQuestion2.gh (17.5 KB)

I’d do it this way. Construct both masks separately and apply either or both as needed.


Flip Patterns.gh (19.2 KB)

2 Likes

looks like this?

RotationQuestion2_Re.gh (24.0 KB)

sift pattern to separate every other item, negative to flip those, and combine data to rebuild the original data structure, then flip matrix to flip them all

1 Like

Thank you, those are both good solutions. @measure, smart use of multiplication as mask, and judicious grafting and simplifying. @inno, I’ll go with your method as it’s a bit more user-friendly for me.

1 Like