问题描述
假设我有两个坐标系,如图所示
如何对齐这个坐标系?我知道我需要翻译第二个坐标系围绕X与180度,然后将其翻译为(0,0)的第一个坐标系,但我有一些麻烦,得到错误的结果。将真正感谢任何详细的答案。
编辑:第二个坐标系的实际(0,0)与第一个坐标系的Y一样。
(a,b)。 / p>一旦你知道了,你所需要的是:
QPointF pos1 ; // original position
QTransform t;
t.scale(1,-1);
t.translate(a,-b + 1);
QPointF pos2 = pos1 * t;
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.
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;
这篇关于对齐坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!