17 namespace SpatialStructures {
34 namespace Pathfinding {
168 const std::string & cost_type =
""
274 std::vector<HF::SpatialStructures::Path>
FindPaths(
276 const std::vector<int> & start_points,
277 const std::vector<int> & end_points
393 const std::vector<int>& start_points,
394 const std::vector<int>& end_points,
426 int arr_count = pow(
size, 2);
427 dist =
new std::vector<float>(arr_count, -1);
428 pred =
new std::vector<int>(arr_count, -1);
441 assert(i >= 0 && i <
size);
455 assert(i >= 0 && i <
size);
622 const int num_nodes = dist_pred.
size;
625 std::string dist_string =
"[";
626 std::string pred_string =
"[";
630 for (
int row = 0; row < num_nodes; row++) {
637 for (
int col = 0; col < num_nodes; col++) {
640 const float dist_value = dist_row[col];
641 const int pred_value = pred_row[col];
644 dist_string += std::to_string(dist_value);
645 pred_string += std::to_string(pred_value);
648 if (!(row == num_nodes-1 && col == num_nodes-1)) {
660 os << dist_string << std::endl << pred_string;
std::ostream & operator<<(std::ostream &os, HF::Pathfinding::DistanceAndPredecessor &dist_pred)
An overload to print HF::Pathfinding::DistanceAndPredecessor when passed to cout .
Perform human scale analysis on 3D environments.
vector< Path > FindPaths(BoostGraph *bg, const vector< int > &start_points, const vector< int > &end_points)
Find a path from every id in start_ids to the matching end node in end_ids.
void InsertPathsIntoArray(const BoostGraph *bg, const std::vector< int > &start_points, const std::vector< int > &end_points, HF::SpatialStructures::Path **out_paths, HF::SpatialStructures::PathMember **out_path_members, int *out_sizes)
A special version of FindPaths optimized for the C_Interface.
Path FindPath(BoostGraph *bg, int start_id, int end_id)
Find a path between points A and B using Dijkstra's Shortest Path algorithm.
void InsertAllToAllPathsIntoArray(BoostGraph *bg, Path **out_paths, PathMember **out_path_members, int *out_sizes)
A special version of FindPaths optimized for the C_Interface, such that all paths possible from each ...
DistanceAndPredecessor GenerateDistanceAndPred(const BoostGraph &bg)
Generate the distance and predecessor matricies for a specific boost graph.
std::vector< HF::SpatialStructures::Path > FindAllPaths(BoostGraph *bg)
Find a path from every node to every node (NOTE: Not implemented yet.)
std::unique_ptr< BoostGraph, BoostGraphDeleter > CreateBoostGraph(const Graph &g, const std::string &cost_type)
Create a new boost graph from a HF::SpatialStructures:Graph.
A graph usable with the BoostGraphLibrary.
Deleter for the BoostGraph.
void operator()(BoostGraph *bg) const
Delete a boost graph.
Holds and maintains a distance and predecessor matrix.
std::vector< int > * pred
int * GetRowOfPred(int i)
Get a pointer to the beginning of the ith row of the predecessor array.
float * GetRowOfDist(int i)
Get a pointer to the beginning of the ith row of the distance array.
DistanceAndPredecessor(int size)
Create and allocate a pair of distance and predecessor arrays.
std::vector< float > * dist
int size
Number of rows and colums.
A Graph of nodes connected by edges that supports both integers and HF::SpatialStructures::Node.
The ID of a node, and the cost cost to the node after it.
A collection of nodes that form a path.