Blender V5.0
BLI_astar.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
11
12#include "DNA_listBase.h"
13
14#include "BLI_bitmap.h"
15
16/* -------------------------------------------------------------------- */
17
19 int nodes[2];
20 float cost;
21
23};
24
30
32 /* Final 'most useful' data. */
35 int steps;
40
42
43 /* Mostly runtime data. */
45 float *g_costs;
46 int *g_steps;
47
48 struct MemArena *mem; /* Memory arena. */
49};
50
54
56
57 struct MemArena *mem; /* Memory arena. */
58};
59
66void BLI_astar_node_init(BLI_AStarGraph *as_graph, int node_index, void *custom_data);
76 BLI_AStarGraph *as_graph, int node1_index, int node2_index, float cost, void *custom_data);
81
91 BLI_AStarSolution *as_solution,
92 void *custom_data);
104
116using astar_f_cost = float (*)(BLI_AStarGraph *as_graph,
117 BLI_AStarSolution *as_solution,
118 BLI_AStarGNLink *link,
119 int node_idx_curr,
120 int node_idx_next,
121 int node_idx_dst);
122
131void BLI_astar_graph_init(BLI_AStarGraph *as_graph, int node_num, void *custom_data);
142 int node_index_src,
143 int node_index_dst,
144 astar_f_cost f_cost_cb,
145 BLI_AStarSolution *r_solution,
146 int max_steps);
float(*)(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, BLI_AStarGNLink *link, int node_idx_curr, int node_idx_next, int node_idx_dst) astar_f_cost
Definition BLI_astar.h:116
bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph, int node_index_src, int node_index_dst, astar_f_cost f_cost_cb, BLI_AStarSolution *r_solution, int max_steps)
Definition astar.cc:140
void BLI_astar_solution_clear(BLI_AStarSolution *as_solution)
Definition astar.cc:91
void BLI_astar_node_init(BLI_AStarGraph *as_graph, int node_index, void *custom_data)
Definition astar.cc:36
void BLI_astar_node_link_add(BLI_AStarGraph *as_graph, int node1_index, int node2_index, float cost, void *custom_data)
Definition astar.cc:41
void BLI_astar_solution_init(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, void *custom_data)
Definition astar.cc:67
void BLI_astar_graph_init(BLI_AStarGraph *as_graph, int node_num, void *custom_data)
Definition astar.cc:116
int BLI_astar_node_link_other_node(BLI_AStarGNLink *lnk, int idx)
Definition astar.cc:62
void BLI_astar_solution_free(BLI_AStarSolution *as_solution)
Definition astar.cc:108
void BLI_astar_graph_free(BLI_AStarGraph *as_graph)
Definition astar.cc:132
unsigned int BLI_bitmap
Definition BLI_bitmap.h:13
These structs are the foundation for all linked lists in the library system.
nullptr float
void * custom_data
Definition BLI_astar.h:28
struct ListBase neighbor_links
Definition BLI_astar.h:26
BLI_AStarGNode * nodes
Definition BLI_astar.h:53
void * custom_data
Definition BLI_astar.h:55
struct MemArena * mem
Definition BLI_astar.h:57
BLI_AStarGNLink ** prev_links
Definition BLI_astar.h:39
struct MemArena * mem
Definition BLI_astar.h:48
BLI_bitmap * done_nodes
Definition BLI_astar.h:44