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

panda/src/linmath/lorientation_src.I

Go to the documentation of this file.
00001 // Filename: lorientation_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: LOrientation::Default Constructor
00021 //       Access: public
00022 //  Description:
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE_LINMATH FLOATNAME(LOrientation)::
00025 FLOATNAME(LOrientation)() {
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: LOrientation::Copy Constructor
00030 //       Access: public
00031 //  Description:
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE_LINMATH FLOATNAME(LOrientation)::
00034 FLOATNAME(LOrientation)(const FLOATNAME(LQuaternion)& c) :
00035   FLOATNAME(LQuaternion)(c) {
00036 }
00037 
00038 ////////////////////////////////////////////////////////////////////
00039 //     Function: LOrientation::Constructor
00040 //       Access: public
00041 //  Description:
00042 ////////////////////////////////////////////////////////////////////
00043 INLINE_LINMATH FLOATNAME(LOrientation)::
00044 FLOATNAME(LOrientation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) :
00045   FLOATNAME(LQuaternion)(r, i, j, k) {
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: LOrientation::Constructor
00050 //       Access: public
00051 //  Description: vector + twist
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE_LINMATH FLOATNAME(LOrientation)::
00054 FLOATNAME(LOrientation)(const FLOATNAME(LVector3) &point_at, float twist) {
00055   float radians = deg_2_rad(twist);
00056   float theta_over_2 = radians * FLOATCONST(0.5);
00057   float sin_to2 = sinf(theta_over_2);
00058 
00059   set_r(cosf(theta_over_2));
00060   set_i(point_at[0] * sin_to2);
00061   set_j(point_at[1] * sin_to2);
00062   set_k(point_at[2] * sin_to2);
00063 }
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: LOrientation::Constructor
00067 //       Access: public
00068 //  Description: matrix3
00069 ////////////////////////////////////////////////////////////////////
00070 INLINE_LINMATH FLOATNAME(LOrientation)::
00071 FLOATNAME(LOrientation)(const FLOATNAME(LMatrix3) &m) {
00072   set_from_matrix(m);
00073 }
00074 
00075 ////////////////////////////////////////////////////////////////////
00076 //     Function: LOrientation::Constructor
00077 //       Access: public
00078 //  Description: matrix4
00079 ////////////////////////////////////////////////////////////////////
00080 INLINE_LINMATH FLOATNAME(LOrientation)::
00081 FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &m) {
00082   set_from_matrix(m);
00083 }
00084 
00085 ////////////////////////////////////////////////////////////////////
00086 //     Function: LOrientation::operator *
00087 //       Access: public
00088 //  Description: Orientation * rotation = Orientation
00089 //               Applies an rotation to an orientation.
00090 ////////////////////////////////////////////////////////////////////
00091 INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
00092 operator *(const FLOATNAME(LQuaternion)& other) const {
00093   return multiply(other);
00094 }
00095 
00096 ////////////////////////////////////////////////////////////////////
00097 //     Function: LOrientation::operator *
00098 //       Access: public
00099 //  Description: Orientation * Orientation
00100 //               This is a meaningless operation, and will always
00101 //               simply return the rhs.
00102 ////////////////////////////////////////////////////////////////////
00103 INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
00104 operator *(const FLOATNAME(LOrientation)& other) const {
00105   return other;
00106 }

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