To set the corresponding points that you are trying to match (with a possible perturbation), I used SVD (decomposition of singular values), which seems to exist in numpy.
An example of this technique (in Python even) can be found here , but I did not rate it for correctness.
What you are going to use is a “base transformation” or “base change”, which will be represented as a transformation matrix. Assuming your 3 known points are not collinear, you can create your initial base:
- Calculation of vectors: x = (ba) and y = (ca)
- Normalize x (x = x / value (x))
- Project y on x (proj_y = x DOT y * x)
- Subtract the projection from y (y = y - proj_y)
- Normalize y
- Calculate z = x CROSS y
This gives you the starting coordinate x, y, z A. Do the same for your new points, and you get the second base B. Now you want to find the transformation T, which will take the point in and convert it to B (change of base). This part is simple. You can invert A to convert points back to a normal basis, and then use B to convert to the second. Since A is orthonormalized, you can simply transpose A to get the opposite. Thus, the “new d” is equal to d * inverse (A) * B. (Although depending on your view, you may need to use B * inverse (A) * d.)
You need to have some familiarity with matrices in order to get all this. Your presentation of vectors and matrices will inform you of the order in which the matrices are multiplied to get T (T is either the inverse (A) * B or B * the inverse (A)).
To calculate the base matrix from your vectors x = (x1, x2, x3), y = (y1, y2, y3), z = (z1, z2, z3), you fill it as:
| x1 y1 z1 | | x2 y2 z2 | | x3 y3 z3 |
Mark ping
source share