Path 1.0
ShortestPath Class Reference

This class implements the anisotropic shortest path algorithm. More...

#include <shortestpath.h>

Inheritance diagram for ShortestPath:
ShortestPathVirtual Array2 Box2

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.
 
- Public Member Functions inherited from ShortestPathVirtual
 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.
 
- Protected Attributes inherited from ShortestPathVirtual
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 Public Attributes inherited from ShortestPathVirtual
static int callUpdateNodeSurface = 0
 Number of calls to update.
 
- Protected Member Functions inherited from ShortestPathVirtual
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.
 

Detailed Description

This class implements the anisotropic shortest path algorithm.

The graph is implemented as an array of nodes implicitly connected together according to connectivity masks.

Constructor & Destructor Documentation

◆ ShortestPath()

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.

Parameters
sSize of the discretization
versionSize of the neighborhood surface mask, note that 0 refers to 1 neighborhood with 4-connexity.
widthWidth of the array of nodes.
heightHeight of the array of nodes.
niaNumber of angle layers.

◆ ~ShortestPath()

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.

Member Function Documentation

◆ CreateImage()

QImage ShortestPath::CreateImage ( ) const

Creates an image representing the domain explored by the search algorithm.

Parameters
sizeThe maximum dimension of the image.
imageThe generated image.
gridColor
levelColor

◆ GetCost()

double ShortestPath::GetCost ( ) const

This function returns the cost to reach the target point.

It should be called after ShortestPath::Process().

◆ 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.

◆ setCoef()

void ShortestPath::setCoef ( int surfaceCoef,
bool astar )

Initialization of the shortest path coefficients and flags.

Parameters
orientationBoolean for checking curvature.
orientationCoefWeighting coefficient for curvature.

The documentation for this class was generated from the following files: