Re: [Interest] Plane rotations
The following is equivalent to your equation: float cosAngle = QVector3D::dotProduct(v1.normalized(), v2.normalized()); Your numerator is the dot product and the denominator does the normalization (makes them unit vectors). On Wed, Apr 5, 2017 at 7:50 AM, Igor Mironchikwrote: > Hi, > > > 05.04.2017 15:13, Sean Harmer пишет: > >> Yes, just use the dot product. >> > > You want to say, that QVector3D::dotProduct() will give me an angle? > > >> Sean >> >> On Wednesday 05 April 2017 14:59:48 Igor Mironchik wrote: >> >>> Hi, >>> >>> I Googled it and found: >>> >>> The cos of angle between vectors is: >>> |(ax*bx + ay*by + az*bz) >>> >>> sqrt(ax*ax + >>> ay*ay + az*az) * sqrt(bx*bx + by*by + bz*bz)| >>> >>> 05.04.2017 14:52, Igor Mironchik пишет: >>> 05.04.2017 14:45, Igor Mironchik пишет: > Hi, > > 05.04.2017 14:29, Paolo Angelelli пишет: > >> Just cross N and M to get the vector around which to rotate. >> >> Then use a QQuaternion to set the rotation in the >> Qt3DCore::QTransform, >> and construct it with fromAxisAndAngle(const QVector3D , float >> angle) >> > Ok, I can rotate around the right axis. But what angle should I rotate? > This is my question. And how can I calculate new normal to the rotated plane? > I already know it... I just need to know what angle should I rotate. On Wed, 5 Apr 2017 14:18:56 +0300 >> >> Igor Mironchik wrote: >> >>> Hello, >>> >>> Let's say I have two vectors - N (normal vector to plane P1) and M >>> (normal vector to plane P2). >>> >>> How to calculate x, y, z axis rotations angles for plane P2 to make >>> plane P2 parallel to P1? >>> >>> How to calculate x, y, z axis rotations angles for plane P2 to >>> rotate it >>> around vector N? >>> >>> Thank you. >>> >>> And what is the measurement of angle in rotationX() of >>> Qt3DCore::QTransform? >>> >>> I need to calculate angles in this units. >>> >>> ___ >>> Interest mailing list >>> Interest@qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/interest >>> >> ___ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest >> > > ___ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Plane rotations
Hi, 05.04.2017 15:13, Sean Harmer пишет: Yes, just use the dot product. You want to say, that QVector3D::dotProduct() will give me an angle? Sean On Wednesday 05 April 2017 14:59:48 Igor Mironchik wrote: Hi, I Googled it and found: The cos of angle between vectors is: |(ax*bx + ay*by + az*bz) sqrt(ax*ax + ay*ay + az*az) * sqrt(bx*bx + by*by + bz*bz)| 05.04.2017 14:52, Igor Mironchik пишет: 05.04.2017 14:45, Igor Mironchik пишет: Hi, 05.04.2017 14:29, Paolo Angelelli пишет: Just cross N and M to get the vector around which to rotate. Then use a QQuaternion to set the rotation in the Qt3DCore::QTransform, and construct it with fromAxisAndAngle(const QVector3D , float angle) Ok, I can rotate around the right axis. But what angle should I rotate? This is my question. And how can I calculate new normal to the rotated plane? I already know it... I just need to know what angle should I rotate. On Wed, 5 Apr 2017 14:18:56 +0300 Igor Mironchikwrote: Hello, Let's say I have two vectors - N (normal vector to plane P1) and M (normal vector to plane P2). How to calculate x, y, z axis rotations angles for plane P2 to make plane P2 parallel to P1? How to calculate x, y, z axis rotations angles for plane P2 to rotate it around vector N? Thank you. And what is the measurement of angle in rotationX() of Qt3DCore::QTransform? I need to calculate angles in this units. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Plane rotations
Yes, just use the dot product. Sean On Wednesday 05 April 2017 14:59:48 Igor Mironchik wrote: > Hi, > > I Googled it and found: > > The cos of angle between vectors is: > |(ax*bx + ay*by + az*bz) > > sqrt(ax*ax + > ay*ay + az*az) * sqrt(bx*bx + by*by + bz*bz)| > > 05.04.2017 14:52, Igor Mironchik пишет: > > 05.04.2017 14:45, Igor Mironchik пишет: > >> Hi, > >> > >> 05.04.2017 14:29, Paolo Angelelli пишет: > >>> Just cross N and M to get the vector around which to rotate. > >>> > >>> Then use a QQuaternion to set the rotation in the Qt3DCore::QTransform, > >>> and construct it with fromAxisAndAngle(const QVector3D , float > >>> angle) > >> > >> Ok, I can rotate around the right axis. But what angle should I rotate? > > > > This is my question. > > > >> And how can I calculate new normal to the rotated plane? > > > > I already know it... > > > > I just need to know what angle should I rotate. > > > >>> On Wed, 5 Apr 2017 14:18:56 +0300 > >>> > >>> Igor Mironchikwrote: > Hello, > > Let's say I have two vectors - N (normal vector to plane P1) and M > (normal vector to plane P2). > > How to calculate x, y, z axis rotations angles for plane P2 to make > plane P2 parallel to P1? > > How to calculate x, y, z axis rotations angles for plane P2 to > rotate it > around vector N? > > Thank you. > > And what is the measurement of angle in rotationX() of > Qt3DCore::QTransform? > > I need to calculate angles in this units. > > ___ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > >>> > >>> ___ > >>> Interest mailing list > >>> Interest@qt-project.org > >>> http://lists.qt-project.org/mailman/listinfo/interest -- Dr Sean Harmer | sean.har...@kdab.com | Managing Director UK KDAB (UK) Ltd, a KDAB Group company Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090 Mobile: +44 (0)7545 140604 KDAB - Qt Experts ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Plane rotations
Hi, I Googled it and found: The cos of angle between vectors is: |(ax*bx + ay*by + az*bz) sqrt(ax*ax + ay*ay + az*az) * sqrt(bx*bx + by*by + bz*bz)| 05.04.2017 14:52, Igor Mironchik пишет: 05.04.2017 14:45, Igor Mironchik пишет: Hi, 05.04.2017 14:29, Paolo Angelelli пишет: Just cross N and M to get the vector around which to rotate. Then use a QQuaternion to set the rotation in the Qt3DCore::QTransform, and construct it with fromAxisAndAngle(const QVector3D , float angle) Ok, I can rotate around the right axis. But what angle should I rotate? This is my question. And how can I calculate new normal to the rotated plane? I already know it... I just need to know what angle should I rotate. On Wed, 5 Apr 2017 14:18:56 +0300 Igor Mironchikwrote: Hello, Let's say I have two vectors - N (normal vector to plane P1) and M (normal vector to plane P2). How to calculate x, y, z axis rotations angles for plane P2 to make plane P2 parallel to P1? How to calculate x, y, z axis rotations angles for plane P2 to rotate it around vector N? Thank you. And what is the measurement of angle in rotationX() of Qt3DCore::QTransform? I need to calculate angles in this units. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Plane rotations
05.04.2017 14:45, Igor Mironchik пишет: Hi, 05.04.2017 14:29, Paolo Angelelli пишет: Just cross N and M to get the vector around which to rotate. Then use a QQuaternion to set the rotation in the Qt3DCore::QTransform, and construct it with fromAxisAndAngle(const QVector3D , float angle) Ok, I can rotate around the right axis. But what angle should I rotate? This is my question. And how can I calculate new normal to the rotated plane? I already know it... I just need to know what angle should I rotate. On Wed, 5 Apr 2017 14:18:56 +0300 Igor Mironchikwrote: Hello, Let's say I have two vectors - N (normal vector to plane P1) and M (normal vector to plane P2). How to calculate x, y, z axis rotations angles for plane P2 to make plane P2 parallel to P1? How to calculate x, y, z axis rotations angles for plane P2 to rotate it around vector N? Thank you. And what is the measurement of angle in rotationX() of Qt3DCore::QTransform? I need to calculate angles in this units. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Plane rotations
Hi, 05.04.2017 14:29, Paolo Angelelli пишет: Just cross N and M to get the vector around which to rotate. Then use a QQuaternion to set the rotation in the Qt3DCore::QTransform, and construct it with fromAxisAndAngle(const QVector3D , float angle) Ok, I can rotate around the right axis. But what angle should I rotate? And how can I calculate new normal to the rotated plane? On Wed, 5 Apr 2017 14:18:56 +0300 Igor Mironchikwrote: Hello, Let's say I have two vectors - N (normal vector to plane P1) and M (normal vector to plane P2). How to calculate x, y, z axis rotations angles for plane P2 to make plane P2 parallel to P1? How to calculate x, y, z axis rotations angles for plane P2 to rotate it around vector N? Thank you. And what is the measurement of angle in rotationX() of Qt3DCore::QTransform? I need to calculate angles in this units. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Plane rotations
Just cross N and M to get the vector around which to rotate. Then use a QQuaternion to set the rotation in the Qt3DCore::QTransform, and construct it with fromAxisAndAngle(const QVector3D , float angle) On Wed, 5 Apr 2017 14:18:56 +0300 Igor Mironchikwrote: > Hello, > > Let's say I have two vectors - N (normal vector to plane P1) and M > (normal vector to plane P2). > > How to calculate x, y, z axis rotations angles for plane P2 to make > plane P2 parallel to P1? > > How to calculate x, y, z axis rotations angles for plane P2 to rotate it > around vector N? > > Thank you. > > And what is the measurement of angle in rotationX() of Qt3DCore::QTransform? > > I need to calculate angles in this units. > > ___ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest