       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

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} 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:= p = Table[Random[Real, {-1., 1.}], {3}, {3}]

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

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

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

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

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

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

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

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

But if we try
In:= 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[] -> d[] \[Cross] d[]
In:= d[] = d[] \[Cross] d[]
and also
In:= dP[] = dP[]\[Cross]dP[]
then
In:= RR = Transpose[dP].Inverse[Transpose[d]]

In:= R == RR
Out= 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.