osg.Quat

class osg.Quat
Represents

c++ class

Wraps

osg::Quat

A quaternion class. It can be used to represent an orientation in 3D space. There a numbers a getters/setters to control values of each quaternion’s components (e.g. getter osg.Quat.y() and setter with the same name with value to set etc.).

Constructors:

osg.Quat()

osg.Quat(osg.Quat other)

Параметры

other (osg.Quat) –

osg.Quat(double x, double y, double z, double w)

Параметры
  • x (double) –

  • y (double) –

  • z (double) –

  • w (double) –

osg.Quat(double angle, osg.Vec3 axis)

Параметры
  • angle (double) –

  • axis (osg.Vec3) –

osg.Quat(double angle1, osg.Vec3 axis1, double angle2, osg.Vec3 axis2, double angle3, osg.Vec3 axis3)

Параметры
  • angle1 (double) –

  • axis1 (osg.Vec3) –

  • angle2 (double) –

  • axis2 (osg.Vec3) –

  • angle3 (double) –

  • axis3 (osg.Vec3) –

Methods:

:x()

Тип результата

double

:x(double x)

Параметры

x (double) –

:y()

Тип результата

double

:y(double y)

Параметры

y (double) –

:z()

Тип результата

double

:z(double z)

Параметры

z (double) –

:w()

Тип результата

double

:w(double w)

Параметры

w (double) –

:set(double x, double y, double z, double w)

Параметры
  • x (double) –

  • y (double) –

  • z (double) –

  • w (double) –

:set(osg.Vec4 v)

Параметры

v (osg.Vec4) –

:set(osg.Matrix m)

Параметры

m (osg.Matrix) –

:get()

Тип результата

osg.Matrix

:getRotate()

Helper function. Return 2 values: angle as number (double) and axis as osg.Vec3.

:getRotate(double angle, double x, double y, double z)

Return the angle and vector components represented by the quaternion.

Параметры
  • angle (double) –

  • x (double) –

  • y (double) –

  • z (double) –

:getRotate(double angle, osg.Vec3 axis)

Return the angle and vector represented by the quaternion.

Параметры
  • angle (double) –

  • axis (osg.Vec3) –

:zeroRotation()

Return true if the osg.Quat represents a zero rotation, and therefore can be ignored in computations.

Тип результата

bool

:slerp(double t, osg.Quat q1, osg.Quat q2)

Spherical Linear Interpolation.

Параметры
:length()

Length of the quaternion = sqrt( vec . vec ).

Тип результата

double

:length2()

Length of the quaternion = vec . vec.

Тип результата

double

:rotate(osg.Vec3 vec)

Параметры

vec (osg.Vec3) –

Тип результата

osg.Vec3

:conj()

Conjugate.

Тип результата

osg.Quat

:inverse()

Multiplicative inverse method: q^(-1) = q^*/(q.q^*).

Тип результата

osg.Quat

:makeRotate(double angle, double x, double y, double z)

Set a quaternion which will perform a rotation of an angle around the axis given by the vector with x, y and z components.

Параметры
  • angle (double) –

  • x (double) –

  • y (double) –

  • z (double) –

:makeRotate(double angle, osg.Vec3 axis)

Set a quaternion which will perform a rotation of an angle around the axis given by the vector.

Параметры
  • angle (double) –

  • axis (osg.Vec3) –

:makeRotate(double angle1, osg.Vec3 axis1, double angle2, osg.Vec3 axis2, double angle3, osg.Vec3 axis3)

Параметры
  • angle1 (double) –

  • axis1 (osg.Vec3) –

  • angle2 (double) –

  • axis2 (osg.Vec3) –

  • angle3 (double) –

  • axis3 (osg.Vec3) –

:makeRotate(osg.Vec3 vec1, osg.Vec3 vec2)

Make a rotation osg.Quat which will rotate vec1 to vec2. Generally take a dot product to get the angle between these and then use a cross product to get the rotation axis Watch out for the two special cases when the vectors are co-incident or opposite in direction.

Параметры
:makeRotate_original(osg.Vec3 vec1, osg.Vec3 vec2)

Параметры