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