# Scale according Rotation in Geometry Nodes

I'm trying to create a geometry nodes system that one side of my instance always start on the position 0 and always ends on the world position 1 (even if it is rotated). To make this happen, I'm using a transformation node and trying to make the instance scales according the rotation. For this project, the rotation limits are between 0° and 45°. I managed to get the scale to work when the object is at 0° and also when it's at 45°, the problem is the values in between, like 22,5°. Any idea what node or function I could use to achieve this result? Thanks in advance for any help!

It's a little bit of trig.

The length of the rod, (with length L at 0 degrees,) is L/cos(theta)

• Thanks a lot for the help! This helped me a lot and I will definitely use it more in future studies with Blender. Commented Oct 25, 2022 at 19:59

You can actually calculate the scaling based on a right triangle.

$$b$$ is at the beginning the one side with a scaling of $$1$$. If you change the angle, you would only have to calculate $$c$$, which is also your value for the scaling:

$$c = \sqrt{b(tan^2(α) + b)}$$

Translated into Geometry Nodes it should look like this:

(Blender 3.2+)

• Crikey.. you've dug up one of the most obscure trig, identities ! I never learned that one.. :D Commented Oct 24, 2022 at 16:45
• @RobinBetts Ahem, yes, I am not very proud of it ;-) ...but it works! In the end, I'm just more the type for weird thoughts, and you are the math pro :D Commented Oct 24, 2022 at 16:55
• Nope.. no way pro. The only one i remember is SOHCAHTOA. Oh, and sin squared + cos squared = 1. The rest is trial and error :) Commented Oct 24, 2022 at 17:10
• Thanks very much for the help! I knew that the solution could be related to a calculation based on a triangle, but I had no idea how to solve it, especially in blender 😁 I will start studyng more about trigonometric functions to learn how to solve this kind of problem too. Thank you! Commented Oct 25, 2022 at 19:57
• @ThiagoVieira You're welcome! But to be honest, even if the answer works perfectly: The solution of RobinBetts is a tad better, due to the lower number of nodes ;-) Commented Oct 25, 2022 at 20:05