spatialUtil
(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)
Functions that compute things in space using points, vectors, etc.
To use functions in this package, reference spatialUtil, e.g. spatialUtil.fn(arg). For example,
spatialUtil = require "spatialUtil"
a, b, c, d, e, f = spatialUtil.cscManeuver(u, v, w, x, y)
Function List
| cscAsymmetricManeuver (initialPosition, initialHeading, firstRadius, finalPosition, finalHeading, secondRadius) | Determines the parameters of the shortest circle-segment-circle (CSC) path from one point and heading to a second point and heading, given a minimum turn radius. |
| cscManeuver (initialPosition, initialHeading, finalPosition, finalHeading, radius) | Determines the parameters of the shortest circle-segment-circle (CSC) path, with the first and second circles having the same radius. |
Functions
- cscAsymmetricManeuver (initialPosition, initialHeading, firstRadius, finalPosition, finalHeading, secondRadius)
-
Determines the parameters of the shortest circle-segment-circle (CSC) path from one point and heading to a second point and heading, given a minimum turn radius. A CSC path is a path that starts with a turn of constant radius (i.e., an arc of a circle) either right or left, followed by a straight path segment, followed by a second turn (right or left) of constant radius. Given that an entity is using the smallest turn radius available to it, this type of path is the shortest possible path to go from one position and heading to a second position and heading.
This function assumes a 2D world, so the altitude components of the input parameters are ignored. The altitude of the output is undefined.
Parameters:
-
initialPosition: A location3D of the initial position. -
initialHeading: An angle in radians representing the initial heading. -
firstRadius: The radius of the first circle in the maneuver. -
finalPosition: A location3D of the goal position. -
finalHeading: An angle in radians representing the goal heading. -
secondRadius: The radius of the second circle in the maneuver.
Return values:
- A boolean that is true if the first turn is to the left, and false if it is to the right.
- A number indicating the heading at which the path leaves the first circle.
- A location3D of the end of the straight segment, when the path starts the second circle.
- A boolean that is true if the second turn is to the left, and false if it is to the right.
- A number which is the path length.
- A boolean that is true if there is an error. If there is an error, the other return values will be undefined.
-
- cscManeuver (initialPosition, initialHeading, finalPosition, finalHeading, radius)
-
Determines the parameters of the shortest circle-segment-circle (CSC) path, with the first and second circles having the same radius. See cscAsymmetricManeuver for parameter documentation.
Parameters:
-
initialPosition: -
initialHeading: -
finalPosition: -
finalHeading: -
radius: The radius of both circles.
-
