I am actually trying to get rotation(x,y,z) with 3 points in Python. I think converting from Cartesian (x,y,z) to Spherical is the best way to solve it. However, I do not know how to calculate with 3 points.
import numpy as np
#3 vertex points
p1=[x1,y1,z1]
p2=[x2,y2,z2]
p3=[x3,y3,z3]
def cart2sph(x,y,z): #Converting from Cartesian to Spherical
X_Y = x**2 + y**2
r = m.sqrt(X_Y + z**2)
v = m.atan2(m.sqrt(X_Y),z)
z = m.atan2(y,x)
return r,z ,v