Path 1.0
|
This class implements the anisotropic shortest path algorithm. More...
#include <shortestpath.h>
Public Member Functions | |
ShortestPath (const LayerStack &, int, int, int, int, Cost) | |
<FONT COLOR="229922"><B>Ok</B></FONT> Creates a structure to compute the shortest path between two points. | |
~ShortestPath () | |
Destructor. | |
void | setCoef (int, bool) |
Initialization of the shortest path coefficients and flags. | |
QVector< QPoint > | Process (int, int, int, int, bool stochastic=false, int sample=100, bool=false) |
Compute the shortest path connecting two nodes in the implicit graph. | |
void | Explore (int, int, bool stochastic=false, int sample=100) |
<FONT COLOR="229922"><B>Ok</B></FONT> Computes the shortest path connecting two nodes in the implicit graph. This function returns a list of integer points representing the nodes of the implicit graph that belong to the trajectory. This list of nodes should be converted to a list of anchor points using SceneAll::Convert to get the real position of the trajectory. | |
void | ExploreNTowns (int, int, QVector< QPoint > &, int, bool, int) |
<FONT COLOR="AA2222"><B>Warning</B></FONT> | |
QImage | ExploreNPoints (int, int, int) |
<FONT COLOR="AA2222"><B>Warning</B></FONT> | |
QImage | CreateImage () const |
Creates an image representing the domain explored by the search algorithm. | |
double | GetCost () const |
This function returns the cost to reach the target point. | |
![]() | |
ShortestPathVirtual (const Box2 &, int, int) | |
Create the shortest path layout. | |
void | EnableBridge (int, int, int) |
Enable bridges. | |
void | EnableTunnel (int, int, int) |
Enable tunnels. | |
void | EnableAngle (int) |
Enable angle. | |
Protected Attributes | |
Cost | slopecost |
Slope function cost. | |
const LayerStack & | layered |
Reference to terrain model. | |
int | y1 |
Initial point. | |
int | y2 |
Final point. | |
QVector< GraphNode > | graph |
Array of nodes for computing the shortest path. | |
QVector< NodeStack > | stack |
Priority stack. | |
int | indexa |
Index of the first entry in the stack of nodes that has not been visited. | |
int | indexb |
Index of the first entry with infinite cost. | |
![]() | |
int | nia |
Number of angle layers. | |
int | m_uumask |
Size of the neighborhood mask. | |
bool | m_bridge |
Bridge flag. | |
bool | m_tunnel |
Tunnel flag. | |
ScalarField2 | roadValue |
Roads. | |
Additional Inherited Members | |
![]() | |
static int | callUpdateNodeSurface = 0 |
Number of calls to update. | |
![]() | |
int | Index (int, int, int) const |
Computes the memory index of a node characterized with its (x,y,a) coordinates. | |
int | Index (int, int) const |
Computes the memory index of a node characterized with its coordinates. | |
This class implements the anisotropic shortest path algorithm.
The graph is implemented as an array of nodes implicitly connected together according to connectivity masks.
ShortestPath::ShortestPath | ( | const LayerStack & | sceneRoute, |
int | version, | ||
int | width, | ||
int | height, | ||
int | nia, | ||
Cost | cost ) |
<FONT COLOR="229922"><B>Ok</B></FONT> Creates a structure to compute the shortest path between two points.
By default the bridge, tunnel and forest options are disabled.
s | Size of the discretization |
version | Size of the neighborhood surface mask, note that 0 refers to 1 neighborhood with 4-connexity. |
width | Width of the array of nodes. |
height | Height of the array of nodes. |
nia | Number of angle layers. |
ShortestPath::~ShortestPath | ( | ) |
Destructor.
Destroys the array of nodes of the graph and the priority stack. This is done implicitly as the graph is stored in a QVector.
QImage ShortestPath::CreateImage | ( | ) | const |
Creates an image representing the domain explored by the search algorithm.
size | The maximum dimension of the image. |
image | The generated image. |
grid | Color |
level | Color |
double ShortestPath::GetCost | ( | ) | const |
This function returns the cost to reach the target point.
It should be called after ShortestPath::Process().
QVector< QPoint > ShortestPath::Process | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2, | ||
bool | stochastic = false, | ||
int | samples = 100, | ||
bool | exportImages = false ) |
Compute the shortest path connecting two nodes in the implicit graph.
This function returns a list of integer points representing the nodes of the implicit graph that belong to the trajectory. This list of nodes should be converted to a list of anchor points using SceneAll::Convert to get the real position of the trajectory in world space.
void ShortestPath::setCoef | ( | int | surfaceCoef, |
bool | astar ) |
Initialization of the shortest path coefficients and flags.
orientation | Boolean for checking curvature. |
orientationCoef | Weighting coefficient for curvature. |