Simbody
|
00001 //----------------------------------------------------------------------------- 00002 // File: Orientation.h 00003 // Class: None 00004 // Parent: None 00005 // Purpose: Includes UnitVec3, Quaternion, Rotation, Transform, and related classes 00006 //----------------------------------------------------------------------------- 00007 #ifndef SimTK_SIMMATRIX_ORIENTATION_H_ 00008 #define SimTK_SIMMATRIX_ORIENTATION_H_ 00009 00010 /* -------------------------------------------------------------------------- * 00011 * SimTK Core: SimTK Simmatrix(tm) * 00012 * -------------------------------------------------------------------------- * 00013 * This is part of the SimTK Core biosimulation toolkit originating from * 00014 * Simbios, the NIH National Center for Physics-Based Simulation of * 00015 * Biological Structures at Stanford, funded under the NIH Roadmap for * 00016 * Medical Research, grant U54 GM072970. See https://simtk.org. * 00017 * * 00018 * Portions copyright (c) 2005-7 Stanford University and the Authors. * 00019 * Authors: Michael Sherman and Paul Mitiguy * 00020 * Contributors: * 00021 * * 00022 * Permission is hereby granted, free of charge, to any person obtaining a * 00023 * copy of this software and associated documentation files (the "Software"), * 00024 * to deal in the Software without restriction, including without limitation * 00025 * the rights to use, copy, modify, merge, publish, distribute, sublicense, * 00026 * and/or sell copies of the Software, and to permit persons to whom the * 00027 * Software is furnished to do so, subject to the following conditions: * 00028 * * 00029 * The above copyright notice and this permission notice shall be included in * 00030 * all copies or substantial portions of the Software. * 00031 * * 00032 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 00033 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 00034 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 00035 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 00036 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 00037 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * 00038 * USE OR OTHER DEALINGS IN THE SOFTWARE. * 00039 * -------------------------------------------------------------------------- */ 00040 00048 //----------------------------------------------------------------------------- 00049 #include "SimTKcommon/internal/common.h" 00050 #include "SimTKcommon/SmallMatrix.h" 00051 #include "SimTKcommon/internal/UnitVec.h" 00052 #include "SimTKcommon/internal/Quaternion.h" 00053 #include "SimTKcommon/internal/Rotation.h" 00054 #include "SimTKcommon/internal/Transform.h" 00055 //----------------------------------------------------------------------------- 00056 #include <iosfwd> // Forward declaration of iostream 00057 //----------------------------------------------------------------------------- 00058 00059 //----------------------------------------------------------------------------- 00060 // Some handy conversion constants. 00061 // Use templatized inline conversion routines instead whenever possible. 00062 // These are defined so that you can multiply by them. For example, if you have 00063 // an angle qRad in radians and want to convert to degrees, write qDeg = qRad*SimTK_RTD. 00064 // Note that the expressions here will always be evaluated at compile time, yielding 00065 // long double results which you can cast to smaller sizes if you want. 00066 //----------------------------------------------------------------------------- 00067 #define SimTK_RTD (180/SimTK_PI) 00068 #define SimTK_DTR (SimTK_PI/180) 00069 00070 //----------------------------------------------------------------------------- 00071 namespace SimTK { 00072 00073 inline static Real convertRadiansToDegrees(const Real rad) { return rad*Real(SimTK_RTD); } 00074 inline static Real convertDegreesToRadians(const Real deg) { return deg*Real(SimTK_DTR); } 00075 00076 00077 //------------------------------------------------------------------------------ 00078 } // End of namespace SimTK 00079 00080 //-------------------------------------------------------------------------- 00081 #endif // SimTK_SIMMATRIX_ORIENTATION_H_ 00082 //--------------------------------------------------------------------------