# How to transfer scale direction and magnitude of rotating object to another in world space with Animation Nodes or Sverchok

I was trying to figure out the following problem. If given two objects A and B, A is scaled non uniformly (i.e. scaled along Z axis), B have no scale transformation - can B object be scaled according to A worlds scale direction and magnitude, which additionaly can be modified by rotation.

I already did somewhat succesfull attempt using directly python, here is an example:

but I am curious if this could be done in Animation Nodes or Sverchok easily.

A little clarification

In the first state the scaling object (red arrow) has orientation 0 and scale of 1 i.e. it has no effect on the target object (black rectangle).

In the second state - the arrow is rotated 47 degrees CW and scaled by factor of 2. The rectangle is scaled in the direction of the arrow.

The third state is similar to the second just different orientation and scale of the scaling object.

Basically it is like Rotate object by angle X - apply rotation - Scale object on single axis by given factor - apply scale - rotate back by angle -X - apply rotation.

• i'm not sure what you mean, but if you show the python code you used it can probably be modified to work inside Sverchok too. Code may be easier to comprehend than the natural language (english) description. Sep 13, 2017 at 8:39
• I posted some additional explanation. Sep 30, 2017 at 13:08

I am not sure if there is a mathematical way to describe this transformation, but the closest I can think of is the Shear transformation.

Or translation of vertices based on the distance to the line perpendicular to some vector:

• That's interesting idea Omar! So, I have to input the control object's scale and rotation into the Compose Matrices? BTW, by chance I discovered internal Blender object that behaves in the desired way: 1. Create an Empty object (type Arrows, so you can see the XYZ letters) 2. In Top view scale the Empty along Y axis (for example by 3 ) 3. Press R to rotate the empty in top view and observe the letter Z - it shears according to the scale and rotation of the Empty, but the letter itself doesn't rotate. Oct 10, 2017 at 21:26
• So I played with the node set-up from above adding control object and keeping the modified object still (by inverting the rotation). Here is the new setup: i.stack.imgur.com/X2S6T.png The only issue is that the scaling is in wrong direction. But it's pretty close to what I was aiming for. Any ideas how to fix that issue? Oct 11, 2017 at 7:00
• Thanks, Omar! I think the last variant is an ultimate solution of the question. Oct 13, 2017 at 12:40

So finally, thanks to the help from Omar, I think I found the solution of the question.

You can see a little demonstration on YouTube here:

Arbitrary Scale Direction with Animation Nodes

and the node setup for Animation Nodes below:

Here is more solutions from Fábio Biff CG using Latice Modifier, Drivers, Animation Nodes and Sverchok.