LengthScaling.h
Go to the documentation of this file.
1#pragma once
2
3namespace armarx
4{
5
7 {
8 public:
9 /// Constructor. Enables scaling.
11
12
13 /// Set scaling of meter to millimeter to 1000.
14 void enable();
15 /// Set scaling of meter to millimeter to 1.
16 void disable();
17 /// Enable or disable length scaling.
18 void setEnabled(bool enabled);
19
20
21 /// Get the scaling factor for: millimeter = meter * factor.
22 float meterToMilli() const;
23 /// Get the scaling factor for: meter = millimeter * factor.
24 float milliToMeter() const;
25
26 /// Scale the given meter value to millimeter.
27 template <typename ValueT>
28 ValueT
29 meterToMilli(const ValueT& meter) const
30 {
31 return meter * _meterToMilli;
32 }
33
34 /// Scale the given millimeter value to meter.
35 template <typename ValueT>
36 ValueT
37 milliToMeter(const ValueT& millimeter) const
38 {
39 return millimeter / _meterToMilli;
40 }
41
42
43 private:
44 float _meterToMilli = 1000;
45 };
46
47} // namespace armarx
void setEnabled(bool enabled)
Enable or disable length scaling.
void enable()
Set scaling of meter to millimeter to 1000.
ValueT meterToMilli(const ValueT &meter) const
Scale the given meter value to millimeter.
ValueT milliToMeter(const ValueT &millimeter) const
Scale the given millimeter value to meter.
float milliToMeter() const
Get the scaling factor for: meter = millimeter * factor.
void disable()
Set scaling of meter to millimeter to 1.
LengthScaling()
Constructor. Enables scaling.
float meterToMilli() const
Get the scaling factor for: millimeter = meter * factor.
This file offers overloads of toIce() and fromIce() functions for STL container types.