interpolatedMap Reference
Module defined in `lua/common/interpolatedMap.lua`. Provides 2D bilinear interpolation on structured data maps. Useful for looking up values in 2D tables like torque curves, gear ratio maps, etc.
Module defined in lua/common/interpolatedMap.lua. Provides 2D bilinear interpolation on structured data maps. Useful for looking up values in 2D tables like torque curves, gear ratio maps, etc.
Exports
Functions
interpolatedMap.new(interpolationMethod)
Creates a new 2D interpolated map instance.
- Parameters:
interpolationMethod- any - Currently unused (only bilinear is implemented)
- Returns: table - An interpolated map object
Instance Methods
map:loadData(inputData)
Loads a 2D data table in jbeam-style format. First row is X axis headers; subsequent rows have Y axis value as first element, then data values.
- Parameters:
inputData- table - 2D array in jbeam format (see example below)
Example input format:
{
{0, 0.5, 1}, -- X axis: [0, 0.5, 1]
{0, 0.5, 1, 1}, -- Y=0: values at each X
{7, 0.4, 0.9, 1}, -- Y=7: values at each X
{14, 0.3, 0.8, 1}, -- Y=14: values at each X
}map:get(x, y)
Returns the bilinearly interpolated value at coordinates (x, y).
- Parameters:
x- number - X coordinatey- number - Y coordinate
- Returns: number|nil - Interpolated value, or nil if out of range and clamping is disabled
map:reset()
Placeholder for future reset functionality (currently a no-op).
Instance Fields
map.clampToDataRange
- Type: boolean (default: false)
- Description: When true, out-of-range coordinates are clamped to the data bounds instead of returning nil
Internal Notes
- If the first row has the same length as the second row, the first element of row 1 is treated as a label and stripped
- Bilinear interpolation uses the standard formula from x-engineer.org
- Cache and precision options are planned but not yet implemented (TODO)
inputFilters Reference
Module defined in `lua/common/inputFilters.lua`. Defines global constants for input filter types used to classify input device sources.
introspection Reference
Module defined in `lua/common/introspection.lua`. Gathers method information from all globally registered classes and built-in modules for runtime reflection.