Is there a way to extract the transformation rotation angle from Transformation data? I would like to extract the numerical angle to use in other calculations, not just display it in a panel.
Edit: Assume all transformations are planar rotations.
The following gives an example of a situation I’m considering:
A transformation might be a shearing or a rotation or a mix of many of those, evaluating only a fraction of the whole transformation might result in wrong values.
But, if you know that, for example, your transformation are rotations, and you know the plane of rotation, just transform a small Line segment (0,0,0 1,0,0) and compare before<>after transformation to get the angle.
You know what the ArrPolar ‘A’ (Angle) input is (2 * Pi, the default) so just divide it by the ‘N’ (Count) input to get the angle in radians (cyan group).
Panel does have a way to extract it. So, I thought there might be another component/trick to access it. Your suggestion is my plan if there is no direct way to extract it from the transformation.
I wanted to use whatever would use the least amount of CPU and reduce clutter in the view. This is part of a much larger algorithm that I didn’t include in my post. Again, Panel can access it. I thought there might be a component/trick to access it simply and efficiently.
I don’t know what that means? If ArrPolar ‘A’ is always 2 * Pi, or even if it’s not, it’s available without needing a text panel. Only a single division component is needed to get the angle. Looks minimal compared to parsing the ‘X’ output. Am I missing something?
I think you’re missing that I am asking whether there is built-in component or some simple way to access it directly from the transformation output in a way similar to that which is used by Panel. I know that I can implement it the way that you did. I am still learning GH. I thought this kind of question would elicit some knowledge about GH that I could learn from. This is not a criticism of GH, but the documentation is very basic. Now, I’m a bit sorry I asked the question.
Hi @habudg ,
There is no grasshopper (default) component which would extract your rotation angle. Regardless of the fact that you see it in the “Panel”.
If you would like to understand how to extract it from Rhino’s Transformation, then you have to take a look at what Rhino’s Transformation matrix represents:
Basically, you have XY plane rotation, so rotation angle is around the Z axis. In order to obtain this rotation angle: according to upper article, one way is to get the arccos func from the first item in the Transformation Matrix:
All of this is not faster than the solutions Oster or Majewski provided.
If you want to have a single component which calculates the angle, just make a Grasshopper cluster. TransformationQuestion 20230914.gh (12.3 KB)
Thanks, you answered my question. I’m familiar with the method you presented and understand that it would not be more efficient than the other methods posted. Panel must be using the transformation matrix method and that the rotation angle would not be directly stored as a property of the X output of the Polar Array component.