Quaternion QML Type

Provides utility functions for quaternion. More...

Import Statement: import QtQuick3D

Methods

  • quaternion fromAxesAndAngles(vector3d axis1, real angle1, vector3d axis2, real angle2)
  • quaternion fromAxesAndAngles(vector3d axis1, real angle1, vector3d axis2, real angle2, vector3d axis3, real angle3)
  • quaternion fromAxisAndAngle(vector3d axis, real angle)
  • quaternion fromAxisAndAngle(real x, real y, real z, real angle)
  • quaternion fromEulerAngles(vector3d eulerAngles)
  • quaternion fromEulerAngles(real x, real y, real z)
  • quaternion lookAt(vector3d sourcePosition, vector3d targetPosition, vector3d forwardDirection, vector3d upDirection)

Detailed Description

The Quaternion is a global object with utility functions.

It is not instantiable; to use it, call the members of the global Quaternion object directly. For example:

Node {
    rotation: Quaternion.fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
}

Method Documentation

quaternion fromAxesAndAngles(vector3d axis1, real angle1, vector3d axis2, real angle2)

Creates a quaternion from axis1, angle1, axis2, and angle2. Returns the resulting quaternion.


quaternion fromAxesAndAngles(vector3d axis1, real angle1, vector3d axis2, real angle2, vector3d axis3, real angle3)

Creates a quaternion from axis1, angle1, axis2, angle2, axis3, and angle3. Returns the resulting quaternion.


quaternion fromAxisAndAngle(vector3d axis, real angle)

Creates a quaternion from axis and angle. Returns the resulting quaternion.


quaternion fromAxisAndAngle(real x, real y, real z, real angle)

Creates a quaternion from x, y, z, and angle. Returns the resulting quaternion.


quaternion fromEulerAngles(vector3d eulerAngles)

Creates a quaternion from eulerAngles. Returns the resulting quaternion.


quaternion fromEulerAngles(real x, real y, real z)

Creates a quaternion from x, y, and z. Returns the resulting quaternion.


quaternion lookAt(vector3d sourcePosition, vector3d targetPosition, vector3d forwardDirection, vector3d upDirection)

Creates a quaternion from sourcePosition, targetPosition, forwardDirection, and upDirection. This is used for getting a rotation value for pointing at a particular target, and can be used to point a camera at a position in a scene.

forwardDirection defaults to Qt.vector3d(0, 0, -1) upDirection defaults to Qt.vector3d(0, 1, 0)

Returns the resulting quaternion.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.