PathEngine home previous: iPathEngine::pathfindPreprocessVersionIsCompatible()next: iPathEngine::refOwnershipGraphRoot()
Contents, API Reference, Interfaces, iPathEngine, preExpandObstacles

iPathEngine::preExpandObstacles()

Description

Pre-expands and combines a set of convex 2D obstacles, with optional boundary optimisation.

Syntax

std::unique_ptr<iExpanded2DObstacles> preExpandObstacles(int32_t originX, int32_t originY, int32_t const * obstacles_Buffer, uint32_t obstacles_BufferEntries, const iShape& shape, bool optimise, int32_t optimiseHorizontalRange)

Parameters

originX The x coordinate for a world origin for the obstacles.
originY The y coordinate for a world origin for the obstacles.
obstacles_Buffer, obstacles_BufferEntries (See Passing Arrays.) A buffer with information about the obstacles to pre-expand.
shape The shape to expand by.
optimise Controls whether or not a boundary optimisation step is applied to the expanded obstacles.
optimiseHorizontalRange Maximum horizontal range to be applied during boundary optimisation.

Return Value

A newly created Interface iExpanded2DObstacles object.

Remarks

If the input data is not valid then a fatal error should be emitted by PathEngine (followed by undefined behaviour ,if the error handler returns, which may include a crash).

The first value in the obstacle data specifies the number of obstacles being passed in. After that the number of points in each obstacle should be supplied, following by coordinate data (x,y pairs, relative to the world origin) for each obstacle point.

The points for each obstacle must form a convex polygon that goes clockwise around the obstructed area, subject to the same constraints as on coordinate data being pass in to the iMesh placeLargeStatic2DObstacle() method.

The obstacles may overlap one another. (In fact, a key purpose of Interface iExpanded2DObstacles is to enable the cost of processing a whole bunch of obstacle which potentially overlap or form nearly linear boundaries to be taken up front, and the resulting boundaries re-used.)

So, for example, the following boundary data includes two rectangular obstacles, which overlap and actually form one larger square.

const int32_t boundaryData[] = {
          2,
          4, 0,0, 0,100, 50,100, 50,0,
          5, 50,0, 40,50, 50,100, 100,100, 100,0
          };

This decomposes as:

An optional boundary optimisation phase is included, similar to the optional boundary optimisation step in unobstructed space generation.

As with that unobstructed space optimisation step, the amount of optimisation is constrolled by a maximum horizontal range between removed vertices and resulting optimised boundaries.

As with unobstructed space optimisation, there are restrictions on the maximum permitted range, depending on the agent shape being used for expansion.

C# Mapping

Expanded2DObstacles preExpandObstacles(int originX, int originY, int[] obstacles, Shape shape, bool optimise, int optimiseHorizontalRange);

Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: iPathEngine::refOwnershipGraphRoot()