VR-Engage  2.2
Loading...
Searching...
No Matches
remapValueTransform.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies, Inc.
3** All rights reserved.
4******************************************************************************/
5
6//! \file
7//! \brief Value transformation that remaps input values from one range to another
8
9#pragma once
10
11#include "vreInput/export.h"
13
14namespace makVre
15{
16//! \brief Value transformation that linearly remaps values from one range to another
17//!
18//! This transform changes the range of input values by mapping them from an input range
19//! to an output range using linear interpolation. It's useful for normalizing or
20//! scaling values from hardware-specific ranges to standardized ranges.
22{
23public:
24 //! \brief Default constructor
25 //!
26 //! Initializes the remap ranges with default values
28
29 //! \brief Virtual destructor
30 virtual ~DtRemapValueTransform() override;
31
32 //! \brief Initialize the remap transform from configuration
33 //!
34 //! Reads the input and output range parameters from the configuration table.
35 //! Expected configuration parameters are:
36 //! - "InputMin": Minimum value of the input range
37 //! - "InputMax": Maximum value of the input range
38 //! - "OutputMin": Minimum value of the output range
39 //! - "OutputMax": Maximum value of the output range
40 //!
41 //! \param config Pointer to the configuration table
42 virtual void init(DtInitTable* config) override;
43
44 //! \brief Apply the remapping transformation to an input value
45 //!
46 //! Linearly remaps the input value from the input range to the output range.
47 //! Values outside the input range will be clamped to the output range boundaries.
48 //!
49 //! \param value The raw input value to transform
50 //! \return The remapped value in the output range
51 virtual float transform(float value) override;
52
53protected:
54 //! \brief Minimum value of the input range
56
57 //! \brief Maximum value of the input range
59
60 //! \brief Minimum value of the output range
62
63 //! \brief Maximum value of the output range
65
66 //! \brief Size of the input range (InputMax - InputMin)
67 //!
68 //! Pre-calculated for efficiency in the transform function
70
71 //! \brief Size of the output range (OutputMax - OutputMin)
72 //!
73 //! Pre-calculated for efficiency in the transform function
75};
76
77} // namespace makVre
Table-based access to Lua state for configuration data.
Definition initializer.h:38
float myInputMax
Maximum value of the input range.
Definition remapValueTransform.h:58
virtual void init(DtInitTable *config) override
Initialize the remap transform from configuration.
float myOutputMin
Minimum value of the output range.
Definition remapValueTransform.h:61
virtual float transform(float value) override
Apply the remapping transformation to an input value.
float myInputRange
Size of the input range (InputMax - InputMin)
Definition remapValueTransform.h:69
float myOutputMax
Maximum value of the output range.
Definition remapValueTransform.h:64
float myOutputRange
Size of the output range (OutputMax - OutputMin)
Definition remapValueTransform.h:74
virtual ~DtRemapValueTransform() override
Virtual destructor.
float myInputMin
Minimum value of the input range.
Definition remapValueTransform.h:55
DtRemapValueTransform()
Default constructor.
DtValueTransform()
Default constructor.
Definition valueTransform.h:27
Defines DLL export/import macros for the vreInput library.
#define VREINPUT_DLL
DLL export/import macro for the vreInput library.
Definition export.h:25
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
Abstract base class for input value transformation operations.