Break points rotation with same angle

hello! already second post.

need this operation that it’s making me crazy:

i have this segment with this break points, and i want to rotate the segments with same angle.
as you can see i’ve already try it to do it but very badly and not efficient.

VERY IMPORTANT: the quantity of breakpoints can change, the’re not standard. so!, depending on how many breakpoints i add on this curve, this operation should always work.

a friend of mine suggested me ANEMONE, but cannot understand how to use it. also, reffering to this, what should i do, flatten the segments or graft them and use them as a tree?

rotation of segments with same angle.gh (19.1 KB)

Something like this?


Rotation with Breakpoints.gh (16.1 KB)

@akilli That’s an interesting approach :slight_smile: - but looks like your file didn’t get attached properly?

Here’s my (perhaps too literal) interpretation of the problem using compound transformations:
rotation of segments with same angle V2.gh (18.0 KB)

(I had to write a little “Mass Composition” utility script in the bottom right corner because Grasshopper doesn’t allow for a GH_Transform to be used in Multiplication / Mass Multiplication components)

from Rhino.Geometry import Transform
R = Transform.Identity
Pr = []
for xform in X:
  R *= xform
  Pr.append(R)

Thanks qythium, the file is there now. Compound transformations are probably the most succinct approach…

thank you all!!!

now, what happened if a do different angle rotation for example?

Just change the graph type.

I think there is a problem with this because of this: Compound transformation equivivalent in C#

and this: Mass Addition component in C#

GH_transforms opposite direction of rhinocommon in its matrix.

@Michael_Pryor let’s take this example why, although there is “problem” with @qythium approach, does this seem correct?
How should the right approach for the C# to work as expected?

rotationV3.gh (17.6 KB)

It is correct in terms of GH geometry transformations. Manually doing it one by one with GH, Cluster, and the C# script result in the same, the python does not result in the same. (and this has nothing to do with python vs C#, it has to do with what order things are added to the transformation matrix.

The reason is this as @qythium explains

In that other thread I’m pretty sure I was doing coordinate basis transformations, where multiplying additional transformations onto the right was the correct way of doing things. (as opposed to geometry transformations in fixed reference space as is being done here)


rotation MP.gh (26.7 KB)

So if you want to do what the python script does in this case, just look at the script its right there in python. R *= xform. So in C# just change result = t * result to be the same as the python, so result *= t. But keep in mind this will give you incorrect results with geometry transformation order as shown in the other thread.

2 Likes

that makes sense, all clear Michael, thanks!