Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

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

Code Block
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

Home: SimTK Basics | Developer's Guide