cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros
cmnUnits.h File Reference

Declaration of units and unit conversion methodsThis file include the definition and implementation of constants and global functions used to defines measuring units in the cisst libraries. The internal units of the cisst libraries are meters, kilograms, seconds and radians if CISST_USE_SI_UNITS is set to true. Otherwise, units are millimeters and grams. Older versions of cisst didn't define CISST_USE_SI_UNITS and the default units were millimeters and grams. More...

#include <cisstConfig.h>
#include <cisstCommon/cmnExport.h>

Go to the source code of this file.

Macros

#define _cmnUnits_h
 

Length units. The internal unit is millimeter if

CISST_USE_SI_UNITS is set to false, meters otherwise.

const double cmn_mm = 1.0
 
const double cmn_um = cmn_mm / 1000.0
 
const double cmn_cm = 10.0 * cmn_mm
 
const double cmn_m = 1000.0
 
const double cmn_km = 1000.0 * cmn_m
 
double cmnInternalTo_mm (double valueInternalUnits)
 
double cmnInternalTo_um (double valueInternalUnits)
 
double cmnInternalTo_cm (double valueInternalUnits)
 
double cmnInternalTo_m (double valueInternalUnits)
 
double cmnInternalTo_km (double valueInternalUnits)
 

Mass units. The internal unit is grams if

CISST_USE_SI_UNITS is set to false, kilograms otherwise.

const double cmn_g = 1.0
 
const double cmn_mg = cmn_g / 1000.0
 
const double cmn_ug = cmn_mg / 1000.0
 
const double cmn_cg = cmn_g / 100.0
 
const double cmn_kg = 1000.0 * cmn_g
 
double cmnInternalTo_g (double valueInternalUnits)
 
double cmnInternalTo_mg (double valueInternalUnits)
 
double cmnInternalTo_ug (double valueInternalUnits)
 
double cmnInternalTo_cg (double valueInternalUnits)
 
double cmnInternalTo_kg (double valueInternalUnits)
 

Time units. The internal unit is seconds.

const double cmn_s = 1.0
 
const double cmn_ms = cmn_s / 1000.0
 
const double cmn_us = cmn_ms / 1000.0
 
const double cmn_ns = cmn_us / 1000.0
 
const double cmn_minute = 60.0 * cmn_s
 
const double cmn_hour = 60.0 * cmn_minute
 
const double cmn_day = 24.0 * cmn_hour
 
double cmnInternalTo_s (double valueInternalUnits)
 
double cmnInternalTo_ms (double valueInternalUnits)
 
double cmnInternalTo_us (double valueInternalUnits)
 
double cmnInternalTo_ns (double valueInternalUnits)
 
double cmnInternalTo_minute (double valueInternalUnits)
 
double cmnInternalTo_hour (double valueInternalUnits)
 
double cmnInternalTo_day (double valueInternalUnits)
 

Detailed Description

Declaration of units and unit conversion methods

This file include the definition and implementation of constants and global functions used to defines measuring units in the cisst libraries. The internal units of the cisst libraries are meters, kilograms, seconds and radians if CISST_USE_SI_UNITS is set to true. Otherwise, units are millimeters and grams. Older versions of cisst didn't define CISST_USE_SI_UNITS and the default units were millimeters and grams.

For all units, the cisst libraries provide a constant as well as a global function to convert from the internal units to other representations.

double distance = 5000 * cmn_m; // 5000 meters AnExampleOfFunction(50 * cmn_mm); // 50 millimeters std::cout << "distance in cm: " << cmnInternalTo_cm(distance) << std::endl;

Note
The use of underscore in symbol names is an exception to the cisst naming conventions.

Macro Definition Documentation

#define _cmnUnits_h

Function Documentation

double cmnInternalTo_cg ( double  valueInternalUnits)
inline

Convert a mass in internal units to centigrams

double cmnInternalTo_cm ( double  valueInternalUnits)
inline

Convert a length in internal units to centimeters

double cmnInternalTo_day ( double  valueInternalUnits)
inline

Convert a time in internal units to days

double cmnInternalTo_g ( double  valueInternalUnits)
inline

Convert a mass in internal units to grams

double cmnInternalTo_hour ( double  valueInternalUnits)
inline

Convert a time in internal units to hours

double cmnInternalTo_kg ( double  valueInternalUnits)
inline

Convert a mass in internal units to kilograms

double cmnInternalTo_km ( double  valueInternalUnits)
inline

Convert a length in internal units to kilometers

double cmnInternalTo_m ( double  valueInternalUnits)
inline

Convert a length in internal units to meters

double cmnInternalTo_mg ( double  valueInternalUnits)
inline

Convert a mass in internal units to milligrams

double cmnInternalTo_minute ( double  valueInternalUnits)
inline

Convert a time in internal units to minutes

double cmnInternalTo_mm ( double  valueInternalUnits)
inline

Convert a length in internal units to millimeters

double cmnInternalTo_ms ( double  valueInternalUnits)
inline

Convert a time in internal units to milliseconds

double cmnInternalTo_ns ( double  valueInternalUnits)
inline

Convert a time in internal units to nanoseconds

double cmnInternalTo_s ( double  valueInternalUnits)
inline

Convert a time in internal units to seconds

double cmnInternalTo_ug ( double  valueInternalUnits)
inline

Convert a mass in internal units to micrograms

double cmnInternalTo_um ( double  valueInternalUnits)
inline

Convert a length in internal units to micrometers

double cmnInternalTo_us ( double  valueInternalUnits)
inline

Convert a time in internal units to microseconds

Variable Documentation

const double cmn_cg = cmn_g / 100.0

Centigram constant, use to convert a mass in centigrams to internal units.

const double cmn_cm = 10.0 * cmn_mm

Centimeter constant, use to convert a length in centimeters to internal units.

const double cmn_day = 24.0 * cmn_hour

Days constant, use to convert a time in days to internal units.

const double cmn_g = 1.0

Gram constant, use to convert a mass in grams to internal units.

const double cmn_hour = 60.0 * cmn_minute

Hours constant, use to convert a time in hours to internal units.

const double cmn_kg = 1000.0 * cmn_g

Kilogram constant, use to convert a mass in kilograms to internal units.

const double cmn_km = 1000.0 * cmn_m

Kilometer constant, use to convert a length in kilometers to internal units.

const double cmn_m = 1000.0

Meter constant, use to convert a length in meters to internal units.

const double cmn_mg = cmn_g / 1000.0

Milligrams constant, use to convert a mass in milligrams to internal units.

const double cmn_minute = 60.0 * cmn_s

Minutes constant, use to convert a time in minutes to internal units.

const double cmn_mm = 1.0

Millimeter constant, use to convert a length in millimeters to internal units.

const double cmn_ms = cmn_s / 1000.0

Milliseconds constant, use to convert a time in milliseconds to internal units.

const double cmn_ns = cmn_us / 1000.0

Nanosecond constant, use to convert a time in nanoseconds to internal units.

const double cmn_s = 1.0

Second constant, use to convert a time in seconds to internal units.

const double cmn_ug = cmn_mg / 1000.0

Microgram constant, use to convert a mass in micrograms to internal units.

const double cmn_um = cmn_mm / 1000.0

Micrometer constant, use to convert a length in micrometers to internal units.

const double cmn_us = cmn_ms / 1000.0

Microsecond constant, use to convert a time in microseconds to internal units.