Panda3D
Public Member Functions | Static Public Member Functions

LOrientationd Class Reference

This is a unit quaternion representing an orientation. More...

Inheritance diagram for LOrientationd:
QuatD VBase4D

List of all members.

Public Member Functions

 LOrientationd ()
 LOrientationd (Mat3D const )
 matrix3
 LOrientationd (QuatD const )
 LOrientationd (Vec3D const , float)
 vector + twist
 LOrientationd (Mat4D const )
 matrix4
 LOrientationd (double, double, double, double)
unsigned int addHash (unsigned int hash)
 Adds the vector into the running hash.
unsigned int addHash (unsigned int hash, double threshold)
 Adds the vector into the running hash.
 addToCell (int i, double value)
 addW (double value)
 addX (double value)
 addY (double value)
 addZ (double value)
bool almostEqual (QuatD const other)
 Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (QuatD const other, double threshold)
 Returns true if two quaternions are memberwise equal within a specified tolerance.
bool almostEqual (VBase4D const other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (VBase4D const other, double threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance.
bool almostSameDirection (QuatD const other, double threshold)
 Returns true if two quaternions represent the same rotation within a specified tolerance.
double angleDeg (QuatD const other)
 Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.
double angleRad (QuatD const other)
 Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.
int compareTo (VBase4D const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo (VBase4D const other, double threshold)
 Sorts vectors lexicographically, componentwise.
QuatD conjugate ()
 Returns the complex conjugate of this quat.
bool conjugateFrom (QuatD const other)
 Computes the conjugate of the other quat, and stores the result in this quat.
bool conjugateInPlace ()
 Sets this to be the conjugate of the current quat.
double dot (VBase4D const other)
 extractToMatrix (Mat3D m)
 Based on the quat lib from VRPN.
 extractToMatrix (Mat4D m)
 Based on the quat lib from VRPN.
 fill (double fill_value)
 Sets each element of the vector to the indicated fill_value.
VBase4D fmax (VBase4D const other)
VBase4D fmin (VBase4D const other)
double getAngle ()
 This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis.
double getAngleRad ()
 This, along with get_axis(), returns the rotation represented by the quaternion as an angle about an arbitrary axis.
PyObject getattr (string attr_name)
 This is used to implement swizzle masks.
Vec3D getAxis ()
 This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis.
Vec3D getAxisNormalized ()
 This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis.
double getCell (int i)
 getData ()
 Returns the address of the first of the four data elements in the vector.
Vec3D getForward (CoordinateSystem cs)
 Returns the orientation represented by this quaternion, expressed as a forward vector.
Vec3D getForward ()
 Returns the orientation represented by this quaternion, expressed as a forward vector.
unsigned int getHash (double threshold)
 Returns a suitable hash for phash_map.
unsigned int getHash ()
 Returns a suitable hash for phash_map.
VBase3D getHpr (CoordinateSystem cs)
 Extracts the equivalent Euler angles from the unit quaternion.
VBase3D getHpr ()
 Extracts the equivalent Euler angles from the unit quaternion.
double getI ()
double getJ ()
double getK ()
int getNumComponents ()
 Returns the number of elements in the vector, four.
double getR ()
Vec3D getRight ()
 Returns the orientation represented by this quaternion, expressed as a right vector.
Vec3D getRight (CoordinateSystem cs)
 Returns the orientation represented by this quaternion, expressed as a right vector.
Vec3D getUp (CoordinateSystem cs)
 Returns the orientation represented by this quaternion, expressed as an up vector.
Vec3D getUp ()
 Returns the orientation represented by this quaternion, expressed as an up vector.
double getW ()
double getX ()
double getY ()
double getZ ()
bool invertFrom (QuatD const other)
 Computes the inverse of the other quat, and stores the result in this quat.
bool invertInPlace ()
 Inverts the current quat.
bool isAlmostIdentity (double tolerance)
 Returns true if this quaternion represents the identity transformation within a given tolerance.
bool isIdentity ()
 Returns true if this quaternion represents the identity transformation: no rotation.
bool isNan ()
 Returns true if any component of the vector is not-a-number, false otherwise.
bool isSameDirection (QuatD const other)
 Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.
double length ()
 Returns the length of the vector, by the Pythagorean theorem.
double lengthSquared ()
 Returns the square of the vector's length, cheap and easy.
QuatD multiply (QuatD const rhs)
 actual multiply call (non virtual)
bool normalize ()
 Normalizes the vector in place.
 operator new (unsigned int size)
bool operator!= (VBase4D const other)
LOrientationd operator* (LRotationd const other)
 Orientation * rotation = Orientation Applies a rotation to an orientation.
Mat3D operator* (Mat3D const )
 Quat * Matrix = matrix.
Mat4D operator* (Mat4D const )
 Quat * Matrix = matrix.
QuatD operator* (double scalar)
LOrientationd operator* (QuatD const other)
 Orientation * Orientation This is a meaningless operation, and will always simply return the rhs.
QuatD operator*= (QuatD const )
VBase4D operator*= (double scalar)
VBase4D operator+ (VBase4D const other)
QuatD operator+ (QuatD const other)
VBase4D operator+= (VBase4D const other)
QuatD operator- (QuatD const other)
VBase4D operator- (VBase4D const other)
QuatD operator- ()
VBase4D operator-= (VBase4D const other)
QuatD operator/ (double scalar)
VBase4D operator/= (double scalar)
bool operator< (VBase4D const other)
 This performs a lexicographical comparison.
bool operator== (VBase4D const other)
double operator[] (int i)
 operator[] (int i)
 output (ostream)
VBase4D project (VBase4D const onto)
 Returns a new vector representing the projection of this vector onto another one.
 pythonRepr (ostream out, string class_name)
PyObject reduce (PyObject self)
 This special Python method is implement to provide support for the pickle module.
 set (double x, double y, double z, double w)
int setattr (PyObject self, string attr_name, PyObject assign)
 This is used to implement write masks.
 setCell (int i, double value)
 setFromAxisAngle (double angle_deg, Vec3D const axis)
 angle_deg is the angle about the axis in degrees.
 setFromAxisAngleRad (double angle_rad, Vec3D const axis)
 angle_rad is the angle about the axis in radians.
 setFromMatrix (Mat4D const m)
 setFromMatrix (Mat3D const m)
 Sets the quaternion according to the rotation represented by the matrix.
 setHpr (VBase3D const hpr)
 Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.
 setHpr (VBase3D const hpr, CoordinateSystem cs)
 Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.
 setI (double i)
 setitem (int i, double v)
 setJ (double j)
 setK (double k)
 setR (double r)
 setW (double value)
 setX (double value)
 setY (double value)
 setZ (double value)
VBase4D xform (VBase4D const v)
 Transforms a 4-d vector by the indicated rotation.
VBase3D xform (VBase3D const v)
 Transforms a 3-d vector by the indicated rotation.

Static Public Member Functions

static TypeHandle getClassType ()
static QuatD const identQuat ()
 Returns an identity quaternion.
static QuatD pureImaginary (Vec3D const )
static int size ()
 Returns 4: the number of components of a LVecBase4.
static VBase4D const unitW ()
 Returns a unit W vector.
static VBase4D const unitX ()
 Returns a unit X vector.
static VBase4D const unitY ()
 Returns a unit Y vector.
static VBase4D const unitZ ()
 Returns a unit Z vector.
static VBase4D const zero ()
 Returns a zero-length vector.

Detailed Description

This is a unit quaternion representing an orientation.


Constructor & Destructor Documentation

LOrientationd ( Mat3D  const)

matrix3

LOrientationd ( Mat4D  const)

matrix4

LOrientationd ( QuatD  const)
LOrientationd ( Vec3D  const,
float   
)

vector + twist

LOrientationd ( double  ,
double  ,
double  ,
double   
)

Member Function Documentation

unsigned int addHash ( unsigned int  hash) [inherited]

Adds the vector into the running hash.

unsigned int addHash ( unsigned int  hash,
double  threshold 
) [inherited]

Adds the vector into the running hash.

addToCell ( int  i,
double  value 
) [inherited]
addW ( double  value) [inherited]
addX ( double  value) [inherited]
addY ( double  value) [inherited]
addZ ( double  value) [inherited]
bool almostEqual ( QuatD const  other,
double  threshold 
) [inherited]

Returns true if two quaternions are memberwise equal within a specified tolerance.

bool almostEqual ( QuatD const  other) [inherited]

Returns true if two quaternions are memberwise equal within a default tolerance based on the numeric type.

bool almostEqual ( VBase4D const  other) [inherited]

Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.

bool almostEqual ( VBase4D const  other,
double  threshold 
) [inherited]

Returns true if two vectors are memberwise equal within a specified tolerance.

bool almostSameDirection ( QuatD const  other,
double  threshold 
) [inherited]

Returns true if two quaternions represent the same rotation within a specified tolerance.

double angleDeg ( QuatD const  other) [inherited]

Returns the angle between the orientation represented by this quaternion and the other one, expressed in degrees.

double angleRad ( QuatD const  other) [inherited]

Returns the angle between the orientation represented by this quaternion and the other one, expressed in radians.

int compareTo ( VBase4D const  other) [inherited]

This flavor of compare_to uses a default threshold value based on the numeric type.

int compareTo ( VBase4D const  other,
double  threshold 
) [inherited]

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).

QuatD conjugate ( ) [inherited]

Returns the complex conjugate of this quat.

bool conjugateFrom ( QuatD const  other) [inherited]

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.

bool conjugateInPlace ( ) [inherited]

Sets this to be the conjugate of the current quat.

Returns true if the successful, false if the quat was singular.

double dot ( VBase4D const  other) [inherited]
extractToMatrix ( Mat3D  m) [inherited]

Based on the quat lib from VRPN.

extractToMatrix ( Mat4D  m) [inherited]

Based on the quat lib from VRPN.

fill ( double  fill_value) [inherited]

Sets each element of the vector to the indicated fill_value.

This is particularly useful for initializing to zero.

VBase4D fmax ( VBase4D const  other) [inherited]
VBase4D fmin ( VBase4D const  other) [inherited]
double getAngle ( ) [inherited]

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.

double getAngleRad ( ) [inherited]

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.

PyObject getattr ( string  attr_name) [inherited]

This is used to implement swizzle masks.

Reimplemented in Vec4D, and Point4D.

Vec3D getAxis ( ) [inherited]

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.

Vec3D getAxisNormalized ( ) [inherited]

This, along with get_angle(), returns the rotation represented by the quaternion as an angle about an arbitrary axis.

This returns the normalized axis.

double getCell ( int  i) [inherited]
static TypeHandle getClassType ( ) [static]

Reimplemented from QuatD.

getData ( ) [inherited]

Returns the address of the first of the four data elements in the vector.

The remaining elements occupy the next positions consecutively in memory.

Vec3D getForward ( CoordinateSystem  cs) [inherited]

Returns the orientation represented by this quaternion, expressed as a forward vector.

Vec3D getForward ( ) [inherited]

Returns the orientation represented by this quaternion, expressed as a forward vector.

unsigned int getHash ( ) [inherited]

Returns a suitable hash for phash_map.

unsigned int getHash ( double  threshold) [inherited]

Returns a suitable hash for phash_map.

VBase3D getHpr ( ) [inherited]

Extracts the equivalent Euler angles from the unit quaternion.

VBase3D getHpr ( CoordinateSystem  cs) [inherited]

Extracts the equivalent Euler angles from the unit quaternion.

double getI ( ) [inherited]
double getJ ( ) [inherited]
double getK ( ) [inherited]
int getNumComponents ( ) [inherited]

Returns the number of elements in the vector, four.

double getR ( ) [inherited]
Vec3D getRight ( CoordinateSystem  cs) [inherited]

Returns the orientation represented by this quaternion, expressed as a right vector.

Vec3D getRight ( ) [inherited]

Returns the orientation represented by this quaternion, expressed as a right vector.

Vec3D getUp ( CoordinateSystem  cs) [inherited]

Returns the orientation represented by this quaternion, expressed as an up vector.

Vec3D getUp ( ) [inherited]

Returns the orientation represented by this quaternion, expressed as an up vector.

double getW ( ) [inherited]
double getX ( ) [inherited]
double getY ( ) [inherited]
double getZ ( ) [inherited]
static QuatD const identQuat ( ) [static, inherited]

Returns an identity quaternion.

bool invertFrom ( QuatD const  other) [inherited]

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.

bool invertInPlace ( ) [inherited]

Inverts the current quat.

Returns true if the inverse is successful, false if the quat was singular.

bool isAlmostIdentity ( double  tolerance) [inherited]

Returns true if this quaternion represents the identity transformation within a given tolerance.

bool isIdentity ( ) [inherited]

Returns true if this quaternion represents the identity transformation: no rotation.

bool isNan ( ) [inherited]

Returns true if any component of the vector is not-a-number, false otherwise.

bool isSameDirection ( QuatD const  other) [inherited]

Returns true if two quaternions represent the same rotation within a default tolerance based on the numeric type.

double length ( ) [inherited]

Returns the length of the vector, by the Pythagorean theorem.

double lengthSquared ( ) [inherited]

Returns the square of the vector's length, cheap and easy.

QuatD multiply ( QuatD const  rhs) [inherited]

actual multiply call (non virtual)

bool normalize ( ) [inherited]

Normalizes the vector in place.

Returns true if the vector was normalized, false if it was a zero-length vector.

Reimplemented from VBase4D.

operator new ( unsigned int  size) [inherited]
bool operator!= ( VBase4D const  other) [inherited]
Mat3D operator* ( Mat3D  const) [inherited]

Quat * Matrix = matrix.

Mat4D operator* ( Mat4D  const) [inherited]

Quat * Matrix = matrix.

LOrientationd operator* ( LRotationd const  other)

Orientation * rotation = Orientation Applies a rotation to an orientation.

QuatD operator* ( double  scalar) [inherited]

Reimplemented from VBase4D.

Reimplemented in LRotationd.

LOrientationd operator* ( QuatD const  other)

Orientation * Orientation This is a meaningless operation, and will always simply return the rhs.

Reimplemented from QuatD.

VBase4D operator*= ( double  scalar) [inherited]
QuatD operator*= ( QuatD  const) [inherited]
QuatD operator+ ( QuatD const  other) [inherited]
VBase4D operator+ ( VBase4D const  other) [inherited]

Reimplemented in Vec4D, and Point4D.

VBase4D operator+= ( VBase4D const  other) [inherited]
QuatD operator- ( QuatD const  other) [inherited]
QuatD operator- ( ) [inherited]

Reimplemented from VBase4D.

VBase4D operator- ( VBase4D const  other) [inherited]

Reimplemented in Vec4D, and Point4D.

VBase4D operator-= ( VBase4D const  other) [inherited]
QuatD operator/ ( double  scalar) [inherited]

Reimplemented from VBase4D.

Reimplemented in LRotationd.

VBase4D operator/= ( double  scalar) [inherited]
bool operator< ( VBase4D const  other) [inherited]

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().

bool operator== ( VBase4D const  other) [inherited]
double operator[] ( int  i) [inherited]
operator[] ( int  i) [inherited]
output ( ostream  ) [inherited]

Reimplemented from VBase4D.

VBase4D project ( VBase4D const  onto) [inherited]

Returns a new vector representing the projection of this vector onto another one.

The resulting vector will be a scalar multiple of onto.

Reimplemented in Vec4D, and Point4D.

static QuatD pureImaginary ( Vec3D  const) [static, inherited]
pythonRepr ( ostream  out,
string  class_name 
) [inherited]

Reimplemented in Vec4D, and Point4D.

PyObject reduce ( PyObject  self) [inherited]

This special Python method is implement to provide support for the pickle module.

set ( double  x,
double  y,
double  z,
double  w 
) [inherited]
int setattr ( PyObject  self,
string  attr_name,
PyObject  assign 
) [inherited]

This is used to implement write masks.

Reimplemented in Vec4D, and Point4D.

setCell ( int  i,
double  value 
) [inherited]
setFromAxisAngle ( double  angle_deg,
Vec3D const  axis 
) [inherited]

angle_deg is the angle about the axis in degrees.

axis must be normalized.

setFromAxisAngleRad ( double  angle_rad,
Vec3D const  axis 
) [inherited]

angle_rad is the angle about the axis in radians.

axis must be normalized.

setFromMatrix ( Mat3D const  m) [inherited]

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.

setFromMatrix ( Mat4D const  m) [inherited]
setHpr ( VBase3D const  hpr,
CoordinateSystem  cs 
) [inherited]

Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.

(from Real-time Rendering, p.49)

setHpr ( VBase3D const  hpr) [inherited]

Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.

(from Real-time Rendering, p.49)

setI ( double  i) [inherited]
setitem ( int  i,
double  v 
) [inherited]
setJ ( double  j) [inherited]
setK ( double  k) [inherited]
setR ( double  r) [inherited]
setW ( double  value) [inherited]
setX ( double  value) [inherited]
setY ( double  value) [inherited]
setZ ( double  value) [inherited]
static int size ( ) [static, inherited]

Returns 4: the number of components of a LVecBase4.

static VBase4D const unitW ( ) [static, inherited]

Returns a unit W vector.

Reimplemented in Vec4D, and Point4D.

static VBase4D const unitX ( ) [static, inherited]

Returns a unit X vector.

Reimplemented in Vec4D, and Point4D.

static VBase4D const unitY ( ) [static, inherited]

Returns a unit Y vector.

Reimplemented in Vec4D, and Point4D.

static VBase4D const unitZ ( ) [static, inherited]

Returns a unit Z vector.

Reimplemented in Vec4D, and Point4D.

VBase4D xform ( VBase4D const  v) [inherited]

Transforms a 4-d vector by the indicated rotation.

VBase3D xform ( VBase3D const  v) [inherited]

Transforms a 3-d vector by the indicated rotation.

static VBase4D const zero ( ) [static, inherited]

Returns a zero-length vector.

Reimplemented in Vec4D, and Point4D.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties