void DiGraph::addEdge(int v, int w) { checkVertex(v); checkVertex(w); if (!alreadyConnected(v, w)) vertecies[v].push_back(w); }
Bound::Bound(const mlVector3D & p1, const mlVector3D & p2, const mlVector3D & p3) { xMax = xMin = p1.x; yMax = yMin = p1.y; zMax = zMin = p1.z; checkVertex(p2); checkVertex(p3); }
Bound::Bound(VectorSet * vertices) { xMax = xMin = vertices->GetVector(0).x; yMax = yMin = vertices->GetVector(0).y; zMax = zMin = vertices->GetVector(0).z; for(int i=1;i<vertices->GetSize();i++) { checkVertex(vertices->GetVector(i)); } }
GraphVertex* GraphVertex::nextVertx(Direcction direction, GraphVertex* actualVertx) { GraphVertex *nextVertex = NULL; if (actualVertx){ for (GraphEdge* e : actualVertx->getEdges()) { if (!checkVertex(e->getDestination(), "CageDoor")) { switch (direction) { case Direcction::UP: if (actualVertx->getData().getPosition().z < e->getDestination()->getData().getPosition().z) { nextVertex = e->getDestination(); } break; case Direcction::DOWN: if (actualVertx->getData().getPosition().z > e->getDestination()->getData().getPosition().z) { nextVertex = e->getDestination(); } break; case Direcction::RIGHT: if (actualVertx->getData().getPosition().x < e->getDestination()->getData().getPosition().x) { nextVertex = e->getDestination(); } break; case Direcction::LEFT: if (actualVertx->getData().getPosition().x > e->getDestination()->getData().getPosition().x) { nextVertex = e->getDestination(); } break; } } } } return nextVertex; }
int DiGraph::degree(int v) const { checkVertex(v); return vertecies[v].size(); }
DiGraph::EdgesList DiGraph::getAdjacentVertex(int v) const { checkVertex(v); return vertecies[v]; }