Table of Contents

Class: Quaternion rdpyg/util/quaternion.py

Quaternion object implementing those methods required to be useful for OpenGL rendering (and not many others)

Methods   
AXYZ
XYZR
__getitem__
__init__
__len__
__mul__
__neg__
__repr__
delta
matrix
  AXYZ 
AXYZ ( self )

returns the angle, and x,y,z as a vector. as used by glRotate.

  XYZR 
XYZR ( self )

Get a VRML-style axis plus rotation form of the rotation. Note that this is in radians, not degrees, and that the angle is the last, not the first item... (x,y,z,radians)

  __getitem__ 
__getitem__ ( self,  x )

  __init__ 
__init__ ( self,  elements=[ 1, 0, 0, 0 ] )

The initializer is a four-element array,

w, x,y,z
all elements should be doubles/floats the default values are those for a unit multiplication quaternion.
  __len__ 
__len__ ( self )

  __mul__ 
__mul__ ( self,  other )

Multiply this quaternion by another quaternion, generating a new quaternion which is the combination of the rotations represented by the two source quaternions.

Other is interpreted as taking place within the coordinate space defined by this quaternion.

Alternately, if "other" is a matrix, return the dot-product of that matrix with our matrix (i.e. rotate the coordinate)

  __neg__ 
__neg__ ( self )

  __repr__ 
__repr__ ( self )

Return a human-friendly representation of the quaternion

Currently this representation is as an axis plus rotation (in radians)

  delta 
delta ( self,  other )

Return the angle in radians between this quaternion and another.

Return value is a positive angle in the range 0-pi representing the minimum angle between the two quaternion rotations.

From code by Halldor Fannar on the 3D game development algos list

  matrix 
matrix ( self )

Get a rotation matrix representing this rotation


Table of Contents

This document was automatically generated on Sat Jul 30 12:45:42 2005 by HappyDoc version 2.1