Module laneutil

Module for lane handling

Functions

laneNetwork (lType) Constructor returning laneNetworkInstance
nodeHandler (laneBuilder) Constructor returning nodeHandlerInstance

Tables

networkEdgeData Edge data as a table, changes here will not affect the actual edge

Class networkNodeInstance

networkNodeInstance:setSnap (value) Set if this node may be a snapNode or not
networkNodeInstance:getSnap () Return if this node may be a snapNode
networkNodeInstance:setRemovable (value) Set if this node may be removed when using subNetworkInstance:reduceEdges
networkNodeInstance:getRemovable () Return if this node may be removed

Class networkEdgeInstance

networkEdgeInstance:addTerminal (t) Link a terminal id to this edge
networkEdgeInstance:addObject (obj) Add an edgeObject to this edge
networkEdgeInstance:fromTable (tab) Set table-type edge info based on the given table (using the respective internal functions)
networkEdgeInstance:getConnectedEdge ([index[, hasTerminal=false]]) Get edge that is connected with this edge at the given index (or the first valid connected edge), optionally checking for existing terminals
networkEdgeInstance:extend ([index]) Extend edge as much as possible to given side (or both sides if index is omitted)
networkEdgeInstance:split ([factor=0.5]) Split edge into two new edges with half length or lengths factor*length and (1-factor)*length
networkEdgeInstance:getNodes (edges, snapNodes[, createTerminals=true]) Write edge informations to the format required by the game, optionally not writing the terminal data

Class subNetworkInstance

subNetworkInstance:addLane (v1, t1, v2, t2) Add a edge between the given points using tangents
subNetworkInstance:addStraight (v1, v2) Add a straight edge between the given points
subNetworkInstance:reduceEdges (parent) Create a new network by merging as much edges as possible
subNetworkInstance:export () Returns a edgeList representing this network, which can be used in the edgeLists table of a construction.

Class laneNetworkInstance

laneNetworkInstance:get (fileName, params) Get subNetwork for the filename and given params (will be created, if it doesn't exist)
laneNetworkInstance:getByID (id) Get existing subNetwork by id
laneNetworkInstance:createNode (v, t) Create a new node
laneNetworkInstance:reduce () Create a new laneNetwork with reduced number of nodes (edges are combined if possible)

Class connectionNodeInstance

connectionNodeInstance:setAngle (a) Set max connection angle for this node
connectionNodeInstance:setDist (d) Set max connection distance for this node
connectionNodeInstance:setModule (m) Link the node to a module index

Class nodeHandlerInstance

nodeHandlerInstance:addNode (v, t, mID[, dist=100[, angle=2.3562]]) Create or update a node with the given position and tangent, optionally setting its connection params
nodeHandlerInstance:export (models) Export the best connections as models


Functions

laneNetwork (lType)
Constructor returning laneNetworkInstance

Parameters:

  • lType string base lane type (TRACK or ROAD)

Returns:

    laneNetworkInstance
nodeHandler (laneBuilder)
Constructor returning nodeHandlerInstance

Parameters:

  • laneBuilder function function to create the lane models based on the end nodes

Returns:

    nodeHandlerInstance

Tables

networkEdgeData
Edge data as a table, changes here will not affect the actual edge

Fields:

Class networkNodeInstance

Node class for track/street networks, derived from laneutil.nodeutil.nodeInstance
networkNodeInstance:setSnap (value)
Set if this node may be a snapNode or not

Parameters:

  • value boolean
networkNodeInstance:getSnap ()
Return if this node may be a snapNode

Returns:

    bool isSnap
networkNodeInstance:setRemovable (value)
Set if this node may be removed when using subNetworkInstance:reduceEdges

Parameters:

  • value boolean
networkNodeInstance:getRemovable ()
Return if this node may be removed

Returns:

    bool removable

Class networkEdgeInstance

Edge class for track/street networks, derived from edgeInstance
networkEdgeInstance:addTerminal (t)
Link a terminal id to this edge

Parameters:

  • t number terminalID
networkEdgeInstance:addObject (obj)
Add an edgeObject to this edge

Parameters:

networkEdgeInstance:fromTable (tab)
Set table-type edge info based on the given table (using the respective internal functions)

Parameters:

networkEdgeInstance:getConnectedEdge ([index[, hasTerminal=false]])
Get edge that is connected with this edge at the given index (or the first valid connected edge), optionally checking for existing terminals

Parameters:

  • index number which side of the edge should be looked at (1: first node; 2: last node) (optional)
  • hasTerminal boolean only return edges that have terminals (default false)

Returns:

    optional networkEdgeInstance
networkEdgeInstance:extend ([index])
Extend edge as much as possible to given side (or both sides if index is omitted)

Parameters:

  • index number to which side the edge should be extended (nil: both sides; 1: previous edges; 2: next edges) (optional)

Returns:

    networkEdgeData
networkEdgeInstance:split ([factor=0.5])
Split edge into two new edges with half length or lengths factor*length and (1-factor)*length

Parameters:

  • factor number (default 0.5)

Returns:

  1. networkEdgeInstance
  2. networkEdgeInstance
networkEdgeInstance:getNodes (edges, snapNodes[, createTerminals=true])
Write edge informations to the format required by the game, optionally not writing the terminal data

Parameters:

  • edges table
  • snapNodes table
  • createTerminals boolean (default true)

Class subNetworkInstance

Subnetwork defined by the track/street params
subNetworkInstance:addLane (v1, t1, v2, t2)
Add a edge between the given points using tangents

Parameters:

  • v1 vec3
  • t1 vec3
  • v2 vec3
  • t2 vec3

Returns:

    networkEdgeInstance
subNetworkInstance:addStraight (v1, v2)
Add a straight edge between the given points

Parameters:

  • v1 vec3
  • v2 vec3

Returns:

    networkEdgeInstance
subNetworkInstance:reduceEdges (parent)
Create a new network by merging as much edges as possible

Parameters:

Returns:

    subNetworkInstance the reduced network
subNetworkInstance:export ()
Returns a edgeList representing this network, which can be used in the edgeLists table of a construction. May contain additional information about terminals, edgeObjects, etc.

Returns:

    table

Class laneNetworkInstance

Network constructor for outside use. You should at most have one for all tracks and one for all streets, otherwise snapNodes may not be correct
laneNetworkInstance:get (fileName, params)
Get subNetwork for the filename and given params (will be created, if it doesn't exist)

Parameters:

  • fileName string name of the track/road definition file
  • params table additional edge params (catenary, tunnel/bridge, etc.)

Returns:

    subNetworkInstance
laneNetworkInstance:getByID (id)
Get existing subNetwork by id

Parameters:

Returns:

    subNetworkInstance
laneNetworkInstance:createNode (v, t)
Create a new node

Parameters:

  • v vec3 node position
  • t vec3 node tangent (only direction is imported, length will be calculated by the script)

Returns:

    networkNodeInstance
laneNetworkInstance:reduce ()
Create a new laneNetwork with reduced number of nodes (edges are combined if possible)

Returns:

    laneNetworkInstance

Class connectionNodeInstance

Node class for inter model connections, derived from laneutil.nodeutil.nodeInstance
connectionNodeInstance:setAngle (a)
Set max connection angle for this node

Parameters:

  • a number
connectionNodeInstance:setDist (d)
Set max connection distance for this node

Parameters:

  • d number
connectionNodeInstance:setModule (m)
Link the node to a module index

Parameters:

  • m number

Class nodeHandlerInstance

Class to handle inter model connections
nodeHandlerInstance:addNode (v, t, mID[, dist=100[, angle=2.3562]])
Create or update a node with the given position and tangent, optionally setting its connection params

Parameters:

  • v vec3 node position
  • t vec3 node direction(tangent)
  • mID number ID of module this node belongs to (we don't want the script to connect two nodes in the same module)
  • dist number max connection distance (default 100)
  • angle number max connection angle (default 2.3562)

Returns:

    connectionNodeInstance
nodeHandlerInstance:export (models)
Export the best connections as models

Parameters:

generated by LDoc 1.4.6 Last updated 2018-11-09 12:08:57