I have two squares, S1 = (x1,y1,x2,y2) and S2 = (a1,b1,a2,b2)
I’m looking for the A transformation matrix with which
A * S1 = S2
As far as I see, A is an affine 3×3 matrix, so I have 9 unknown values.
How can I calculate these values?
thanks and best,
Viktor
A transformation matrix is a factor of scaling matrix Ss, transition matrix St and rotation matrix Sr.
Assume the old point is Po is (Xo,Yo) and as vector will be represented as (Xo Yo 1)’ same for the new point Pn
Then Pnv =SsStSrPov
Where Sx is
St is
Sr is
Now back to your question. if two point are giving to represent a rectangle we can just find the parameter of two matrix and the third one will be an identity matrix.
Rect1 is represented as Top-Left point P11 and Bottom-Right Point P12
Rect2 is represented as Top-Left point P21 and Bottom-Right Point P22
S=Ss*St
Now you have 4 missing parameters and 4 set of equations
Solve it and you’ll get your answer.
and if you have transition and rotation then
S=Sr*St.
Now you have 3 missing parameters and 4 set of equations
Replace Cos(th) with A and Sin(th) With B and solve the equations.
Check if its correct
A^2+B^2 =? 1if is true thenth = aCos(A)The last part of the solution, if you’ll have all three matrixes, then S=SrStSs is
Now we have 5 missing variables and we need 6 different set of equations to solve it. which is mean 3 points from each rectangle.