2 years ago
#62414
dycina
Best method to fit hyperplane using a rotation around a common vector?
so I was curious about the best method to fit two hyperplanes with each other using a vector.
Let's say I have a plane pl1 composed of the points pa1, pb1 and pc1, while the plane pl2 is made using the points pa2, pb2 and pc2. I can get the rotations between the vectors made from the points (pa1, pb1) and (pa2, pb2) using Eigen. pa1 and pa2 are at coordinates (0,0,0).
const ::Eigen::Vector3d v1 = ((::Eigen::Vector3d) (pb1 - pa1)).normalized();
const ::Eigen::Vector3d v2 = ((::Eigen::Vector3d) (pb2 - pa2)).normalized();
::Eigen::Matrix3d rot1;
rot1 = ::Eigen::Quaterniond().setFromTwoVectors(v2, v1).toRotationMatrix();
const ::Eigen::Matrix4d t1 = ::Eigen::Affine3d(rot1).matrix();
And then, I want to rotate around v1 to register the planes. What would be the best way to find the angle alpha where the planes are on each other?
Once I get this angle, I can find the final transformation using:
::Eigen::Matrix4d t2 = ::Eigen::Affine3d(::Eigen::AngleAxisd(alpha, v1)).matrix();
::Eigen::Matrix4d t3 = t2 * t1;
But I'm stuck with the middle part, is there maybe an Eigen function to do that? :)
c++
vector
eigen
registration
plane
0 Answers
Your Answer