RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Debug DrawingGPU Mesh StructsImGui FFIMath Structs (FFI)FFI C DefinitionsPID ControllersCSV LibraryDelay LineDequeDevelopment UtilitiesEvent ReferenceExtension SystemSignal FiltersGraph PathfindingUI BridgeInput Filter Constants2D Bilinear InterpolationIntrospectionJBeam Pretty PrinterJSON AST ParserSJSON ParserJSON Debug ParserJSON Pretty PrinterK-D Tree (2D Boxes)K-D Tree (3D)K-D Tree (3D)Lua SerializerC++/Lua BindingLua CoreLua ProfilerMath LibraryParticlesQuadtreeSettingsTCP ServerTimer SchedulerUtility Library

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API Referencecommon

2D Bilinear Interpolation

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 coordinate
    • y - 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)

See Also

  • cdefDebugDraw Reference - Related reference
  • cdefGpuMesh Reference - Related reference
  • cdefImgui Reference - Related reference
  • Common Libraries Overview - Guide

Input Filter Constants

Module defined in `lua/common/inputFilters.lua`. Defines global constants for input filter types used to classify input device sources.

Introspection

Module defined in `lua/common/introspection.lua`. Gathers method information from all globally registered classes and built-in modules for runtime reflection.

On this page

ExportsFunctionsinterpolatedMap.new(interpolationMethod)Instance Methodsmap:loadData(inputData)map:get(x, y)map:reset()Instance Fieldsmap.clampToDataRangeInternal NotesSee Also