Exemplo n.º 1
0
/* create ghosts by filling values */
void createGhosts(void) {
  startZ += NodesPerLine / 2;

  // create red ghost going down
  Ghosts[0].alive = 1;
  Ghosts[0].r = 1.;
  Ghosts[0].g = 0.;
  Ghosts[0].b = 0.; 
  Ghosts[0].xMov = 0; 
  Ghosts[0].yMov = -1; 
  Ghosts[0].ghostTimer = ghostRandomTime; 
  Ghosts[0].cur = findStartNode(startX, startZ);
  checkStartDirection(&Ghosts[0]);

  // create cyan ghost going up
  startZ++;
  Ghosts[1].alive = 1;
  Ghosts[1].r = 0.;
  Ghosts[1].g = 1.;
  Ghosts[1].b = 1.; 
  Ghosts[1].xMov = 0; 
  Ghosts[1].yMov = 1; 
  Ghosts[1].ghostTimer = ghostRandomTime; 
  Ghosts[1].cur = findStartNode(startX, startZ);
  checkStartDirection(&Ghosts[1]);

  // create orange ghost going right
  startX++;
  Ghosts[2].alive = 1;
  Ghosts[2].r = 1.;
  Ghosts[2].g = 0.5;
  Ghosts[2].b = 0.; 
  Ghosts[2].xMov = 1; 
  Ghosts[2].yMov = 0; 
  Ghosts[2].ghostTimer = ghostRandomTime; 
  Ghosts[2].cur = findStartNode(startX, startZ);
  checkStartDirection(&Ghosts[2]);

  // create pink ghost going left
  startX -= 2;
  Ghosts[3].alive = 1;
  Ghosts[3].r = 1.;
  Ghosts[3].g = 0.5;
  Ghosts[3].b = 0.5; 
  Ghosts[3].xMov = -1; 
  Ghosts[3].yMov = 0; 
  Ghosts[3].ghostTimer = ghostRandomTime; 
  Ghosts[3].cur = findStartNode(startX, startZ);
  checkStartDirection(&Ghosts[3]);
}
Exemplo n.º 2
0
/**
 * This function takes a list of elements that include connected
 * compartments, and constructs a tree of nodes out of them. The 
 * generated nodes vector starts with the soma, and is a depth-first
 * sequence of nodes. This is meant to be insensitive to vagaries
 * in how the user has set up the compartment messaging, provided that 
 * there is at least one recognized message between connected compartments.
 *
 * static function.
 */
void NeuroNode::buildTree( 
				vector< NeuroNode >& nodes, vector< ObjId > elist )
{
	nodes.clear();
	map< Id, unsigned int > nodeMap;
	for ( vector< ObjId >::iterator 
		i = elist.begin(); i != elist.end(); ++i ) {
		if ( i->element()->cinfo()->isA( "Compartment" ) )
			nodes.push_back( NeuroNode( *i ) );
	}
	if ( nodes.size() <= 1 )
		return;
	for ( unsigned int i = 0; i < nodes.size(); ++i )
		nodeMap[ nodes[i].elecCompt() ] = i;
	for ( unsigned int i = 0; i < nodes.size(); ++i )
		nodes[i].findConnectedCompartments( nodeMap );
	removeDisconnectedNodes( nodes );
	unsigned int start = findStartNode( nodes );
	traverse( nodes, start );
}