HOG2
LoadedBBAbstraction.cpp
Go to the documentation of this file.
1 /*
2  * LoadedBBAbstraction.cpp
3  * hog
4  *
5  * Created by Nathan Sturtevant on 4/12/06.
6  * Copyright 2006 Nathan Sturtevant. All rights reserved.
7  *
8  */
9 
10 #include "LoadedBBAbstraction.h"
11 #include "FPUtil.h"
12 #include <math.h>
13 #include <string.h>
14 
15 using namespace std;
16 using namespace GraphAbstractionConstants;
17 
18 enum {
19  kQuiet = 0x00,
20  kBuildGraph = 0x01,
21  kRepairGraph = 0x02,
23 };
24 
25 const static int verbose = kMiscMessages;//kMiscMessages;//kRepairGraph;
26 
27 const double unknownPosition = -5.0;
28 
29 bool LoadedBBAbstraction::BoundingBox::pointInBox(double x, double y, double z)
30 {
31 // printf("checking (%lf, %lf, %lf) in (%lf, %lf, %lf)<=>(%lf, %lf, %lf)\n",
32 // x, y, z, x1, y1, z1, x2, y2, z2);
33  return (((fless(x, x1) && (!fless(x, x2))) || (fless(x, x2) && (!fless(x, x1)))) &&
34  ((fless(y, y1) && (!fless(y, y2))) || (fless(y, y2) && (!fless(y, y1)))) &&
35  ((fless(z, z1) && (!fless(z, z2))) || (fless(z, z2) && (!fless(z, z1)))));
36 }
37 
39 {
40  glBegin(GL_LINE_LOOP);
41  glVertex3f(x1, y1, z1);
42  glVertex3f(x2, y1, z1);
43  glVertex3f(x2, y2, z1);
44  glVertex3f(x1, y2, z1);
45  glEnd();
46  glBegin(GL_LINE_LOOP);
47  glVertex3f(x2, y2, z2);
48  glVertex3f(x1, y2, z2);
49  glVertex3f(x1, y1, z2);
50  glVertex3f(x2, y1, z2);
51  glEnd();
52  glBegin(GL_LINES);
53  glVertex3f(x1, y1, z1);
54  glVertex3f(x1, y1, z2);
55  glVertex3f(x2, y1, z1);
56  glVertex3f(x2, y1, z2);
57  glVertex3f(x1, y2, z1);
58  glVertex3f(x1, y2, z2);
59  glVertex3f(x2, y2, z1);
60  glVertex3f(x2, y2, z2);
61  glEnd();
62 }
63 //double x1, x2, y1, y2, z1, z2;
64 
71 LoadedBBAbstraction::LoadedBBAbstraction(char *fname, char *boxFile)
73 {
74  levelDraw = 1;
75 
76  loadBoxes(boxFile);
78 }
79 
81 {
82  cleanMemory();
83 }
84 
85 void LoadedBBAbstraction::loadBoxes(char *boxFile)
86 {
87  FILE *f = fopen(boxFile, "r");
88  if (f)
89  {
90  while (!feof(f))
91  {
92  //printf("Loading bounding box %u\n", boxes.size());
93  BoundingBox b;
94  int num;
95  fscanf(f, "%d %lf %lf %lf %lf %lf %lf\n",
96  &num, &b.x1, &b.y1, &b.z1, &b.x2, &b.y2, &b.z2);
97  boxes.push_back(b);
98  }
99  fclose(f);
100  }
101  else {
102  printf("Unable to open box file %s\n", boxFile);
103  exit(2);
104  }
105 }
106 
108 {
109  double d1 = a->GetLabelF(kXCoordinate)-b->GetLabelF(kXCoordinate);
110  double d2 = a->GetLabelF(kYCoordinate)-b->GetLabelF(kYCoordinate);
111  double d3 = a->GetLabelF(kZCoordinate)-b->GetLabelF(kZCoordinate);
112  return sqrt(d1*d1+d2*d2+d3*d3);
113 }
114 
116 {
117  bool drawThis = ((levelDraw>>which)&0x1);
118  if (!drawThis)
119  levelDraw |= (1<<which);
120  else
121  levelDraw = levelDraw&(~(1<<which));
122 }
123 
125 {
126  glDisable(GL_LIGHTING);
127  for (unsigned int x = 0; x < abstractions.size(); x++)
128  {
129  if ((levelDraw >> x) & 1) DrawGraph(abstractions[x]);
130  //glCallList(displayLists[x]);
131  }
132  if (levelDraw&1)
133  {
134  for (unsigned int x = 0; x < boxes.size(); x++)
135  {
136  glColor3f(0, 0, 1);
137  boxes[x].OpenGLDraw();
138  }
139  }
140  glEnable(GL_LIGHTING);
141 }
142 
144 {
145  if ((g == 0) || (g->GetNumNodes() == 0)) return;
146 
147  int abLevel = g->GetNode(0)->GetLabelL(kAbstractionLevel);
148 
149  glBegin(GL_LINES);
150  glNormal3f(0, 1, 0);
151  node_iterator ni;
152  edge_iterator ei = g->getEdgeIter();
153  for (edge *e = g->edgeIterNext(ei); e; e = g->edgeIterNext(ei)) {
154  node *n;
155  n = g->GetNode(e->getFrom());
156 
157  if (e->GetLabelL(kEdgeCapacity) == 0) glColor4f(.5, .5, .5, 1);
158  else if (e->GetLabelL(kEdgeCapacity) <= 0) glColor4f(.2, .2, .2, 1);
159  else if (e->getMarked()) glColor4f(1, 1, 1, 1);
160  else if (abLevel%2)
161  glColor4f(1-((GLfloat)(abLevel%15)/15.0), ((GLfloat)(abLevel%15)/15.0), 0, 1);
162  else glColor4f(((GLfloat)(abLevel%15)/15.0), 1-((GLfloat)(abLevel%15)/15.0), 0, 1);
163  recVec rv = GetNodeLoc(n);
164  glVertex3f(rv.x, rv.y, rv.z);
165 
166  n = g->GetNode(e->getTo());
167  rv = GetNodeLoc(n);
168 
169  glVertex3f(rv.x, rv.y, rv.z);
170  }
171  ni = g->getNodeIter();
172  for (node *n = g->nodeIterNext(ni); n; n = g->nodeIterNext(ni))
174  glEnd();
175  // if (verbose&kBuildGraph) printf("Done\n");
176 }
177 
179 {
180  // int x, y;
181  // double offsetx, offsety;
182  // recVec ans;
183  //if (n->getNumOutgoingEdges()+n->getNumIncomingEdges() == 0) return;
184 
185  if (n->GetLabelL(kAbstractionLevel) == 0) return;
186  else {
187  glColor4f(.6, .6, .6, .6);
188  recVec v = GetNodeLoc(n);
189  for (int cnt = 0; cnt < n->GetLabelL(kNumAbstractedNodes); cnt++) {
191  glVertex3f(v.x, v.y, v.z);
192  glVertex3f(v1.x, v1.y, v1.z);
193  }
194  }
195  //return ans;
196 }
197 
199 {
200  // double offsetx, offsety;
201  recVec ans;
202 
204  ans.x = n->GetLabelF(kXCoordinate);
205  ans.y = n->GetLabelF(kYCoordinate);
206  ans.z = n->GetLabelF(kZCoordinate);
207  return ans;
208  }
209 
210  int totNodes = 0;
211  ans.x = ans.y = ans.z = 0;
212  for (int cnt = 0; cnt < n->GetLabelL(kNumAbstractedNodes); cnt++) {
213  int absLevel = n->GetLabelL(kAbstractionLevel)-1;
214  node *nextChild = abstractions[absLevel]->GetNode(n->GetLabelL(kFirstData+cnt));
215  recVec tmp = GetNodeLoc(nextChild);
216  int weight = nextChild->GetLabelL(kNumAbstractedNodes);
217  totNodes += weight;
218  ans.x += weight*tmp.x;
219  ans.y += weight*tmp.y;
220  ans.z += weight*tmp.z;
221  }
222  ans.x /= totNodes;//n->GetLabelL(kNumAbstractedNodes);
223  ans.y /= totNodes;//n->GetLabelL(kNumAbstractedNodes);
224  ans.z /= totNodes;//n->GetLabelL(kNumAbstractedNodes);
225 
226  n->SetLabelF(kXCoordinate, ans.x);
227  n->SetLabelF(kYCoordinate, ans.y);
228  n->SetLabelF(kZCoordinate, ans.z);
229  return ans;
230 }
231 
232 
234 {
235  FILE *f = fopen(fname, "r");
236  if (!f)
237  {
238  printf("Error opening %s for loading\n", fname);
239  exit(1);
240  }
241  char nextLine[255];
242  std::vector<unsigned int> IDS;
243  bool nodes = true;
244  Graph *g = new Graph();
245  fgets(nextLine, 255, f);
246  const double VERSION = 1.0;
247  double version;
248  sscanf(nextLine, "VERSION %lf", &version);
249  if (version != VERSION)
250  {
251  printf("Got %lf; code can only handle version 1.0\n", version);
252  exit(1);
253  }
254 
255  while ((!feof(f)) && fgets(nextLine, 255, f))
256  {
257  if (nextLine[0] == '#')
258  continue;
259  if (strncmp("edges", nextLine, 5) == 0)
260  {
261  nodes = false;
262  continue;
263  }
264  if (nodes)
265  {
266  // ID x y z
267  int ID;
268  double x, y, z;
269  sscanf(nextLine, "%d %lf %lf %lf", &ID, &x, &y, &z);
270  //printf("Loaded node %d\n", ID);
271  if (IDS.size() <= (unsigned int)ID)
272  IDS.resize(ID+1);
273  node *n;
274  IDS[ID] = g->AddNode(n = new node("l1"));
275  n->SetLabelL(kAbstractionLevel, 0); // level in abstraction tree
276  n->SetLabelL(kNumAbstractedNodes, 1); // number of abstracted nodes
277  n->SetLabelL(kParent, -1); // parent of this node in abstraction hierarchy
278  n->SetLabelF(kXCoordinate, x);
279  n->SetLabelF(kYCoordinate, y);
280  n->SetLabelF(kZCoordinate, z);
281  n->SetLabelL(kNodeBlocked, 0);
282  }
283  else {
284  int ID1, ID2;
285  sscanf(nextLine, "%d %d", &ID1, &ID2);
286  g->AddEdge(new edge(IDS[ID1], IDS[ID2], h(g->GetNode(ID1), g->GetNode(ID2))));
287  //printf("Loaded edge between %d and %d\n", ID1, ID2);
288  }
289  }
290  return g;
291 }
292 
294 {
295  cout << "VERIFY START" << endl;
296  for (unsigned int x = 0; x < abstractions.size(); x++)
297  {
298  // first make sure Graph is ok
299  abstractions[x]->verifyGraph();
300  // then make sure abstraction is ok
301  node_iterator ni = abstractions[x]->getNodeIter();
302  for (node *n = abstractions[x]->nodeIterNext(ni); n; n = abstractions[x]->nodeIterNext(ni))
303  {
304  // verify Graph, because there may be issues...
305  if (n->GetLabelL(kParent) != -1)
306  {
307  Graph *g = abstractions[x+1];
308  node *parent = g->GetNode(n->GetLabelL(kParent));
309  bool found = false;
310  for (int y = 0; y < parent->GetLabelL(kNumAbstractedNodes); y++)
311  {
312  if (parent->GetLabelL(kFirstData+y) == (long)n->GetNum())
313  { found = true; break; }
314  }
315  if (!found)
316  {
317  cout << "VERIFY: Graph doesn't verify; child:" << endl << *n << endl;
318  cout << "VERIFY: Graph doesn't verify; parent:" << endl << *parent << endl;
319  }
320  }
321  if (x > 0)
322  {
323  Graph *g = abstractions[x-1];
324  for (int y = 0; y < n->GetLabelL(kNumAbstractedNodes); y++)
325  {
326  node *child = g->GetNode(n->GetLabelL(kFirstData+y));
327  if (!child)
328  {
329  cout << "VERIFY: Graph doesn't verify; CHILD is null, parent:" << endl << *n << endl;
330  }
331  else if (child->GetLabelL(kParent) != (long)n->GetNum())
332  {
333  cout << "VERIFY: Graph doesn't verify; parent:" << endl << *n << endl;
334  cout << "VERIFY: Graph doesn't verify; child:" << endl << *child << endl;
335  }
336  }
337  }
338  else {
339 // int x1, y1;
340 // GetTileFromNode(n, x1, y1);
341 // if (n != GetNodeFromMap(x1, y1))
342 // cout << "VERIFY: node doesn't correspond to underlying map" << endl << *n << endl;
343  }
344  }
345  // verify edges
346  edge_iterator ei = abstractions[x]->getEdgeIter();
347  for (edge *e = abstractions[x]->edgeIterNext(ei); e; e = abstractions[x]->edgeIterNext(ei))
348  {
349  node *p1, *p2;
350  p1 = findNodeParent(abstractions[x]->GetNode(e->getFrom()));
351  p2 = findNodeParent(abstractions[x]->GetNode(e->getTo()));
352  if (p1 == p2)
353  continue;
354  if ((p1 == 0) || (p2 == 0))
355  {
356  cout << "VERIFY: One edge parent is null, and the other isn't " << *e << endl << *p1 << endl << *p2 << endl;
357  continue;
358  }
359  if (!abstractions[x+1]->FindEdge(p1->GetNum(), p2->GetNum()))
360  {
361  cout << "Didn't find parent edge of " << *e << " at abslevel " << x << endl;
362  cout << *p1 << endl << *p2 << endl;
363  }
364  // VERIFY edge weights
365  if (e->GetLabelL(kEdgeCapacity) == 0)
366  cout << "VERIFY: Edge capacity is 0?!? " << e << endl;
367  if (x > 0) // we can verify the capacity
368  {
369  int count = 0;
370  // we should find kEdgeCapacity edges between the children of p1 and p2
371  p1 = abstractions[x]->GetNode(e->getFrom());
372  p2 = abstractions[x]->GetNode(e->getTo());
373  for (int c1 = 0; c1 < p1->GetLabelL(kNumAbstractedNodes); c1++)
374  {
375  for (int c2 = 0; c2 < p2->GetLabelL(kNumAbstractedNodes); c2++)
376  {
377  if (abstractions[x-1]->FindEdge(p1->GetLabelL(kFirstData+c1),
378  p2->GetLabelL(kFirstData+c2)))
379  {
380  count++;
381  }
382  }
383  }
384  if (count != e->GetLabelL(kEdgeCapacity))
385  {
386  cout << "VERIFY: Edge capactiy of " << *e << " is "
387  << e->GetLabelL(kEdgeCapacity) << " but we only found " << count
388  << " edges below that abstract into it." << endl;
389  }
390  }
391  }
392  }
393  cout << "VERIFY END" << endl;
394 }
395 
397 {
398  while (abstractions.size() > 0) {
399  delete abstractions.back();
400  abstractions.pop_back();
401  }
402 // clearDisplayLists();
403 // while (displayLists.size() > 0)
404 // displayLists.pop_back();
405 }
406 
407 //void LoadedBBAbstraction::clearDisplayLists()
408 //{
409 // for (unsigned int x = 0; x < displayLists.size(); x++) {
410 // if (displayLists[x] != 0) glDeleteLists(displayLists[x], 1);
411 // displayLists[x] = 0;
412 // }
413 //}
414 
416 {
417  int totalNodes = 0;
418  cleanMemory();
419  abstractions.push_back(_g);
420  Graph *g = abstractions[0];
421 // if (displayLists.size() != 1)
422 // displayLists.push_back(0);
423  //if (verbose)
424  printf("Base Graph (0) has %d nodes\n", g->GetNumNodes());
425  g->printStats();
426 
427  for (int x = 1; ; x++)
428  {
429  if (g->GetNumEdges() == 0) break;
430 
431  if (verbose&kMiscMessages) printf("Building abstraction #%2d\n", x);
432 
433  abstractions.push_back(abstractGraph(g));
434  g = abstractions.back();
435 
437  {
438  printf("Abstract Graph #%2d has %d nodes\n", x, g->GetNumNodes());
439  g->printStats();
440  }
441  totalNodes += g->GetNumNodes();
442 // displayLists.push_back(0);
443  }
444  // printf("%d nodes, excluding bottom level", totalNodes);
445 }
446 
448 {
449  // for each node:
450  // 1. find bounding box
451  // 2. add node and all neighbors which are in the bounding box
452  node_iterator ni = g->getNodeIter();
453  node *newNode;
454  Graph *aGraph = new Graph();
455 
456  ni = g->getNodeIter();
457  for (node *n = g->nodeIterNext(ni); n; n = g->nodeIterNext(ni))
458  {
459  if (n->GetLabelL(kParent) != -1) continue;
460  int which;
461  if (n->GetLabelL(kAbstractionLevel) == 0)
462  which = findBoundingBox(n);
463  else
464  which = -1;
465  //printf("%u abstracted into box %d\n", n->GetNum(), which);
466  newNode = createNewParent(aGraph, n);
467  //printf("%u created as parent of %u\n", newNode->GetNum(), n->GetNum());
468  if ((which == -1) && (n->GetLabelL(kAbstractionLevel) == 0))
469  addNodeToParent(n, newNode);
470  else
471  addNeighborsInBox(g, n, which, newNode);
472  }
473 
474  // now add all the edges
475  edge_iterator ei = g->getEdgeIter();
476  for (edge *e = g->edgeIterNext(ei); e; e = g->edgeIterNext(ei))
477  {
478  int from = g->GetNode(e->getFrom())->GetLabelL(kParent);
479  int to = g->GetNode(e->getTo())->GetLabelL(kParent);
480  edge *f=0;
481 
482  if ((from != to) && (!(f = aGraph->FindEdge(to, from))))
483  {
484  double weight = h(aGraph->GetNode(from), aGraph->GetNode(to));
485  f = new edge(from, to, weight);
486  f->SetLabelL(kEdgeCapacity, 1);
487  aGraph->AddEdge(f);
488  //printf("Adding edge to Graph!\n");
489  }
490  else if (f) f->SetLabelL(kEdgeCapacity, f->GetLabelL(kEdgeCapacity)+1);
491  // else if (g)
492  // g->setLabel(kEdgeCapacity, g->GetLabelL(kEdgeCapacity)+1);
493  }
494 
495  return aGraph;
496 }
497 
499 {
500  for (unsigned int x = 0; x < boxes.size(); x++)
501  {
502  if (boxes[x].pointInBox(n->GetLabelF(kXCoordinate),
504  n->GetLabelF(kZCoordinate)))
505  return x;
506 // if (boxes[boxes.size()-x-1].pointInBox(n->GetLabelF(kXCoordinate),
507 // n->GetLabelF(kYCoordinate),
508 // n->GetLabelF(kZCoordinate)))
509 // return boxes.size()-x-1;
510  }
511  return -1;
512 }
513 
514 void LoadedBBAbstraction::addNeighborsInBox(Graph *g, node *n, int which, node *parent)
515 {
516  //printf("Thinking about adding %d to parent %d\n", n->GetNum(), parent->GetNum());
517  if (n->GetLabelL(kParent) != -1)
518  return;
519  if ((which != -1) && (!boxes[which].pointInBox(n->GetLabelF(kXCoordinate),
521  n->GetLabelF(kZCoordinate))))
522  return;
523 
524  addNodeToParent(n, parent);
526  for (node *next = g->GetNode(n->nodeNeighborNext(nbi));
527  next; next = g->GetNode(n->nodeNeighborNext(nbi)))
528  addNeighborsInBox(g, next, which, parent);
529 }
530 
532 {
533  //printf("Adding %d to parent %d\n", n->GetNum(), parent->GetNum());
534  n->SetLabelL(kParent, parent->GetNum());
535  parent->SetLabelL(kFirstData+parent->GetLabelL(kNumAbstractedNodes), n->GetNum());
536  parent->SetLabelL(kNumAbstractedNodes, parent->GetLabelL(kNumAbstractedNodes)+1); // number of abstracted nodes
537 }
538 
540 {
541  node *newNode = new node("l1");
542  g->AddNode(newNode);
543  newNode->SetLabelL(kAbstractionLevel, n->GetLabelL(kAbstractionLevel)+1); // level in abstraction tree
544  newNode->SetLabelL(kNumAbstractedNodes, 0); // number of abstracted nodes
545  newNode->SetLabelL(kParent, -1); // parent of this node in abstraction hierarchy
547  newNode->SetLabelL(kNodeBlocked, 0);
548 
549  return newNode;
550 }
551 
552 bool LoadedBBAbstraction::Pathable(unsigned int from, unsigned int to)
553 {
554  return Pathable(abstractions[0]->GetNode(from), abstractions[0]->GetNode(to));
555 }
556 
558 {
559  //printf("At nodes #%d and %d\n", from->GetNum(), to->GetNum());
560  while (from != to) {
561  if ((!from) || (!to) ||
562  (abstractions[from->GetLabelL(kAbstractionLevel)]->GetNumEdges() == 0))
563  return false;
564 
565  from = abstractions[from->GetLabelL(kAbstractionLevel)+1]->
566  GetNode(from->GetLabelL(kParent));
568  GetNode(to->GetLabelL(kParent));
569  }
570  if ((from == 0) || (to == 0))
571  return false;
572  return true;
573 }
574 
575 
577 {
578 }
579 
580 void LoadedBBAbstraction::AddEdge(edge *, unsigned int)
581 {
582 }
583 
584 // // for now we'll immediately handle splits, but in the future we should queue up splits
586 //void LoadedBBAbstraction::RemoveEdge(edge *e, unsigned int absLevel)
587 //{
588 // return;
589 //}
590 //
591 
593 {
594  unsigned int absLevel = n->GetLabelL(kAbstractionLevel);
595  if (absLevel < abstractions.size()-1)
596  return abstractions[absLevel+1]->GetNode(n->GetLabelL(kParent));
597  return 0;
598 }
Graph::AddNode
int AddNode(node *)
Definition: Graph.cpp:136
GraphAbstraction
A generic class for basic operations on Graph abstractions.
Definition: GraphAbstraction.h:63
verbose
const static int verbose
Definition: LoadedBBAbstraction.cpp:25
GraphAbstractionConstants
Definition: GraphAbstraction.h:22
LoadedBBAbstraction::cleanMemory
void cleanMemory()
Definition: LoadedBBAbstraction.cpp:396
node::SetLabelL
void SetLabelL(unsigned int index, long val) const
Definition: Graph.cpp:702
LoadedBBAbstraction::loadBoxes
void loadBoxes(char *boxFile)
Definition: LoadedBBAbstraction.cpp:85
node::SetLabelF
void SetLabelF(unsigned int index, double val) const
Definition: Graph.cpp:687
Graph::FindEdge
edge * FindEdge(unsigned int from, unsigned int to)
Finds an edge between nodes with ids from and to, no matter which direction.
Definition: Graph.cpp:230
recVec
A generic vector (essentially the same as a point, but offers normalization)
Definition: GLUtil.h:78
neighbor_iterator
unsigned int neighbor_iterator
Definition: Graph.h:34
recVec::z
GLdouble z
Definition: GLUtil.h:98
kBuildGraph
@ kBuildGraph
Definition: LoadedBBAbstraction.cpp:20
kQuiet
@ kQuiet
Definition: LoadedBBAbstraction.cpp:19
LoadedBBAbstraction::addNeighborsInBox
void addNeighborsInBox(Graph *g, node *n, int which, node *parent)
Definition: LoadedBBAbstraction.cpp:514
Graph::AddEdge
void AddEdge(edge *)
Definition: Graph.cpp:170
Graph::nodeIterNext
node * nodeIterNext(node_iterator &) const
Definition: Graph.cpp:303
LoadedBBAbstraction::VerifyHierarchy
virtual void VerifyHierarchy()
verify that the hierarchy is consistent
Definition: LoadedBBAbstraction.cpp:293
LoadedBBAbstraction::BoundingBox::y1
double y1
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::BoundingBox::x2
double x2
Definition: LoadedBBAbstraction.h:57
edge_iterator
std::vector< edge * >::const_iterator edge_iterator
Definition: Graph.h:30
LoadedBBAbstraction::~LoadedBBAbstraction
virtual ~LoadedBBAbstraction()
Definition: LoadedBBAbstraction.cpp:80
FPUtil.h
GraphAbstractionConstants::kEdgeCapacity
@ kEdgeCapacity
Definition: GraphAbstraction.h:53
Graph
A generic Graph class.
Definition: Graph.h:66
Graph::GetNode
node * GetNode(unsigned long num)
Definition: Graph.cpp:152
Graph::edgeIterNext
edge * edgeIterNext(edge_iterator &) const
Definition: Graph.cpp:320
LoadedBBAbstraction::createNewParent
node * createNewParent(Graph *, node *n)
Definition: LoadedBBAbstraction.cpp:539
GraphAbstractionConstants::kZCoordinate
@ kZCoordinate
Definition: GraphAbstraction.h:32
node_iterator
std::vector< node * >::const_iterator node_iterator
Definition: Graph.h:33
GraphAbstractionConstants::kNumAbstractedNodes
@ kNumAbstractedNodes
Definition: GraphAbstraction.h:26
edge::GetLabelL
long GetLabelL(unsigned int index) const
Definition: Graph.h:138
LoadedBBAbstraction::loadGraph
Graph * loadGraph(char *fname)
Definition: LoadedBBAbstraction.cpp:233
LoadedBBAbstraction::BoundingBox::z2
double z2
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::addNodeToParent
void addNodeToParent(node *n, node *parent)
Definition: LoadedBBAbstraction.cpp:531
Graph::getEdgeIter
edge_iterator getEdgeIter() const
Definition: Graph.cpp:315
LoadedBBAbstraction::DrawLevelConnections
void DrawLevelConnections(node *n) const
Definition: LoadedBBAbstraction.cpp:178
kMiscMessages
@ kMiscMessages
Definition: LoadedBBAbstraction.cpp:22
GraphAbstractionConstants::kFirstData
@ kFirstData
Definition: GraphAbstraction.h:34
kRepairGraph
@ kRepairGraph
Definition: LoadedBBAbstraction.cpp:21
fless
bool fless(double a, double b)
Definition: FPUtil.h:28
LoadedBBAbstraction::boxes
std::vector< BoundingBox > boxes
Definition: LoadedBBAbstraction.h:60
Graph::GetNumEdges
int GetNumEdges()
Definition: Graph.cpp:397
LoadedBBAbstraction::DrawGraph
void DrawGraph(Graph *g) const
Definition: LoadedBBAbstraction.cpp:143
edge::SetLabelL
void SetLabelL(unsigned int index, long val)
Definition: Graph.cpp:598
GraphAbstractionConstants::kAbstractionLevel
@ kAbstractionLevel
Definition: GraphAbstraction.h:25
LoadedBBAbstraction::BoundingBox::x1
double x1
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::BoundingBox::pointInBox
bool pointInBox(double x, double y, double z)
Definition: LoadedBBAbstraction.cpp:29
GraphAbstractionConstants::kYCoordinate
@ kYCoordinate
Definition: GraphAbstraction.h:31
LoadedBBAbstraction::findNodeParent
node * findNodeParent(node *n)
Definition: LoadedBBAbstraction.cpp:592
LoadedBBAbstraction::BoundingBox
Definition: LoadedBBAbstraction.h:53
unknownPosition
const double unknownPosition
Definition: LoadedBBAbstraction.cpp:27
LoadedBBAbstraction::LoadedBBAbstraction
LoadedBBAbstraction(char *, char *)
Construct a new Graph hierarchy.
Definition: LoadedBBAbstraction.cpp:71
Graph::GetNumNodes
int GetNumNodes()
Definition: Graph.cpp:403
Graph::getNodeIter
node_iterator getNodeIter() const
Definition: Graph.cpp:298
node::nodeNeighborNext
int nodeNeighborNext(neighbor_iterator &) const
Definition: Graph.cpp:807
LoadedBBAbstraction::BoundingBox::z1
double z1
Definition: LoadedBBAbstraction.h:57
LoadedBBAbstraction::ToggleDrawAbstraction
void ToggleDrawAbstraction(int which)
Definition: LoadedBBAbstraction.cpp:115
GraphAbstraction::abstractions
std::vector< Graph * > abstractions
Definition: GraphAbstraction.h:122
GraphAbstractionConstants::kXCoordinate
@ kXCoordinate
Definition: GraphAbstraction.h:30
LoadedBBAbstraction.h
node::GetLabelF
double GetLabelF(unsigned int index) const
Definition: Graph.h:215
Graph::printStats
void printStats()
Definition: Graph.cpp:467
std
Definition: CanonicalGraphEnvironment.h:26
GraphAbstractionConstants::kNodeBlocked
@ kNodeBlocked
Definition: GraphAbstraction.h:33
node::GetNum
unsigned int GetNum() const
Definition: Graph.h:176
LoadedBBAbstraction::GetNodeLoc
recVec GetNodeLoc(node *n) const
Definition: LoadedBBAbstraction.cpp:198
GraphAbstractionConstants::kParent
@ kParent
Definition: GraphAbstraction.h:27
node::GetLabelL
long GetLabelL(unsigned int index) const
Definition: Graph.h:220
node::getNeighborIter
neighbor_iterator getNeighborIter() const
Definition: Graph.cpp:802
LoadedBBAbstraction::abstractGraph
Graph * abstractGraph(Graph *g)
Definition: LoadedBBAbstraction.cpp:447
recVec::y
GLdouble y
Definition: GLUtil.h:98
LoadedBBAbstraction::findBoundingBox
int findBoundingBox(node *n)
Definition: LoadedBBAbstraction.cpp:498
LoadedBBAbstraction::AddNode
virtual void AddNode(node *n)
add node to abstraction
Definition: LoadedBBAbstraction.cpp:576
LoadedBBAbstraction::levelDraw
unsigned long levelDraw
Definition: LoadedBBAbstraction.h:70
LoadedBBAbstraction::Pathable
bool Pathable(node *from, node *to)
is there a legal path between these 2 nodes?
Definition: LoadedBBAbstraction.cpp:557
recVec::x
GLdouble x
Definition: GLUtil.h:98
LoadedBBAbstraction::h
double h(node *a, node *b)
heuristic cost between any two nodes
Definition: LoadedBBAbstraction.cpp:107
LoadedBBAbstraction::AddEdge
virtual void AddEdge(edge *e, unsigned int absLevel)
add edge to abstraction
Definition: LoadedBBAbstraction.cpp:580
LoadedBBAbstraction::buildAbstractions
void buildAbstractions(Graph *g)
Definition: LoadedBBAbstraction.cpp:415
LoadedBBAbstraction::BoundingBox::y2
double y2
Definition: LoadedBBAbstraction.h:57
VERSION
static const float VERSION
Definition: LinearRegression.cpp:20
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
LoadedBBAbstraction::OpenGLDraw
void OpenGLDraw() const
Definition: LoadedBBAbstraction.cpp:124
LoadedBBAbstraction::BoundingBox::OpenGLDraw
void OpenGLDraw() const
Definition: LoadedBBAbstraction.cpp:38
edge
Edge class for connections between node in a Graph.
Definition: Graph.h:129