Reputation: 405
I have an array of 3D paired points in two different coordinate spaces (A and B).
Given points are not coplanar, how do I compute a non-affine transformation matrix which is able to transform a point from A into B?
I have managed to do this in 2D (using a homography), but can't work out how to make it work in 3D. A quick code example would be much appreciated if possible. :)
Upvotes: 1
Views: 1456
Reputation: 60908
The approach described in this post will generalize to three dimensions: If you know the coordinates of five points in both coordinate systems, then you can use them to compute a 4×4 projective transformation matrix for this, which will be unique except for a scale factor which is without geometric relevance.
I've included variations of the required code for 2D in various posts, written for sage, and there is also the JavaScript example mentioned along with the description. Any of these could be adapted to the 3D case, but if you also want to change programming language, then you might be better off implementing the formula directly, keeping in mind that the adjoint may serve as alternative for the inverse of a matrix in several locations.
Here are some details on the generalization to 3D:
Upvotes: 3