RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Editor AI TestsEditor AI VisualizationEditor – Assembly Spline ToolAsset BrowserAsset DeduplicatorAsset Management ToolSFX Previewer (Audio Events List)Audio Ribbon EditorAutoSaveBarriers EditorBiome ToolBuilding EditorBulk RenameCamera BookmarksCamera TransformCamera Path EditorCEF HelperCo-Simulation Signal EditorCrawl Data EditorCreate Object ToolDataBlock EditorDecal EditorDecal Spline EditorDocumentation HelperDrag Race EditorDrift Data EditorDrive Path EditorDynamic Decals Tool (Vehicle Livery Creator)Engine Audio DebugExtensions DebugExtensions EditorFFI Pointer Leak TestFile DialogFlowgraph EditorForest EditorForest ViewEditor Gizmo HelperEditor Ground Model Debug HelperEditor Headless Editor TestEditor Icon OverviewEditor ImGui C DemoEditor InspectorEditor Layout ManagerEditor Level SettingsEditor Level ValidatorEditor LoggerEditor Log HelperEditor MainEditor Main MenuEditor Main ToolbarEditor Main UpdateMap Sensor EditorMaster Spline EditorMaterial EditorMeasures Inspector HeaderMesh Editor (Base)Mesh Road EditorMesh Spline EditorMission EditorMission PlaybookMission Start Position EditorMulti Spawn Manager (Vehicle Groups)Navigation Mesh EditorEditor News MessageObject Tool (Object Select Edit Mode)Object To Spline EditorParticle EditorPerformance Profiler / Camera RecorderPhysics ReloaderPrefab Instance EditorEditor PreferencesRace / Path EditorRally EditorRaycast Test Editor ToolRenderer Components Editor ToolRender Test Editor ToolResource Checker Editor ToolRiver EditorRoad Architect EditorRoad DecorationsRoad Editor (Decal Road)Road Network ExporterRoad River Cache HandlerRoad River GUIRoad Spline EditorRoad Template EditorRoad UtilitiesScene TreeScene ViewScreenshot Creator BootstrapScript AI EditorScript AI ManagerSensor Configuration EditorSensor DebuggerShape EditorShortcut LegendSidewalk Spline EditorSites EditorSlot Traffic EditorSuspension Audio DebugTech Server ManagerTerraform ToolTerrain And Road ImporterTerrain EditorTerrain Materials EditorText EditorTool ManagerTool ShortcutsTraffic DebugTraffic ManagerTraffic Signals EditorUndo History ViewerVehicle Bridge TestVehicle Detail ViewerVehicle Editor MainEditor - VisualizationEditor Viz HelperEditor Water Object HelperEditor Windows Manager
Tool Utilities - Fit PolylineEditor Tool Utilities – GeometryEditor Tool Utilities – GizmoEditor Tool Utilities – Material Selection ManagerEditor Tool Utilities – Mesh Audition ManagerEditor Tool Utilities – Perlin NoiseEditor Tool Utilities – Polygon DrawingEditor Tool Utilities – Ramer-Douglas-PeuckerEditor RenderingEditor Tool Utilities – Ribbon InputEditor Tool Utilities – Riverbed TerraformingEditor Tool Utilities – Road Design StandardsEditor Tool Utilities – Simplex NoiseEditor Tool Utilities – Skeleton (Image Vectorisation)Editor Tool Utilities – Spline InputEditor Tool Utilities – Spline Mask ExportEditor Tool Utilities – StyleEditor Tool Utilities – Terrain PainterEditor Tool Utilities – Util

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 ReferenceGE ExtensionseditortoolUtilities

Editor Tool Utilities – Geometry

Comprehensive geometry utility library for spline-editing tools. Provides Catmull-Rom interpolation, Frenet frame computation, mouse-hit detection, vector math, polygon operations, and spline manipula

Comprehensive geometry utility library for spline-editing tools. Provides Catmull-Rom interpolation, Frenet frame computation, mouse-hit detection, vector math, polygon operations, and spline manipulation (split, join, flip, banking).


Public API

FunctionSignatureDescription
M.getPreRotQuats() → tableReturns pre-computed rotation quaternions (0°, 90°, 180°, 270°)
M.getBarScale() → numberReturns the bar-point scale factor (0.5)
M.squaredSegSegDist(a0, a1, b0, b1, outP1, outP2) → numberSquared distance between two line segments; writes closest points
M.isMouseOverNode(splines) → bool, splineIdx, nodeIdxTests if mouse ray intersects any spline node sphere
M.isMouseOverSpline(spline, mousePos) → bool, segIdx, hitPtTests if mouse is over a spline via Catmull-Rom sampling
M.isMouseOverPolyline(points, mousePos) → bool, segIdxTests if mouse is near a 2D polyline
M.isMouseOverRib(splines) → bool, splineIdx, ribIdxTests if mouse is over a rib handle sphere
M.isMouseOverBar(splines) → bool, splineIdx, barIdxTests if mouse is over a bar handle sphere
M.isMouseOverGraphNode(nodes) → bool, keyTests if mouse is over a navigation graph node
M.getAABB(points) → tableReturns axis-aligned bounding box {xMin,xMax,yMin,yMax}
M.computeSplinePolygon(spline, margin, polygon)Computes a polygonal outline from a spline with margin
M.isPointInTriangle(p, a, b, c) → boolBarycentric point-in-triangle test
M.getTerrainNormal(p) → vec3Returns terrain surface normal at world point
M.getTerrainNormalInPlace(p, out)In-place terrain normal computation
M.rotateVecAroundZ(vec, v, angle)Rotates vector around Z-axis in-place
M.rotateVecAroundAxis(v, k, theta) → vec3Rodrigues rotation around arbitrary axis
M.rotateVecAroundAxisInlined(v, k, theta, out) → vec3Non-allocating axis rotation
M.computeTurningRadius(p1, p2, p3) → numberCurvature radius from three points
M.isLineSegIntersect(a, b, c, d) → boolTests if two line segments intersect
M.intersection2LineSegs`(p1, p2, q1, q2, out) → vec3nil`
M.angleBetweenVecsNorm(a, b) → numberAngle between unit vectors (radians)
M.angleBetweenVecs(a, b) → numberAngle between arbitrary vectors
M.angleBetweenVecs2D(a, b) → numberAngle between vectors projected to XY plane
M.signedAngleBetweenVecs(a, b, axis) → numberSigned angle around axis (radians)
M.signedAngleAroundAxis(fromVec, toVec, axis) → numberSigned angle in degrees with plane projection
M.intersectsUpQuadBarycentric`(p, q) → numberfalse`
M.pointInQuadBarycentric(p, q) → boolTests if point is inside quadrilateral
M.computeSourcesAABB(sources) → tableAABB of source polyline collection
M.getAllQuadrilaterals(sources, margin) → tableBuilds quadrilaterals from sources with lateral margin
M.populateTreeQuads(quads) → kdtreeCreates kd-tree from quadrilaterals
M.splitSplineGeometry(nodes, widths, nmls, splitIdx) → nodes1, w1, n1, nodes2, w2, n2Splits spline at node index
M.splitLoopSplineGeometry(nodes, widths, nmls, splitIdx) → nodesNew, wNew, nNewSplits a loop spline, reordering geometry
M.joinSplineGeometry(n1, w1, nm1, idx1, n2, w2, nm2, idx2) → nodesNew, wNew, nNewJoins two spline geometries
M.flipSplineDirection(spline)Reverses spline node order in-place
M.closestRibbonSegPointToPoint(segIdx, ribbon, p) → vec3, distSqClosest point on a ribbon segment
M.getNodeSpansInsidePolygon(nodes, polygon) → tableReturns spans of nodes inside a polygon
M.projectPointToSpline(pos, spline) → proj, s, tProjects point onto spline; returns arc-length param
M.sampleSpline(divPts, tans, norms, spacing, ...) Uniform arc-length sampling of a spline
M.sampleSplineAdaptive(divPts, tans, norms, meshLen, ...)Curvature-adaptive spline sampling
M.translateSpline(pts, binormals, t, out)Offsets spline laterally along binormals
M.computeRandomJitterQuat_ZOnly(jitter, nml, outQuat) → quatRandom Z-axis jitter quaternion
M.computeRandomJitterQuat(spline, tgt, right, nml, outQuat) → quatComponent-wise random jitter quaternion
M.computeRandomJitterQuatFromFreedomAxes(spline, axes, outQuat) → quatJitter from freedom axes
M.updateRibPointsFree(spline)Recomputes rib points in free 3D space
M.updateRibPointsRaycast(spline)Recomputes rib points with terrain conforming
M.updateBarPoints(spline, isBarsLimits)Recomputes bar points from velocity data
M.updateBarPointsGraph(spline, graphData, isBarsLimit)Recomputes bar points for graph paths
M.computeSDF(mask) → tableSigned distance field from binary mask
M.getScanlineSpans(gMinY, gMaxY, te, tb, polygon, xMin, xMax, y)Scanline rasterisation of polygon
M.catmullRomCentripetalFast(p0, p1, p2, p3, t, s, out) → vec3Fast non-allocating centripetal Catmull-Rom
M.catmullRomNodesOnly(nodes, gran) → tableInterpolates nodes with Catmull-Rom
M.catmullRomNodesWidthsOnly(nodes, widths, gran, isLoop) → pts, wdsInterpolates nodes and widths
M.catmullRomNodesWidthsVelVelLimits(spline, gran) → pts, wds, vels, limsFull property interpolation
M.catmullRomRaycast(spline, minDiv, minSpacing)Catmull-Rom with vertical raycasting to terrain
M.catmullRomConformToTerrain(spline, minDiv)Catmull-Rom with terrain height conforming
M.catmullRomFree(spline, minDiv)Catmull-Rom in free 3D space with monotonic Z
M.catmullRomFreeWithBanking(spline, minDiv, bankStrength)Free Catmull-Rom with auto-banking
M.computeGraphPathFromNodes(spline)Populates spline geometry from nav graph path

Code Examples

local geom = require('editor/toolUtilities/geom')

-- Check if mouse is hovering over any spline node
local splines = { mySpline1, mySpline2 }
local isOver, sIdx, nIdx = geom.isMouseOverNode(splines)
if isOver then
  log('I', 'geom', 'Mouse over spline ' .. sIdx .. ', node ' .. nIdx)
end

-- Compute the AABB of a set of division points
local box = geom.getAABB(spline.divPoints)
log('I', 'geom', string.format('AABB: X[%.1f, %.1f] Y[%.1f, %.1f]',
  box.xMin, box.xMax, box.yMin, box.yMax))

-- Generate secondary geometry from nodes using Catmull-Rom with raycast
geom.catmullRomRaycast(mySpline)  -- populates divPoints, tangents, binormals, normals

-- Fast Catmull-Rom evaluation at a parameter
local out = vec3()
geom.catmullRomCentripetalFast(p0, p1, p2, p3, 0.5, 0.5, out)

-- Split a spline at node 5 into two halves
local n1, w1, nm1, n2, w2, nm2 = geom.splitSplineGeometry(
  spline.nodes, spline.widths, spline.nmls, 5)

-- Compute turning radius from three consecutive points
local radius = geom.computeTurningRadius(nodes[3], nodes[4], nodes[5])

-- Project a world point onto a spline, get arc-length parameter
local proj, s, t = geom.projectPointToSpline(worldPos, spline)
if proj then
  log('I', 'geom', string.format('Projected at s=%.3f, lateral t=%.3f', s, t))
end

-- Compute spline polygon outline for scanline operations
local polygon = {}
geom.computeSplinePolygon(spline, 5.0, polygon)

-- Update rib points with terrain conforming
geom.updateRibPointsRaycast(spline)

-- Update bar points from velocity data
geom.updateBarPoints(spline, false)  -- false = use vels, true = use velLimits

-- Adaptive sampling along a spline (denser at high curvature)
local posns, tans, normals, scales = {}, {}, {}, {}
geom.sampleSplineAdaptive(spline.divPoints, spline.tangents, spline.normals,
  meshLength, posns, tans, normals, scales)

-- Compute auto-banking with Catmull-Rom
geom.catmullRomFreeWithBanking(spline, 10, 0.8)

-- Populate nav graph path from selected graph nodes
geom.computeGraphPathFromNodes(spline)

See Also

  • Tool Utilities - Fit Polyline - Related reference
  • Editor Tool Utilities – Gizmo - Related reference
  • Editor Tool Utilities – Material Selection Manager - Related reference
  • World Editor Guide - Guide

Tool Utilities - Fit Polyline

Fits a polyline to an unordered set of points by finding the optimal traversal order that maximises path smoothness and minimises distance.

Editor Tool Utilities – Gizmo

Utility module for managing the editor axis gizmo (translate/rotate) for spline-editing tools. Handles drag callbacks, undo/redo integration, and local/world alignment switching.

On this page

Public APICode ExamplesSee Also