using local translations to move to a point in global space

I have a figure that I need to slide to a point.  The problem is this figure slides in its local corsys.  So the point in world coordinates may be (4,-7) away but I need to slide the device (2,8) in its coordinates.  My question is how do I find that local translation?  All this is done in 4x4 matrices.  I guess it has to do with get the destination point into the devices coordinate system, which I am also not sure how to do.  Below is a diagram that might help
08   x
07  /
06  p
05   \
04    y
01                  X goal poin
  1 2 3 4 5 6 7 8 9 10 x

So you can see that in world all I need to do is slide p 8 in X and -5 in Y.  But I need to use p local coordinates and slide it in x or y.  So it should be something like 7 in y and 2 in x.  All the values I am working with are in 4x4 matrices.

Who is Participating?
JaccoConnect With a Mentor Commented:
Transformations are always reversible

If everything is right you have one matrix to convert from local coords to world coords [W]. (The inverse of the matrix converts back).

Seeing that you use 4x4 matrices means you are working in 3D right?

[ 1 0 0 tx ] [x]   [ x + tx ]
[ 0 1 0 ty ] [y] = [ y + ty ]
[ 0 0 1 tz ] [z]   [ z + tz ]
[ 0 0 0 1  ] [1]   [   1    ]

This is the translation matrix [T]

If you want to convert your local vars to world vars and then translate you can use

[M][T] [y]

(You understand how to multiply matrices?)

The other way around would be first translating the converting:


You can also multiply the matrixes and use the new matrix as the conversion from model to world.

Regards Jacco

What do you know about yhe relationship between world coordinates and device coordinates?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.