MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help with geometry problem required.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20827] Re: [mg20801] Help with geometry problem required.
  • From: "Wolf, Hartmut" <hwolf at debis.com>
  • Date: Wed, 17 Nov 1999 03:40:41 -0500 (EST)
  • Organization: debis Systemhaus
  • References: <199911142313.SAA02095@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Michael Ellis schrieb:
> 
> 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.
> 


Dear Michael,

Unless your three points are collinear your problem is equivalent to the
movement of a rigid body (the 3rd dimension is uniquely defined by the
normal to your oriented triangle).

A movement can be decomposed into a Translation and a Rotation (with a
fixed point). Perhaps it is convenient to choose as that fixed point one
of your corners, point 1 say. Then the movement can be described as

	A - P1 = R . (a - p1),   where P1 = p1 + t

R is a 3-dim orthogonal transformation (which you can describe by a 3 x
3 matrix) and t = P1 - p1 is the translation vector. If we keep our
fixed point in mind, we may describe our movement as {t, R}

To make two movements in succession is equivalent to a single movement:

	{t, R} = {t2, R2} ? {t1, R1} = {t2 + R2.t1, R2.R1}

While the identity is {0, IdentityMatrix[3]} the inverse is 

	      -1      -1     -1
	{t, R}   = {-R  .t, R  }

(This kind of composition is called a semidirect product.) You can
transform this calculus into 4 x 4 matrix form if you define

	           ( R  |  t )             ( v - p1 )
	movement = (----+----)    and v -> (        )  for a vector
	           ( 0  |  1 )             (   1    )

or in Mathematica-terms movement = {{R,t},{{0,0,0}, 1}}, and v -> {v -
p1, 1}

The multiplication rule above then translates to matrix-multiplication
and the movement just to matrix application to the transformed vector
(don't forget p1 when going back to ordinary 3-dim representation). 

The question remains how to get that (3 x 3) rotation matrix R from the
(transformed and original) points?

Let's reach for some Test Data:

We generate three points
In[1]:= p = Table[Random[Real, {-1., 1.}], {3}, {3}]

so p[[1]] stands for p1 etc.
We choose p[[1]] as fixed point (for the rotation), such we define the
differences

In[2]:= d = Table[ p[[i]] - p[[1]], {i, 3}]

To define the moved triangle
(1) the translation
In[3]:= t = Table[Random[Real, {-10., 10.}], {3}]

(2) for the rotation we use some Eulerian angles
In[4]:= << Geometry`Rotations`
In[5]:= theta = Random[Real, {0., \[Pi]}]
In[6]:= phi = Random[Real, {0., 2\[Pi]}]
In[7]:= psi = Random[Real, {0., 2\[Pi]}]
In[8]:= R = RotationMatrix3D[psi, theta, phi]

The transformed (test) points are now
In[9]:= P = Transpose[p[[1]] + t + R.Transpose[d]]

(We had to apply Transpose to get all three points with one stroke,
compare:
In[10]:= P[[3]] == p[[1]] + t + R.d[[3]]
Out[10]= True
)
>>> now we (Re)gain the Transformation from the Points:

We also define the differences for the transformed points
In[11]:= dP = Table[P[[i]] - P[[1]], {i, 3}]

and we now look for the transformation RR which satisfies  dP[[i]] =
RR.d[[i]]
(Of course we had
In[12]:= Table[dP[[i]] == R.d[[i]], {i, 3}]
Out[12]= {True, True, True}
)
or equivalently Transpose[dP]= R.Transpose[d]
In[13]:= Transpose[dP] == R.Transpose[d]
Out[13]= True

But if we try 
In[14]:= RR = Transpose[dP].Inverse[Transpose[d]]
Inverse::"sing": "Matrix \!\({\(\({0.`, \(\(-0.9025355260040435`\)\), \
\(\(-0.26252742014189345`\)\)}\)\), \(\(\[LeftSkeleton] 2 \
\[RightSkeleton]\)\)}\) is singular."

of course! we need a 3-dim object (i.e. something not linearly
dependend)

We get it if we substitute d[[1]] -> d[[2]] \[Cross] d[[3]] 
In[15]:= d[[1]] = d[[2]] \[Cross] d[[3]]
and also
In[16]:= dP[[1]] = dP[[2]]\[Cross]dP[[3]]
then
In[17]:= RR = Transpose[dP].Inverse[Transpose[d]]

In[18]:= R == RR
Out[18]= True

Kind regards, Hartmut



  • Prev by Date: Re: Help with geometry problem required.
  • Next by Date: Re: Simultaneous Forward and Reverse Polynomial Fits ?
  • Previous by thread: Help with geometry problem required.
  • Next by thread: Re:Help with geometry problem required.