Quaternion QML Type

Provides utility functions for quaternion. More...

Import Statement: import QtQuick3D
Since: Qt 5.15

Methods

  • quaternion fromAxesAndAngles(vector3d axis1, real angle1, vector3d axis2, real angle2, vector3d axis3, real angle3)
  • quaternion fromAxesAndAngles(vector3d axis1, real angle1, vector3d axis2, real angle2)
  • quaternion fromAxisAndAngle(real x, real y, real z, real angle)
  • quaternion fromAxisAndAngle(vector3d axis, real angle)
  • quaternion fromEulerAngles(real x, real y, real z)
  • quaternion fromEulerAngles(vector3d eulerAngles)
  • 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, vector3d axis3, real angle3)

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


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

Creates a quaternion from axis1, angle1, axis2, and angle2. 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 fromAxisAndAngle(vector3d axis, real angle)

Creates a quaternion from axis and angle. 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 fromEulerAngles(vector3d eulerAngles)

Creates a quaternion from eulerAngles. 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.