Convert a normal vector to object rotation

I’d like to align an object with the normal of another object face.

So, I succeeded to get the normal I want to align my object with, but how can I convert the normal vector value to a rotation euler or a matrix?

Thank you! :slight_smile:

Basically, you need to calculate xyz vectors representing the face you want to align with. You have Z, as normal. You need to pick 2 points to calculate X, then you can calculate Y as cross product of X and Z.

Then according to the math in the link I’ve posted, you calculate the rotation matrix, that needs to be applied to translate your object to the local xyz of the face.

In my case I’ve alinged mesh to selection of faces, and it worked perfectly.

sverchok has default nodes for this - output matrices that you can assign to object.
http://nikitron.cc.ua/sverch/Sverchok_basics.blend.7z basics has one
http://nikitron.cc.ua/Sverchok_man_08.html there is adaptive polygons, coauthor Alessandro Zomparelli (sketchesofcode)