LengthScaling.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace armarx
4 {
5 
7  {
8  public:
9  /// Constructor. Enables scaling.
10  LengthScaling();
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
armarx::LengthScaling::meterToMilli
float meterToMilli() const
Get the scaling factor for: millimeter = meter * factor.
Definition: LengthScaling.cpp:30
armarx::LengthScaling::disable
void disable()
Set scaling of meter to millimeter to 1.
Definition: LengthScaling.cpp:18
armarx::LengthScaling::milliToMeter
float milliToMeter() const
Get the scaling factor for: meter = millimeter * factor.
Definition: LengthScaling.cpp:36
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
armarx::LengthScaling::setEnabled
void setEnabled(bool enabled)
Enable or disable length scaling.
Definition: LengthScaling.cpp:24
armarx::LengthScaling::LengthScaling
LengthScaling()
Constructor. Enables scaling.
Definition: LengthScaling.cpp:6
armarx::LengthScaling::milliToMeter
ValueT milliToMeter(const ValueT &millimeter) const
Scale the given millimeter value to meter.
Definition: LengthScaling.h:37
armarx::LengthScaling::enable
void enable()
Set scaling of meter to millimeter to 1000.
Definition: LengthScaling.cpp:12
armarx::LengthScaling::meterToMilli
ValueT meterToMilli(const ValueT &meter) const
Scale the given meter value to millimeter.
Definition: LengthScaling.h:29
armarx::LengthScaling
Definition: LengthScaling.h:6
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27