rotate a mesh in python to be parallel to a vector
I don't know that library, but maybe you could try to rotate your objects throughout Affine2D() class, of Matplotlib.
Specifically, try with this function:
mtransforms.Affine2D().rotate()
First, you will have to import it: matplotlib.transforms as mtransforms
I have two meshes (call them A and B) which I am interacting within python using the open3d library (happy to use import trimesh or something else if it works better). Mesh A is a curved structure and mesh B approximates to a flatter surface.
I need to rotate the meshes so that the surface I am interested in is facing the camera.
To identify the surfaces that I need I have written functions to turn the meshes into point clouds and create the best fit sphere for mesh A and a best-fit plane for mesh B. These work really well and match the objects nicely.
I need to rotate the meshes and have gotten stuck with how to perform the rotation.
The input data that I have:
for mesh A:
centroid of mesh A coords and coords of its best fit sphere (+ its radius) - I want to rotate the mesh so that is perpendicular to the vector described by the above data?
for mesh B:
centroid of mesh B coords and vector of the normal of the best fit plane - I want to rotate the mesh so that is perpendicular to the vector described by the above data