PathEngine home previous: Tokenised XMLnext: Obstacle Placement
Contents, Programmers Guide, World Representation, PathEngine Coordinates

PathEngine Coordinates

For the pathengine coordinate system the X and Y axes are horizontal with X going to the right of Y as seen from above. The Z axis is used for height, with Z increasing upwards.

An integer representation is used for X and Y components of position, for a number of reasons.
(See Why Integer Coordinates?, for an in-depth treatment of this issue.)
Floating point representation is used for the Z component.

PathEngine currently supports X and Y coordinates in the range -1500000 to 1500000.

Choosing a unit for PathEngine coordinates

Because of the integer representation for horizontal coordinates, the choice of unit for these coordinates can be fairly key.
Smaller units offer more precision, whereas larger units give you more range for representing the pathfinding environment.

PathEngine provides methods to support extra precision components (and to deal robustly with approximation) when advancing along paths, so smooth movement can be assured regardless of the unit chosen.
But when an agent stops and needs to repath they will be placed at a position on the integer grid, and obstacle origins and vertices are always placed on this grid.

A 1 centimeter unit seems to be a common choice, giving a representable range of 30 kilometres whilst keeping a reasonable amount of precision for agent and obstacle positioning.
For applications where this kind of range is definitely not required, 1 millimetre units would allow a bit more precision.

When working with extremely large worlds, where more than 30 kilometres of range is required, it will probably be necessary to split these worlds into chunks.
In this case each chunk can have a local origin and so the coordinate range only applies per chunk.
(There are various techniques for then implementing pathfinding across these chunks so as to achieve seamless pathfinding and movement across the world as a whole.)

Using different units for PathEngine and application world coordinates

It is not absolutely necessary for PathEngine coordinates to be identical to the unit for application-side world coordinates.
There should usually be only be a relatively small number of places where application world coordinates are converted to PathEngine ground positions, or back from ground positions to world coordinates, and it is usually straightforward to include scaling and / or translation at this point, if necessary.


Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: Obstacle Placement