7 #ifndef __ai_GenerateNav_h__ 8 #define __ai_GenerateNav_h__ 28 virtual public HandlerI,
35 void initialize(
void);
38 virtual void handle(
Record &r_sig);
42 AsNavDebug m_asNavDebug;
46 void wavefrontPotential( Continuum<P> &a_potential,
49 const P &a_max,
const P &a_min)
51 typedef typename Continuum<P>::t_index t_index;
53 a_potential.index(target_index, a_target);
55 a_potential.unit().safe(target_index);
57 fprintf(stderr,
"target %f %f %f index %d %d %d\n", a_target[0], a_target[1], a_target[2], target_index[0], target_index[1], target_index[2]);
59 std::list<t_index> checklist;
60 checklist.push_back(target_index);
62 a_potential.accessUnit().set(a_max);
63 a_potential.accessUnit().set(target_index, a_min);
65 while(checklist.begin() != checklist.end())
68 i_current = checklist.front();
69 checklist.pop_front();
71 std::list<t_index> neighbors;
73 a_potential.accessUnit().addNeighbors(neighbors, i_current);
76 for(
typename std::list<t_index>::iterator
77 i_neighbor = neighbors.begin();
78 i_neighbor != neighbors.end(); i_neighbor++)
80 typename std::list<t_index>::iterator i_other = i_neighbor;
82 while(i_other != neighbors.end())
84 if(*i_neighbor == *i_other)
92 a_potential.location(current_location, i_current);
94 a_potential.location(neighbor_location, *i_neighbor);
95 dp = a_costFn->cost(neighbor_location, current_location);
96 P new_value = a_potential.unit()[i_current] + dp;
97 if(new_value < a_potential.unit()[*i_neighbor])
99 a_potential.accessUnit().set(*i_neighbor, new_value);
100 checklist.push_back(*i_neighbor);
103 if(dup){ feX(
"duplicate\n");}
Generate a navigation field, which is a vector field of directions to get to a target destination poi...
Definition: GenerateNav.h:26
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53