| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2003 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 // $Id: directioninterpolator.h 4757 2005-05-10 18:28:15Z buchholz $ 00019 // $Date: 2005-05-10 20:28:15 +0200 (Tue, 10 May 2005) $ 00020 // $Revision: 4757 $ 00021 // $State$ 00022 // $Author: buchholz $ 00023 // 00024 // $Log$ 00025 // Revision 1.8 2005/05/10 18:28:15 buchholz 00026 // degeneracyTest added 00027 // 00028 // Revision 1.7 2005/01/03 01:43:07 klimetschek 00029 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00030 // - removed vrs.vcproj 00031 // minor things: 00032 // - added all glutexamples to vrs4glut.sln 00033 // - fixed some problems in glutexamples 00034 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00035 // 00036 // Revision 1.6 2004/11/25 19:40:02 buchholz 00037 // parameter transform added 00038 // 00039 // Revision 1.5 2004/11/05 13:58:09 basch 00040 // Class comment changed (Doxygen style) 00041 // 00042 // Revision 1.4 2004/03/12 16:28:38 baumann 00043 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00044 // 00045 // Revision 1.3 2004/01/19 11:43:56 baumann 00046 // serialization mechanism improved 00047 // 00048 // Revision 1.2 2003/07/05 17:30:39 baumann 00049 // - derived from SharedObj 00050 // - serialization added 00051 // 00052 // Revision 1.1 2003/04/09 15:14:01 buchholz 00053 // moved from sg to vrs folder 00054 // 00055 // Revision 1.2 2003/02/24 12:45:20 buchholz 00056 // - handle return type changed to BehaviorNode::InvalidationHint 00057 // - added: "launch" feature for plane navigation 00058 // - some bugs fixed 00059 // - navigation conflict management (using common base class (navigation.h will follow) 00060 // 00061 // Revision 1.1 2003/02/19 15:13:26 buchholz 00062 // some navigation classes 00063 // 00064 00065 #ifndef VRS_DIRECTIONINTERPOLATOR_H 00066 #define VRS_DIRECTIONINTERPOLATOR_H 00067 00068 #include <vrs/sharedobj.h> 00069 #include <vrs/vector.h> 00070 00071 namespace VRS { 00072 00076 class VRS_CORE_API DirectionInterpolator : public SharedObj { 00077 00078 public: 00079 DirectionInterpolator(Vector up = Vector(0,1,0)); 00080 00081 00082 void setUp(const Vector& up); 00083 const Vector& getUp(); 00084 00085 void initInterpolation(const Vector& startDirection, const Vector& endDirection); 00088 00089 00090 00091 00092 bool degeneracyTest(const Vector& startDir, const Vector& endDir); 00093 00094 Vector getInterpolatedDirection(double lambda) const; 00098 const Vector& getStartDirection(); 00099 const Vector& getEndDirection(); 00100 00101 00108 void changeEndDirection(const Vector& v); 00109 00110 double getAngleDistance() const; 00115 00116 00117 00118 00119 00120 static double transformParameter(double t); 00121 00122 VRS_TYPEINFO(DirectionInterpolator, SharedObj); 00123 VRS_SERIALIZABLE(DirectionInterpolator); 00124 00125 private: 00126 00127 Vector cartesian2Polar(const Vector& v) const; 00128 Vector polar2Cartesian(const Vector& v) const; 00129 00130 00131 Vector up_; 00132 Vector right_; 00133 Vector nullAzimuth_; 00134 Vector startDirection_; 00135 Vector endDirection_; 00136 Vector startDirectionP_; // vectors in polar coordinates for internal use 00137 Vector endDirectionP_; 00138 bool interpolationInitialized_; 00139 }; 00140 00141 inline const Vector& DirectionInterpolator::getStartDirection() { 00142 VRS_Assertion(interpolationInitialized_, "no interpolation initialized"); 00143 return startDirection_; 00144 } 00145 00146 inline const Vector& DirectionInterpolator::getEndDirection() { 00147 VRS_Assertion(interpolationInitialized_, "no interpolation initialized"); 00148 return endDirection_; 00149 } 00150 00151 00152 } // namespace VRS 00153 00154 #endif // VRS_DIRECTIONINTERPOLATOR_H