00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: VMDQuat.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.12 $ $Date: 2019/01/17 21:21:02 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * Quaternion class 00019 ***************************************************************************/ 00020 00021 #ifndef QUAT_H__ 00022 #define QUAT_H__ 00023 00025 class Quat { 00026 public: 00027 Quat() {identity(); } 00028 Quat(double x, double y, double z, double w); 00029 00030 // for the next two, angle is measured in degrees 00031 void rotate(const float *u, float angle); // assume u normalized! 00032 void rotate(char axis, float angle); 00033 void invert(); 00034 void identity(); 00035 00036 void mult(const Quat &); 00037 void multpoint3(const float *, float *) const; 00038 00039 void fromMatrix(const float *); 00040 void printQuat(float *); 00041 void printMatrix(float *); 00042 00043 private: 00044 double qx, qy, qz, qw; 00045 }; 00046 00047 #endif