# [Interest] Applying transformation

Igor Mironchik igor.mironchik at gmail.com
Wed Apr 5 16:35:44 CEST 2017

```
05.04.2017 17:02, Sean Harmer пишет:
> On Wednesday 05 April 2017 16:30:52 Igor Mironchik wrote:
>> Hi,
>>
>> 05.04.2017 16:12, Sean Harmer пишет:
>>> On Wednesday 05 April 2017 15:55:48 Igor Mironchik wrote:
>>>> Hello,
>>>>
>>>> Can I apply Qt3DCore::QTransform to the QVector3D?
>>>>
>>>> How can I calculate new QVector3D if Qt3DCore::QTransform will be
>>>> applied to it, in other words?
>>> The transformation is stored in the matrix property. Pre-multiply your
>>> vector by the matrix to get the resulting transformed vector:
>>>
>>> v' = M v
>> Sorry for my question. But what the difference between M v and v M?
> We treat v as a column vector, so we pre-multiply by the matrix M.

Thank you. Understood.

787
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#_ZmlRK9QVector4DRK10QMatrix4x4>
*inline* QVector4D
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#QVector4D>
*operator**(/const/ QVector4D
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#QVector4D>&
vector, /const/ QMatrix4x4
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4>&
matrix)
788
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#788> 	{
789
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#789>
/float/ x, y, z, w;
790 	x
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19047x>
= vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.x
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1xEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[0][0]
+
791 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.y
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1yEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[0][1]
+
792 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.z
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1zEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[0][2]
+
793 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.w
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1wEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[0][3];

794 	y
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19048y>
= vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.x
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1xEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[1][0]
+
795 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.y
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1yEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[1][1]
+
796 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.z
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1zEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[1][2]
+
797 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.w
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1wEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[1][3];

798 	z
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19049z>
= vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.x
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1xEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[2][0]
+
799 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.y
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1yEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[2][1]
+
800 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.z
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1zEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[2][2]
+
801 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.w
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1wEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[2][3];

802 	w
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19050w>
= vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.x
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1xEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[3][0]
+
803 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.y
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1yEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[3][1]
+
804 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.z
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1zEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[3][2]
+
805 	vector
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19045vector>.w
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZNK9QVector4D1wEv>()
* matrix
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19046matrix>.m
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#QMatrix4x4::m>[3][3];

806 	*return* QVector4D
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#QVector4D>(
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qvector4d.h.html#_ZN9QVector4DC1Effff>x
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19047x>,
y
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19048y>,
z
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19049z>,
w
<https://code.woboq.org/qt5/qtbase/src/gui/math3d/qmatrix4x4.h.html#19050w>);

807 	}

But why it can be needed in 3D?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170405/3de38d80/attachment.html>
```