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