translate and rotate coordinates

I have two dataset with Cartesian data points. I would like to uniformly translate the coordinates of one dataset to be properly rotated and on top of the other (having a certain max and min for all the dimensions) but maintaining the integrity spacing of the elements in the moved data set. I know this is very simple, Can someone give me the formula? For instance

old set

1, 0.000 0.000 0.000

2, 1.458 0.000 0.000

...

9572, 16.646 -3.778 19.771

new dataset

1, 148.612 -24.810 67.566

2, 148.618 -25.469 68.866

...

9572, 130.160 -25.318 86.045

Thank you

Here is a link to what I want to do only with three dimensions. http://i47.tinypic.com/2gxofms.png

-
What does "properly rotated" mean? – Ben Millwood Sep 17 '12 at 22:45
@BenMillwood my two datasets are a plot of a cup and something that fits in the cup...properly rotated means fitting in the cup – user31230 Sep 17 '12 at 22:47

1 Answer

Once you have decided on the parameters of your rotation, the matrix multiplication is given in Wikipedia's Rotation Matrix article under "In three dimensions". For the translation, just add the desired amount to each coordinate. Determining what translation and rotation is required is not simple. You might search under "image registration" for some ideas.

-
Thanks for the answer but I dont know the proper angle of the rotation...so the formula from wikipedia’s rotation matrix doesn’t help. All i know is it should start at around one 3d point and end around another 3d point. I need something more concrete. – user31230 Sep 17 '12 at 23:16
@caseyr547: one can't give a formula until there is enough information to make it unique. In your cup example, it would be nice to find the plane that is the upper surface of the cup and the plane that is the upper surface of the liquid. Then we could rotate to make the planes parallel and make the furthest points be the same distance from one of the planes so the bottom of the liquid is in the bottom of the cup. Picking the correct points out of the two data sets to be the plane doesn't seem easy to me, though. – Ross Millikan Sep 17 '12 at 23:20
i drew a 2d picture of what i want to do and posted it to a link in the question. i understand your explanation but I still don't understand how to implement your suggested solution. – user31230 Sep 17 '12 at 23:29