# LQuaterniond

from pandac.PandaModules import LQuaterniond

Filename: lquaternion_src.h Created by: frang (06Jun00)
PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ .
To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net .
Class : FLOATNAME(LQuaternion)
Description : This is the base quaternion class

## Inheritance:

LQuaterniond: LVecBase4d
LVecBase4d:

## Methods of LQuaterniond:

almostEqual
almostSameDirection
angleDeg
angleRad
conjugate
conjugateFrom
conjugateInPlace
extractToMatrix
getAngle
getAngleRad
getAxis
getAxisNormalized
getClassType
getForward
getHpr
getI
getJ
getK
getR
getRight
getUp
identQuat
invertFrom
invertInPlace
isAlmostIdentity
isIdentity
isSameDirection
multiply
normalize
operator *
operator *=
operator +
operator -
operator -
operator /
output
pureImaginary
setFromAxisAngle
setFromAxisAngleRad
setFromMatrix
setHpr
setI
setJ
setK
setR
xform

## Methods of LVecBase4d:

addHash
addToCell
addW
addX
addY
addZ
almostEqual
compareTo
dot
fill
fmax
fmin
getCell
getClassType
getData
getHash
getNumComponents
getW
getX
getY
getZ
isNan
operator !=
operator *
operator *=
operator +
operator +=
operator -
operator -
operator -=
operator /
operator /=
operator <
operator =
operator ==
operator []
operator delete
operator new
output
pythonRepr
set
setCell
setW
setX
setY
setZ
unitW
unitX
unitY
unitZ
validatePtr
zero

almostEqual bool LQuaterniond::almost_equal(LQuaterniond const &other) const; Description: Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type. Description: Returns true if two quaternions are memberwise equal within a specified tolerance.

almostSameDirection bool LQuaterniond::almost_same_direction(LQuaterniond const &other, double threshold) const; Description: Returns true if two quaternions represent the same rotation within a specified tolerance.

angleDeg double LQuaterniond::angle_deg(LQuaterniond const &other) const; Description: Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.

angleRad double LQuaterniond::angle_rad(LQuaterniond const &other) const; Description: Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.

conjugate LQuaterniond LQuaterniond::conjugate(void) const; Description: Returns the complex conjugate of this quat.

conjugateFrom bool LQuaterniond::conjugate_from(LQuaterniond const &other); Description: Computes the conjugate of the other quat, and stores the result in this quat. This is a fully general operation and makes no assumptions about the type of transform represented by the quat. The other quat must be a different object than this quat. However, if you need to get a conjugate of a quat in place, see conjugate_in_place. The return value is true if the quat was successfully inverted, false if there was a singularity.

conjugateInPlace bool LQuaterniond::conjugate_in_place(void); Description: Sets this to be the conjugate of the current quat. Returns true if the successful, false if the quat was singular.

extractToMatrix void LQuaterniond::extract_to_matrix(LMatrix3d &m) const; Description: Based on the quat lib from VRPN.

getAngle double LQuaterniond::get_angle(void) const; Description: This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the angle, in degrees counterclockwise about the axis. It is necessary to ensure the quaternion has been normalized (for instance, with a call to normalize()) before calling this method.

getAngleRad double LQuaterniond::get_angle_rad(void) const; Description: This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the angle, in radians counterclockwise about the axis. It is necessary to ensure the quaternion has been normalized (for instance, with a call to normalize()) before calling this method.

getAxis LVector3d LQuaterniond::get_axis(void) const; Description: This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the axis; it is not normalized.

getAxisNormalized LVector3d LQuaterniond::get_axis_normalized(void) const; Description: This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis. This returns the normalized axis.

getClassType static TypeHandle LQuaterniond::get_class_type(void); Undocumented function.

getForward LVector3d LQuaterniond::get_forward(CoordinateSystem cs = (CS_default)) const; Description: Returns the orientation represented by this quaternion, expressed as a forward vector.

getHpr LVecBase3d LQuaterniond::get_hpr(CoordinateSystem cs = (CS_default)) const; Description: Extracts the equivalent Euler angles from the unit quaternion.

getI double LQuaterniond::get_i(void) const; Description:

getJ double LQuaterniond::get_j(void) const; Description:

getK double LQuaterniond::get_k(void) const; Description:

getR double LQuaterniond::get_r(void) const; Description:

getRight LVector3d LQuaterniond::get_right(CoordinateSystem cs = (CS_default)) const; Description: Returns the orientation represented by this quaternion, expressed as a right vector.

getUp LVector3d LQuaterniond::get_up(CoordinateSystem cs = (CS_default)) const; Description: Returns the orientation represented by this quaternion, expressed as an up vector.

identQuat static LQuaterniond const &LQuaterniond::ident_quat(void); Description: Returns an identity quaternion.

invertFrom bool LQuaterniond::invert_from(LQuaterniond const &other); Description: Computes the inverse of the other quat, and stores the result in this quat. This is a fully general operation and makes no assumptions about the type of transform represented by the quat. The other quat must be a different object than this quat. However, if you need to invert a quat in place, see invert_in_place. The return value is true if the quat was successfully inverted, false if there was a singularity.

invertInPlace bool LQuaterniond::invert_in_place(void); Description: Inverts the current quat. Returns true if the inverse is successful, false if the quat was singular.

isAlmostIdentity bool LQuaterniond::is_almost_identity(double tolerance) const; Description: Returns true if this quaternion represents the identity transformation within a given tolerance.

isIdentity bool LQuaterniond::is_identity(void) const; Description: Returns true if this quaternion represents the identity transformation: no rotation.

isSameDirection bool LQuaterniond::is_same_direction(LQuaterniond const &other) const; Description: Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.

multiply LQuaterniond LQuaterniond::multiply(LQuaterniond const &rhs) const; Description: actual multiply call (non virtual)

normalize bool LQuaterniond::normalize(void); Description:

operator * LQuaterniond LQuaterniond::operator *(double scalar) const; Description: Description: Quat * Matrix = matrix

operator *= LQuaterniond &LQuaterniond::operator *=(LQuaterniond const &); Description:

operator + LQuaterniond LQuaterniond::operator +(LQuaterniond const &other) const; Description:

operator - LQuaterniond LQuaterniond::operator -(LQuaterniond const &other) const; Description:

operator - LQuaterniond LQuaterniond::operator -(LQuaterniond const &other) const; Description:

operator / LQuaterniond LQuaterniond::operator /(double scalar) const; Description:

output void LQuaterniond::output(ostream &) const; Description:

pureImaginary static LQuaterniond LQuaterniond::pure_imaginary(LVector3d const &); Description:

setFromAxisAngle void LQuaterniond::set_from_axis_angle(double angle_deg, LVector3d const &axis); Description: angle_deg is the angle about the axis in degrees. axis must be normalized.

setFromAxisAngleRad void LQuaterniond::set_from_axis_angle_rad(double angle_rad, LVector3d const &axis); Description: angle_rad is the angle about the axis in radians. axis must be normalized.

setFromMatrix void LQuaterniond::set_from_matrix(LMatrix3d const &m); Description: Description: Sets the quaternion according to the rotation represented by the matrix. Originally we tried an algorithm presented by Do-While Jones, but that turned out to be broken. This is based on the quat lib from UNC.

setHpr void LQuaterniond::set_hpr(LVecBase3d const &hpr, CoordinateSystem cs = (CS_default)); Description: Sets the quaternion as the unit quaternion that is equivalent to these Euler angles. (from Real-time Rendering, p.49)

setI void LQuaterniond::set_i(double i); Description:

setJ void LQuaterniond::set_j(double j); Description:

setK void LQuaterniond::set_k(double k); Description:

setR void LQuaterniond::set_r(double r); Description:

xform LVecBase3d LQuaterniond::xform(LVecBase3d const &v) const; Description: Transforms a 3-d vector by the indicated rotation Description: Transforms a 4-d vector by the indicated rotation

addHash unsigned int LVecBase4d::add_hash(unsigned int hash) const; Description: Adds the vector into the running hash.

addToCell void LVecBase4d::add_to_cell(int i, double value); These next functions add to an existing value. i.e. foo.set_x(foo.get_x() + value) These are useful to reduce overhead in scripting languages: Description:

addW void LVecBase4d::add_w(double value); Description:

addX void LVecBase4d::add_x(double value); These next functions add to an existing value. i.e. foo.set_x(foo.get_x() + value) These are useful to reduce overhead in scripting languages: Description:

addY void LVecBase4d::add_y(double value); Description:

addZ void LVecBase4d::add_z(double value); Description:

almostEqual bool LVecBase4d::almost_equal(LVecBase4d const &other, double threshold) const; Description: Returns true if two vectors are memberwise equal within a specified tolerance. Description: Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.

compareTo int LVecBase4d::compare_to(LVecBase4d const &other) const; Description: This flavor of compare_to uses a default threshold value based on the numeric type. Description: Sorts vectors lexicographically, componentwise. Returns a number less than 0 if this vector sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent (within the indicated tolerance).

dot double LVecBase4d::dot(LVecBase4d const &other) const; Description:

fill void LVecBase4d::fill(double fill_value); Description: Sets each element of the vector to the indicated fill_value. This is particularly useful for initializing to zero.

fmax LVecBase4d LVecBase4d::fmax(LVecBase4d const &other); Description:

fmin LVecBase4d LVecBase4d::fmin(LVecBase4d const &other); Description:

getCell double LVecBase4d::get_cell(int i) const; Description:

getClassType static TypeHandle LVecBase4d::get_class_type(void); Undocumented function.

getData double const *LVecBase4d::get_data(void) const; Description: Returns the address of the first of the four data elements in the vector. The remaining elements occupy the next positions consecutively in memory.

getHash unsigned int LVecBase4d::get_hash(void) const; Description: Returns a suitable hash for phash_map.

getNumComponents int LVecBase4d::get_num_components(void) const; Description: Returns the number of elements in the vector, four.

getW double LVecBase4d::get_w(void) const; Description:

getX double LVecBase4d::get_x(void) const; Description:

getY double LVecBase4d::get_y(void) const; Description:

getZ double LVecBase4d::get_z(void) const; Description:

isNan bool LVecBase4d::is_nan(void) const; Description: Returns true if any component of the vector is not-a-number, false otherwise.

operator != bool LVecBase4d::operator !=(LVecBase4d const &other) const; Description:

operator * LVecBase4d LVecBase4d::operator *(double scalar) const; Description:

operator *= void LVecBase4d::operator *=(double scalar); Description:

operator + LVecBase4d LVecBase4d::operator +(LVecBase4d const &other) const; Description:

operator += void LVecBase4d::operator +=(LVecBase4d const &other); Description:

operator - LVecBase4d LVecBase4d::operator -(LVecBase4d const &other) const; Description:

operator - LVecBase4d LVecBase4d::operator -(LVecBase4d const &other) const; Description:

operator -= void LVecBase4d::operator -=(LVecBase4d const &other); Description:

operator / LVecBase4d LVecBase4d::operator /(double scalar) const; Description:

operator /= void LVecBase4d::operator /=(double scalar); Description:

operator < bool LVecBase4d::operator <(LVecBase4d const &other) const; Description: This performs a lexicographical comparison. It's of questionable mathematical meaning, but sometimes has a practical purpose for sorting unique vectors, especially in an STL container. Also see compare_to().

operator = LVecBase4d &LVecBase4d::operator =(LVecBase4d const &copy); Description:

operator == bool LVecBase4d::operator ==(LVecBase4d const &other) const; Description:

operator [] double LVecBase4d::operator [](int i) const; Description:

operator delete void LVecBase4d::operator delete(void *ptr); Undocumented function.

operator new void *LVecBase4d::operator new(unsigned int size); Undocumented function.

output void LVecBase4d::output(ostream &out) const; Description:

pythonRepr void LVecBase4d::python_repr(ostream &out, string const &class_name) const; Description:

set void LVecBase4d::set(double x, double y, double z, double w); Description:

setCell void LVecBase4d::set_cell(int i, double value); Description:

setW void LVecBase4d::set_w(double value); Description:

setX void LVecBase4d::set_x(double value); Description:

setY void LVecBase4d::set_y(double value); Description:

setZ void LVecBase4d::set_z(double value); Description:

unitW static LVecBase4d const &LVecBase4d::unit_w(void); Description: Returns a unit W vector.

unitX static LVecBase4d const &LVecBase4d::unit_x(void); Description: Returns a unit X vector.

unitY static LVecBase4d const &LVecBase4d::unit_y(void); Description: Returns a unit Y vector.

unitZ static LVecBase4d const &LVecBase4d::unit_z(void); Description: Returns a unit Z vector.

validatePtr static bool LVecBase4d::validate_ptr(void const *ptr); Undocumented function.

zero static LVecBase4d const &LVecBase4d::zero(void); Description: Returns a zero-length vector.