Simbody
3.4 (development)
|
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 * Simbody(tm): SimTKcommon * 00012 * -------------------------------------------------------------------------- * 00013 * This is part of the SimTK 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/home/simbody. * 00017 * * 00018 * Portions copyright (c) 2005-12 Stanford University and the Authors. * 00019 * Authors: Michael Sherman * 00020 * Contributors: * 00021 * * 00022 * Licensed under the Apache License, Version 2.0 (the "License"); you may * 00023 * not use this file except in compliance with the License. You may obtain a * 00024 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * 00025 * * 00026 * Unless required by applicable law or agreed to in writing, software * 00027 * distributed under the License is distributed on an "AS IS" BASIS, * 00028 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 00029 * See the License for the specific language governing permissions and * 00030 * limitations under the License. * 00031 * -------------------------------------------------------------------------- */ 00032 00040 //----------------------------------------------------------------------------- 00041 #include "SimTKcommon/internal/common.h" 00042 #include "SimTKcommon/SmallMatrix.h" 00043 #include "SimTKcommon/internal/UnitVec.h" 00044 #include "SimTKcommon/internal/Quaternion.h" 00045 #include "SimTKcommon/internal/Rotation.h" 00046 #include "SimTKcommon/internal/Transform.h" 00047 //----------------------------------------------------------------------------- 00048 #include <iosfwd> // Forward declaration of iostream 00049 //----------------------------------------------------------------------------- 00050 00051 //----------------------------------------------------------------------------- 00052 // Some handy conversion constants. 00053 // Use templatized inline conversion routines instead whenever possible. 00054 // These are defined so that you can multiply by them. For example, if you have 00055 // an angle qRad in radians and want to convert to degrees, write qDeg = qRad*SimTK_RTD. 00056 // Note that the expressions here will always be evaluated at compile time, yielding 00057 // long double results which you can cast to smaller sizes if you want. 00058 //----------------------------------------------------------------------------- 00059 #define SimTK_RTD (180/SimTK_PI) 00060 #define SimTK_DTR (SimTK_PI/180) 00061 00062 //----------------------------------------------------------------------------- 00063 namespace SimTK { 00064 00065 inline static Real convertRadiansToDegrees(const Real rad) { return rad*Real(SimTK_RTD); } 00066 inline static Real convertDegreesToRadians(const Real deg) { return deg*Real(SimTK_DTR); } 00067 00068 00069 //------------------------------------------------------------------------------ 00070 } // End of namespace SimTK 00071 00072 //-------------------------------------------------------------------------- 00073 #endif // SimTK_SIMMATRIX_ORIENTATION_H_ 00074 //--------------------------------------------------------------------------