VR-Forces 5.1 Lua Function Documentation

pathUtil

(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)

pathUtil is a collection of utility functions that help with path planning and ground-clamping points on a route. To use, require this file and refer to the module in the function calls:
local pathUtil = require "pathUtil"
airRoute = pathUtil.pathUtilMakeAirRoute(rawRoute, ...

Function List

pathUtilMakeAirRoute (points, offset) Given points, intersect each segment with the terrain.
pathUtilMakePointsClampedToTerrain (points, offset, clampFirst, clampLast) Clamp the points to the terrain, using the given offset.
pathUtilReducePoints (points, thresholdMeters, interpolateFlag) Reduce Path Vertices.
printPointsToConsole (printFcn, points) Print points to vrf object console


Functions

pathUtilMakeAirRoute (points, offset)
Given points, intersect each segment with the terrain. If the segment is blocked, insert a new point clamped to offset above terrain.

Parameters:

  • points: is a table of Location3D
  • offset: is a double indicating a height to raise the points above the terrain.

Return value:

    a table of Location3D describing the new route. Returns boolean flag indicating that terrain was available and the operation was completed. If the operation was not completed, repeat it in a subsequent call.
pathUtilMakePointsClampedToTerrain (points, offset, clampFirst, clampLast)
Clamp the points to the terrain, using the given offset. Given a set of points and an offset, intersect the terrain and set the Altitude component of each point at the terrain altitude + offset. Note that altitude will correspond to the first intersection with the terrain at that location, irrespective of surface (water, rooftop, etc.) Returns new table of points, and boolean "true" to indicate that all the points were clamped. Caller might have to repeat calls to this to get a complete answer, because terrain tiles might not be finished loading. Input: points offset Output: new points flag indicating all points clamped

Parameters:

  • points:
  • offset:
  • clampFirst:
  • clampLast:
pathUtilReducePoints (points, thresholdMeters, interpolateFlag)
Reduce Path Vertices.

Parameters:

  • points: A table of Location3Ds
  • thresholdMeters: A number indicating the minimum distance desired between points.
  • interpolateFlag: boolean

Return value:

    Table of Location3D that is the input list after removing those that are too close together
printPointsToConsole (printFcn, points)
Print points to vrf object console

Parameters:

  • printFcn: print function (from vrfutil.lua): printDebug, printVerbose, printInfo, printWarn, or printError
  • points: A table of Location3Ds

Copyright© 2024 MAK Technologies, Inc. All rights reserved.