Functions

Quat.cpp File Reference

Implementation of Quaternion class. More...

#include "Quat.h"
Include dependency graph for Quat.cpp:

Go to the source code of this file.

Functions

CQrot operator^ (const CQrot &r, double p)

Detailed Description

Implementation of Quaternion class.

Author:
David Gu
Date:
10/07/2010

Definition in file Quat.cpp.


Function Documentation

CQrot operator^ ( const CQrot r,
double  p 
)

power of quaternion

Parameters:
r input quaternion
p power
Returns:
quoternion power p

Definition at line 73 of file Quat.cpp.

{
  CQrot q = r;
  q.normalize();
  double theta = 2 * acos( q.m_w );
  if( theta < 1e-10 ) return q; 

  CPoint axis( q.m_x, q.m_y, q.m_z );
  axis /= axis.norm();
  theta *= p;
  q.m_w   = cos( theta * 0.5 );
  axis *= sin( theta * 0.5 );

  q.m_x = axis[0];
  q.m_y = axis[1];
  q.m_z = axis[2];

  return q;
}

Here is the call graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines