Function JobRVO.LinearProgram3D
Finds the velocity with the smallest maximum penetration into the given half-planes.
void LinearProgram3D (
NativeArray<ORCALine> | lines | The half-planes of all obstacles and agents. |
int | numLines | The number of half-planes in lines. |
int | numFixedLines | The number of half-planes in lines which are fixed (0..numFixedLines). These will be treated as static obstacles which should be avoided at all costs. |
int | beginLine | The index of the first half-plane in lines for which the previous optimization failed (see LinearProgram2Output.firstFailedLineIndex). |
float | radius | Maximum possible speed. This represents a circular velocity obstacle. |
ref float2 | result | Input is best velocity as output by LinearProgram2D. Output is the new best velocity. The velocity with the smallest maximum penetration into the given half-planes. |
NativeArray<ORCALine> | scratchBuffer | A buffer of length at least numLines to use for scratch space. |
Finds the velocity with the smallest maximum penetration into the given half-planes.
Assumes there are no points in the feasible region of the given half-planes.
Runs a 3-dimensional linear program, but projected down to 2D. If there are no feasible regions outside all half-planes then we want to find the velocity for which the maximum penetration into infeasible regions is minimized. Conceptually we can solve this by taking our half-planes, and moving them outwards at a fixed speed until there is exactly 1 feasible point. We can formulate this in 3D space by thinking of the half-planes in 3D (velocity.x, velocity.y, penetration-depth) space, as sloped planes. Moving the planes outwards then corresponds to decreasing the z coordinate. In 3D space we want to find the point above all planes with the lowest z coordinate. We do this by going through each plane and testing if it is possible that this plane is the one with the maximum penetration. If so, we know that the point will lie on the portion of that plane bounded by the intersections with the other planes. We generate projected half-planes which represent the intersections with the other 3D planes, and then we run a new optimization to find the point which penetrates this half-plane the least.