Numbers and Constants in SimTK
SimTK supports both float (single) and double precision, and is compiled with one of those as its default, which is then referred to in SimTK as type Real. SimTK::Real is simply a typedef to either the built-in float or double type. OpenSim always uses double precision, so for our purposes the SimTK::Real type is always defined
typedef double Real;
Thus SimTK::Real and double are interchangeable in the OpenSim API. We will use double everywhere because it is more conventional and requires fewer characters. However, if you look elsewhere at SimTK documentation, you will see type Real used instead; just interpret that as double when you see it. Similarly, SimTK has a type SimTK::Complex which is interchangeable here with the C++ built-in type std::complex<double>. You probably will not need to use complex numbers with OpenSim, but they are available if you need them.
SimTK pre-defines a number of constants to machine precision; we recommend you use those rather than defining your own. The most useful ones are: Pi, E (e), Infinity, NaN (not-a-number), and I (i= sqrt(-1) ). Note that the first letter of constants are capitalized and in the SimTK namespace.
Next: Vectors and Matrices
Previous: SimTK Basics
Home: Scripting and Development | Developer's Guide | SimTK Basics
OpenSim is supported by the Mobilize Center , an NIH Biomedical Technology Resource Center (grant P41 EB027060); the Restore Center , an NIH-funded Medical Rehabilitation Research Resource Network Center (grant P2C HD101913); and the Wu Tsai Human Performance Alliance through the Joe and Clara Tsai Foundation. See the People page for a list of the many people who have contributed to the OpenSim project over the years. ©2010-2024 OpenSim. All rights reserved.