0

I have three non-colinear 3D points, let's say pt1, pt2, pt3. I've computed the plane P using the sympy.Plane. How can I find the orientation of this plane(P) i.e. RPY(euler angles) or in quaternion?

paul-shuvo
  • 1,874
  • 4
  • 33
  • 37
  • 2
    You can get the normal to the plane as `p.normal_vector`. The orientation as a quaternion or Euler angles is not uniquely defined though (the plane can be rotated into itself). – Oscar Benjamin Dec 31 '20 at 10:19

1 Answers1

0

I never used sympy, but you should be able to find a function to get the angle between 2 vectors (your normal vector and the world Y axis.)

theta = yaxis.angle_between(P.normal_vector)

then get the rotation axis, which is the normalized cross product of those same vectors.

axis = yaxis.cross(P.normal_vector).normal()

Then construct a quaternion from the axis and angle

q = Quaternion.from_axis_angle(axis, theta)
Julian Mann
  • 6,256
  • 5
  • 31
  • 43