Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/linmath/lrotation_src.I

Go to the documentation of this file.
00001 // Filename: lrotation_src.I
00002 // Created by:  frang, charles (23Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 ////////////////////////////////////////////////////////////////////
00020 //     Function: LRotation::Default Constructor
00021 //       Access: public
00022 //  Description:
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE_LINMATH FLOATNAME(LRotation)::
00025 FLOATNAME(LRotation)() {
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: LRotation::Copy Constructor
00030 //       Access: public
00031 //  Description:
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE_LINMATH FLOATNAME(LRotation)::
00034 FLOATNAME(LRotation)(const FLOATNAME(LQuaternion)& c) :
00035   FLOATNAME(LQuaternion)(c) {
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: LRotation::Constructor
00040 //       Access: public
00041 //  Description:
00042 ////////////////////////////////////////////////////////////////////
00043 INLINE_LINMATH FLOATNAME(LRotation)::
00044 FLOATNAME(LRotation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) :
00045   FLOATNAME(LQuaternion)(r, i, j, k) {
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: LRotation::Constructor
00050 //       Access: public
00051 //  Description: lmatrix3
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE_LINMATH FLOATNAME(LRotation)::
00054 FLOATNAME(LRotation)(const FLOATNAME(LMatrix3) &m) {
00055   set_from_matrix(m);
00056 }
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 //     Function: LRotation::Constructor
00060 //       Access: public
00061 //  Description: lmatrix4
00062 ////////////////////////////////////////////////////////////////////
00063 INLINE_LINMATH FLOATNAME(LRotation)::
00064 FLOATNAME(LRotation)(const FLOATNAME(LMatrix4) &m) {
00065   set_from_matrix(m);
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: LRotation::Constructor
00070 //       Access: public
00071 //  Description: axis + angle (in degrees)
00072 ////////////////////////////////////////////////////////////////////
00073 INLINE_LINMATH FLOATNAME(LRotation)::
00074 FLOATNAME(LRotation)(const FLOATNAME(LVector3) &axis, FLOATTYPE angle) {
00075   FLOATTYPE radians = deg_2_rad(angle);
00076   FLOATTYPE theta_over_2 = radians * FLOATCONST(0.5);
00077   FLOATTYPE sin_to2 = csin(theta_over_2);
00078 
00079   set_r(ccos(theta_over_2));
00080   set_i(axis[0] * sin_to2);
00081   set_j(axis[1] * sin_to2);
00082   set_k(axis[2] * sin_to2);
00083 }
00084 
00085 ////////////////////////////////////////////////////////////////////
00086 //     Function: LRotation::Constructor
00087 //       Access: public
00088 //  Description: Sets the rotation from the given Euler angles.
00089 ////////////////////////////////////////////////////////////////////
00090 INLINE_LINMATH FLOATNAME(LRotation)::
00091 FLOATNAME(LRotation)(FLOATTYPE h, FLOATTYPE p, FLOATTYPE r) {
00092   set_hpr(FLOATNAME(LVecBase3)(h, p, r));
00093 }
00094 
00095 ////////////////////////////////////////////////////////////////////
00096 //     Function: LRotation::operator *
00097 //       Access: public
00098 //  Description: Rotation * Rotation = Rotation
00099 ////////////////////////////////////////////////////////////////////
00100 INLINE_LINMATH FLOATNAME(LRotation) FLOATNAME(LRotation)::
00101 operator*(const FLOATNAME(LRotation)& other) const {
00102   return multiply(other);
00103 }
00104 
00105 ////////////////////////////////////////////////////////////////////
00106 //     Function: LRotation::operator *
00107 //       Access: public
00108 //  Description: Rotation * Orientation = Orientation
00109 //               This is another meaningless operation, attempting
00110 //               to apply an orientation to a rotation.  It simply
00111 //               returns the rhs.
00112 ////////////////////////////////////////////////////////////////////
00113 INLINE_LINMATH FLOATNAME(LQuaternion) FLOATNAME(LRotation)::
00114 operator*(const FLOATNAME(LQuaternion)& other) const {
00115   return other;
00116 }
00117 
00118 

Generated on Fri May 2 00:40:13 2003 for Panda by doxygen1.3