1 vector plib_points2[8];
5 float pathlib_expandnode_starf(entity node, vector start, vector goal)
13 f = PLIB_FORWARD * pathlib_gridsize;
14 r = PLIB_RIGHT * pathlib_gridsize;
17 plib_points[0] = where + f;
20 plib_points[1] = where - f;
23 plib_points[2] = where + r;
26 plib_points[3] = where - r;
29 plib_points[4] = where + f + r;
32 plib_points[5] = where + f - r;
35 plib_points[6] = where - f + r;
38 plib_points[7] = where - f - r;
43 fc = pathlib_heuristic(t,goal) + pathlib_cost(node,t,pathlib_gridsize);
49 plib_points2[0] = plib_points[0];
52 for(i = 0; i < 8; ++i)
55 nap = pathlib_nodeatpoint(plib_points[i]);
57 if(nap.owner == openlist)
63 if(plib_fvals[i] < fc)
67 plib_points2[fc2] = plib_points[i];
72 nap = pathlib_nodeatpoint(plib_points[i]);
74 if not nap.owner == closedlist)
80 pathlib_makenode(node,start,bp,goal,pathlib_gridsize);
82 for(i = 0; i < 3; ++i)
84 pathlib_makenode(node,start,plib_points2[i],goal,pathlib_gridsize);
87 return pathlib_open_cnt;
90 float pathlib_expandnode_star(entity node, vector start, vector goal)
92 vector point,where,f,r;
96 f = PLIB_FORWARD * pathlib_gridsize;
97 r = PLIB_RIGHT * pathlib_gridsize;
101 pathlib_makenode(node,start,point,goal,pathlib_movecost);
105 pathlib_makenode(node,start,point,goal,pathlib_movecost);
109 pathlib_makenode(node,start,point,goal,pathlib_movecost);
113 pathlib_makenode(node,start,point,goal,pathlib_movecost);
116 point = where + f + r;
117 pathlib_makenode(node,start,point,goal,pathlib_movecost_diag);
120 point = where + f - r;
121 pathlib_makenode(node,start,point,goal,pathlib_movecost_diag);
124 point = where - f + r;
125 pathlib_makenode(node,start,point,goal,pathlib_movecost_diag);
128 point = where - f - r;
129 pathlib_makenode(node,start,point,goal,pathlib_movecost_diag);
131 return pathlib_open_cnt;
134 float pathlib_expandnode_octagon(entity node, vector start, vector goal)
136 vector point,where,f,r;
140 f = PLIB_FORWARD * pathlib_gridsize;
141 r = PLIB_RIGHT * pathlib_gridsize;
145 pathlib_makenode(node,start,point,goal,pathlib_movecost);
149 pathlib_makenode(node,start,point,goal,pathlib_movecost);
153 pathlib_makenode(node,start,point,goal,pathlib_movecost);
157 pathlib_makenode(node,start,point,goal,pathlib_movecost);
159 f = PLIB_FORWARD * pathlib_gridsize * 0.5;
160 r = PLIB_RIGHT * pathlib_gridsize * 0.5;
163 point = where + f + r;
164 pathlib_makenode(node,start,point,goal,pathlib_movecost);
168 point = where + f - r;
169 pathlib_makenode(node,start,point,goal,pathlib_movecost);
173 point = where - f + r;
174 pathlib_makenode(node,start,point,goal,pathlib_movecost);
177 point = where - f - r;
178 pathlib_makenode(node,start,point,goal,pathlib_movecost);
180 return pathlib_open_cnt;
183 float pathlib_expandnode_box(entity node, vector start, vector goal)
187 for(v_z = node.origin_z - pathlib_gridsize; v_z <= node.origin_z + pathlib_gridsize; v_z += pathlib_gridsize)
188 for(v_y = node.origin_y - pathlib_gridsize; v_y <= node.origin_y + pathlib_gridsize; v_y += pathlib_gridsize)
189 for(v_x = node.origin_x - pathlib_gridsize; v_x <= node.origin_x + pathlib_gridsize; v_x += pathlib_gridsize)
191 //if(vlen(v - node.origin))
192 pathlib_makenode(node,start,v,goal,pathlib_movecost);
195 return pathlib_open_cnt;