Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Orientation.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // File: Orientation.h
3 // Class: None
4 // Parent: None
5 // Purpose: Includes UnitVec3, Quaternion, Rotation, Transform, and related classes
6 //-----------------------------------------------------------------------------
7 #ifndef SimTK_SIMMATRIX_ORIENTATION_H_
8 #define SimTK_SIMMATRIX_ORIENTATION_H_
9 
10 /* -------------------------------------------------------------------------- *
11  * Simbody(tm): SimTKcommon *
12  * -------------------------------------------------------------------------- *
13  * This is part of the SimTK biosimulation toolkit originating from *
14  * Simbios, the NIH National Center for Physics-Based Simulation of *
15  * Biological Structures at Stanford, funded under the NIH Roadmap for *
16  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
17  * *
18  * Portions copyright (c) 2005-12 Stanford University and the Authors. *
19  * Authors: Michael Sherman *
20  * Contributors: *
21  * *
22  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
23  * not use this file except in compliance with the License. You may obtain a *
24  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
25  * *
26  * Unless required by applicable law or agreed to in writing, software *
27  * distributed under the License is distributed on an "AS IS" BASIS, *
28  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
29  * See the License for the specific language governing permissions and *
30  * limitations under the License. *
31  * -------------------------------------------------------------------------- */
32 
40 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
48 #include <iosfwd> // Forward declaration of iostream
49 //-----------------------------------------------------------------------------
50 
51 //-----------------------------------------------------------------------------
52 // Some handy conversion constants.
53 // Use templatized inline conversion routines instead whenever possible.
54 // These are defined so that you can multiply by them. For example, if you have
55 // an angle qRad in radians and want to convert to degrees, write qDeg = qRad*SimTK_RTD.
56 // Note that the expressions here will always be evaluated at compile time, yielding
57 // long double results which you can cast to smaller sizes if you want.
58 //-----------------------------------------------------------------------------
59 #define SimTK_RTD (180/SimTK_PI)
60 #define SimTK_DTR (SimTK_PI/180)
61 
62 //-----------------------------------------------------------------------------
63 namespace SimTK {
64 
65 inline static Real convertRadiansToDegrees(const Real rad) { return rad*Real(SimTK_RTD); }
66 inline static Real convertDegreesToRadians(const Real deg) { return deg*Real(SimTK_DTR); }
67 
68 
69 //------------------------------------------------------------------------------
70 } // End of namespace SimTK
71 
72 //--------------------------------------------------------------------------
73 #endif // SimTK_SIMMATRIX_ORIENTATION_H_
74 //--------------------------------------------------------------------------
static Real convertDegreesToRadians(const Real deg)
Definition: Orientation.h:66
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:577
Declares and defines the UnitVec and UnitRow classes.
#define SimTK_DTR
Definition: Orientation.h:60
#define SimTK_RTD
Definition: Orientation.h:59
This file is the user-includeable header to be included in user programs to provide fixed-length Vec ...
Mandatory first inclusion for any Simbody source or header file.
static Real convertRadiansToDegrees(const Real rad)
Definition: Orientation.h:65