Aligning coordinate systems

c++, opengl, qt, transformation

Solution

The important piece of information is where is the second coordinate system's origin - namely `(a,b)`.

Once you know that, all you need is:

QPointF pos1; // original position
QTransform t;
t.scale(1, -1);
t.translate(a, -b+1);
QPointF pos2 = pos1 * t;

Problem

Let's say I have 2 coordinate systems as it is shown in image attached How can I align this coordinate systems? I know that I need to translate second coordinate system around X with 180 grads, and then translate it to (0, 0) of the first coordinate system, but I have some troubles with doing it getting wrong results. Will really appreciate any detailed answer. EDIT: Actually (0, 0) of second coordinate system is in the same point like Y of the first coordinate system.

Original source