How to map point from one csys (coordinate systems) to another csys

242 Views Asked by At

I have two $3$-dimensional coordinate system csys1, csys2. I have a known point in csys1 called $p_1(x,y,z)$. I want to define the same point with respect to csys2.(i.e. find a $p_1(x,y,z)$ with respect to csys2) This csys2 has some offset and angled with respect to csys1.i need common solution approach for angled as well as offset. Kindly anyone helps me out.

1

There are 1 best solutions below

0
On

I would suggest defining operations as $4\times4$ matrices on homogeneous coordinates:

$$\begin{pmatrix}x'\\y'\\z'\\1\end{pmatrix}= \begin{pmatrix}a&b&c&d\\e&f&g&h\\i&j&k&l\\0&0&0&1\end{pmatrix} \cdot\begin{pmatrix}x\\y\\z\\1\end{pmatrix}$$

This is the general shape of an affine transformation. If your transformation is a rigid motion, the matrix would satisfy additional requirements. But the nice thing about this representation is that you can combine elementary operations. So if you have a translation by $(s,t,u)$ followed by a rotation by angle $\varphi$ around the $x$ axis. You can write this as

$$ \begin{pmatrix}1&0&0&0\\0&\cos\varphi&-\sin\varphi&0\\ 0&\sin\varphi&\cos\varphi&0\\0&0&0&1\end{pmatrix}\cdot \begin{pmatrix}0&0&0&s\\0&0&0&t\\0&0&0&u\\0&0&0&1\end{pmatrix} $$

Remember the order: since you're multiplying the input from the right, the right of the two matrices gets applied first. If your overall transformation is defined in terms of a sequence of rotations and translations (and this is what I assume from reading your question), the above setup will help you combine all of these to form a single operation. It doesn't really matter whether you think about this in terms of transforming points to their images, or transforming coordinate systems instead while keeping the points fixed.