diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenlib/BLI_astar.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenlib/BLI_astar.h')
-rw-r--r-- | source/blender/blenlib/BLI_astar.h | 84 |
1 files changed, 48 insertions, 36 deletions
diff --git a/source/blender/blenlib/BLI_astar.h b/source/blender/blenlib/BLI_astar.h index 94a5b6e5d11..320c450a78a 100644 --- a/source/blender/blenlib/BLI_astar.h +++ b/source/blender/blenlib/BLI_astar.h @@ -32,53 +32,58 @@ /* -------------------------------------------------------------------- */ typedef struct BLI_AStarGNLink { - int nodes[2]; - float cost; + int nodes[2]; + float cost; - void *custom_data; + void *custom_data; } BLI_AStarGNLink; typedef struct BLI_AStarGNode { - struct ListBase neighbor_links; + struct ListBase neighbor_links; - void *custom_data; + void *custom_data; } BLI_AStarGNode; typedef struct BLI_AStarSolution { - /* Final 'most useful' data. */ - /** Number of steps (i.e. walked links) in path - * (nodes num, including start and end, is steps + 1). */ - int steps; - /** Store the path, in reversed order (from destination to source node), as indices. */ - int *prev_nodes; - /** Indices are nodes' ones, as prev_nodes, but they map to relevant link. */ - BLI_AStarGNLink **prev_links; - - void *custom_data; - - /* Mostly runtime data. */ - BLI_bitmap *done_nodes; - float *g_costs; - int *g_steps; - - struct MemArena *mem; /* Memory arena. */ + /* Final 'most useful' data. */ + /** Number of steps (i.e. walked links) in path + * (nodes num, including start and end, is steps + 1). */ + int steps; + /** Store the path, in reversed order (from destination to source node), as indices. */ + int *prev_nodes; + /** Indices are nodes' ones, as prev_nodes, but they map to relevant link. */ + BLI_AStarGNLink **prev_links; + + void *custom_data; + + /* Mostly runtime data. */ + BLI_bitmap *done_nodes; + float *g_costs; + int *g_steps; + + struct MemArena *mem; /* Memory arena. */ } BLI_AStarSolution; typedef struct BLI_AStarGraph { - int node_num; - BLI_AStarGNode *nodes; + int node_num; + BLI_AStarGNode *nodes; - void *custom_data; + void *custom_data; - struct MemArena *mem; /* Memory arena. */ + struct MemArena *mem; /* Memory arena. */ } BLI_AStarGraph; void BLI_astar_node_init(BLI_AStarGraph *as_graph, const int node_index, void *custom_data); -void BLI_astar_node_link_add( - BLI_AStarGraph *as_graph, const int node1_index, const int node2_index, const float cost, void *custom_data); +void BLI_astar_node_link_add(BLI_AStarGraph *as_graph, + const int node1_index, + const int node2_index, + const float cost, + void *custom_data); int BLI_astar_node_link_other_node(BLI_AStarGNLink *lnk, const int idx); -void BLI_astar_solution_init(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, void *custom_data); +void BLI_astar_solution_init(BLI_AStarGraph *as_graph, + BLI_AStarSolution *as_solution, + void *custom_data); void BLI_astar_solution_clear(BLI_AStarSolution *as_solution); void BLI_astar_solution_free(BLI_AStarSolution *as_solution); @@ -91,13 +96,20 @@ void BLI_astar_solution_free(BLI_AStarSolution *as_solution); * \param node_idx_next: next node index. * \param node_idx_dst: destination node index. */ -typedef float (*astar_f_cost)(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, BLI_AStarGNLink *link, - const int node_idx_curr, const int node_idx_next, const int node_idx_dst); +typedef float (*astar_f_cost)(BLI_AStarGraph *as_graph, + BLI_AStarSolution *as_solution, + BLI_AStarGNLink *link, + const int node_idx_curr, + const int node_idx_next, + const int node_idx_dst); void BLI_astar_graph_init(BLI_AStarGraph *as_graph, const int node_num, void *custom_data); void BLI_astar_graph_free(BLI_AStarGraph *as_graph); -bool BLI_astar_graph_solve( - BLI_AStarGraph *as_graph, const int node_index_src, const int node_index_dst, astar_f_cost f_cost_cb, - BLI_AStarSolution *r_solution, const int max_steps); - -#endif /* __BLI_ASTAR_H__ */ +bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph, + const int node_index_src, + const int node_index_dst, + astar_f_cost f_cost_cb, + BLI_AStarSolution *r_solution, + const int max_steps); + +#endif /* __BLI_ASTAR_H__ */ |