Re: Help with geometry problem required.
- To: mathgroup at smc.vnet.net
- Subject: [mg20826] Re: [mg20801] Help with geometry problem required.
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Wed, 17 Nov 1999 03:40:40 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I am not quite sure if I have understood you correctly. In particular, I don't understand why you take your points in 4 dimensions if their last coordinate is the same and your problem clearly concerns motion in R^3. it seems to me that you can drop all those 1's and change your matrix to a 3X3 one (?) In general knowing what happens to only three points does not determine an affine transformation of R^3 but it does so if you know that the affine transofrmation is a composite of a reflection and a translation. Any transformation in R^3 of the kind you describe has the form v -> M.v+T where T is a vector and M is a special orthogonal matrix (meaning that M.Transpose[M] is the indentity matrix and Det[M]==1). You can quickly produce a "general" special orthogonal matrix by using the RotationMatrix3D function in the Geometry`Rotations` package: In[1]:= << Geometry`Rotations` In[2]:= M = RotationMatrix3D[a, b, c] Out[2]= {{Cos[a] Cos[c] - Cos[b] Sin[a] Sin[c], Cos[c] Sin[a] + Cos[a] Cos[b] Sin[c], Sin[b] Sin[c]}, {-Cos[b] Cos[c] Sin[a] - Cos[a] Sin[c], Cos[a] Cos[b] Cos[c] - Sin[a] Sin[c], Cos[c] Sin[b]}, {Sin[a] Sin[b], -Cos[a] Sin[b], Cos[b]}} In[4]:= Det[M] // Simplify Out[4]= 1 In[5]:= M.Transpose[M] // Simplify // MatrixForm Out[5]//MatrixForm= 1 0 0 0 1 0 0 0 1 The matrix M and the vector T={t1,t2,t3} both depend on three parameters. So in principle you should be able to solve the equations: M.p1+T==P1,M.p2+T==P2,M.p3+T==P3 for a,b,c,t1,t2,t3. Actually, you only need to use two of these to find all six unknowns (each equation is really three, one for each coordinate). However, since the matrix M is expressed in terms of sines and cosines of Euler angles and Mathematica's Solve does not deal very well with such cases you may do better if you use the following approach: a /: Cos[a] = (1 - t^2)/(1 + t^2); a /: Sin[a] = (2t)/(1 + t^2); b /: Cos[b] = (1 - s^2)/(1 + s^2); b /: Sin[b] = (2s)/(1 + s^2); c /: Cos[c] = (1 - u^2)/(1 + u^2); c /: Sin[c] = (2u)/(1 + u^2); and then then solve the equations for t,s,u instead of a,b,c. (Note that you can sometimes loose some solutions in this way corresponding to the values of a,b, and c when t, s, u are Infinity). I hope I have not misunderstood your problem and this message proves to be of some use. -- Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp -- > From: Michael Ellis <michael at digsci.demon.co.uk> To: mathgroup at smc.vnet.net > Organization: Digital Scientific > Date: Sun, 14 Nov 1999 18:13:51 -0500 (EST) > To: mathgroup at smc.vnet.net > Subject: [mg20826] [mg20801] Help with geometry problem required. > > I am new to this news group so please forgive me if this is an > inappropriate posting. > > My Problem: > I have three points marked on a piece of rigid card at positions p1, p2 > and p3. The card is moved, by translation and or rotation, but not > otherwise distorted to a new location. The three points p1, p2 and p3 > are now at new positions say P1, P2 and P3. My question: Is there a 4 by > 4 Transform M that uniquely describes this relocation and if so how can > I derive M given p1, p2, p3, P1, P2 and P3. > > My first and naive attempt was as follows: > -------------- > p1 = {x1, y1, z1, 1}; > p2 = {x2, y2, z2, 1}; > p3 = {x3, y3, z3, 1}; > > P1 = {X1, Y1, Z1, 1}; > P2 = {X2, Y2, Z2, 1}; > P3 = {X3, Y3, Z3, 1}; > > M = {{a, b, c, d}, {e, f, g, h}, {i, j, k, l}, {0, 0, 0, 1}}; > > DistanceSq[{x1_, y1_, z1_, 1}, {x2_, y2_, z2_, 1}] := > (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2; > > Simplify[ > Solve[ > {M.p1 == P1, M.p2 == P2, M.p3 == P3, > DistanceSq[p1, p2] == DistanceSq[P1, P2], > DistanceSq[p1, p3] == DistanceSq[P1, P3], > DistanceSq[p3, p2] == DistanceSq[P3, P2]}, > {a, b, c, d, e, f, g, h, i, j, k, l}] > ] > ------------------------ > This yields: "Equations may not give solutions for all \"solve\" > variables." > > I have used the fact that the distance between the three points remains > unchanged during the relocation. I suspect that there are some other > constraints that I could be using given that M is restricted to rotation > and translation only. > > Any help very greatly received. > > Michael Ellis - Technical Director - Digital Scientific Ltd. UK > > Please copy any replies to my email: michael at digsci.demon.co.uk > > > > > >