Exemplo n.º 1
0
void DiGraph::addEdge(int v, int w)
{
	checkVertex(v);
	checkVertex(w);
	if (!alreadyConnected(v, w))
		vertecies[v].push_back(w); 
}
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
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));
	}
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
int DiGraph::degree(int v) const
{
	checkVertex(v);
	return vertecies[v].size();
}
Exemplo n.º 6
0
DiGraph::EdgesList DiGraph::getAdjacentVertex(int v) const
{
	checkVertex(v);
	return vertecies[v];
}