Пример #1
0
void GridGraph::resize(int rows, int cols) {
    reset();
    rows_ = rows;
    cols_ = cols;

    for (int y = 0; y < rows; ++y) {
        for (int x = 0; x < cols; ++x) {
            VertexNumber v = getVertex(y, x);
            if (x < cols - 1) addArc(v, v + 1);
            if (y < rows - 1) addArc(v, v + cols);
        }
    }

    arcs.resize((rows - 1) * (cols - 1));

    for (int y = 0; y < rows - 1; ++y) {
        for (int x = 0; x < cols - 1; ++x) {
            auto& a = arcs[(cols - 1) * y + x];
            a.resize(4);
            a[0] = getArc(getVertex(y, x), getVertex(y, x + 1));
            a[1] = getArc(getVertex(y, x), getVertex(y + 1, x));
            a[2] = getArc(getVertex(y, x + 1), getVertex(y + 1, x + 1));
            a[3] = getArc(getVertex(y + 1, x), getVertex(y + 1, x + 1));
        }
    }

    setup();
}
Пример #2
0
static void absorbExtension(Node * node, Node * extension)
{
	Arc *arc;

	appendNodeGaps(node, extension, graph);
	appendDescriptors(node, extension);

	// Destroy old nodes    
	while (getArc(node) != NULL)
		destroyArc(getArc(node), graph);

	// Create new
	for (arc = getArc(extension); arc != NULL; arc = getNextArc(arc))
		createAnalogousArc(node, getDestination(arc), arc, graph);
}
Пример #3
0
void GridGraph::printAnswer(std::ostream& os,
        std::set<ArcNumber> const& answer) const {
    static char const* connector[] = { " ", "╴", "╶", "─", "╵", "┘", "└", "┴",
            "╷", "┐", "┌", "┬", "│", "┤", "├", "┼" };

    os << "┏";
    for (int x = 0; x < cols(); ++x) {
        os << "━";
    }
    os << "┓\n";

    for (int y = 0; y < rows(); ++y) {
        os << "┃";

        for (int x = 0; x < cols(); ++x) {
            int c = 0;
            if (x - 1 >= 0) {
                ArcNumber a = getArc(getVertex(y, x - 1), getVertex(y, x));
                if (answer.count(a)) c |= 1;
            }
            if (x + 1 < cols()) {
                ArcNumber a = getArc(getVertex(y, x), getVertex(y, x + 1));
                if (answer.count(a)) c |= 2;
            }
            if (y - 1 >= 0) {
                ArcNumber a = getArc(getVertex(y - 1, x), getVertex(y, x));
                if (answer.count(a)) c |= 4;
            }
            if (y + 1 < rows()) {
                ArcNumber a = getArc(getVertex(y, x), getVertex(y + 1, x));
                if (answer.count(a)) c |= 8;
            }
            os << connector[c];
        }

        os << "┃\n";
    }

    os << "┗";
    for (int x = 0; x < cols(); ++x) {
        os << "━";
    }
    os << "┛\n";
}
Пример #4
0
static boolean isLocalDeadEnd(Node * node)
{
	Arc *arc;

	for (arc = getArc(node); arc != NULL; arc = getNextArc(arc))
		if (getNodeStatus(getDestination(arc)) == 1)
			return false;

	return true;
}
Пример #5
0
int Scene::mouseDragged( shared_ptr<ViewInterface> in, int x, int y ) {
	if ( drag_bone && selectedBone >= 0 ) {
		GLdouble *p = skeleton->selectionCenter();
		glm::quat temp;

		// use old mouse position to find starting quaternion
		if (clickx > 0 && clicky > 0) {
			getArc( p[0], p[1], clickx, clicky, 200.0, temp );
			getBoneAlignment(temp, in->cameraAngle(), click_old);
			clickx = clicky = 0;
		}

		// modify bone orientation
		getArc( p[0], p[1], x, y, 200.0, temp );
		getBoneAlignment(temp, in->cameraAngle(), click_new);
		glm::quat drag = click_new * glm::inverse(click_old);
		player.animation[0].modSelection( time, selectedBone, drag );
		click_old = click_new;
		return true;
	}
	return false;
}
Пример #6
0
static void tourBusNode_local(Node * node)
{
	Arc *arc;
	Node *destination;
	Time nodeTime = getNodeTime(node);

	//velvetLog("Node %li %f %i %p\n", getNodeID(node),
	//       times[getNodeID(node) + nodeCount(graph)], simpleArcCount(node),
	//       node);

	for (arc = getArc(node); arc != NULL; arc = getNextArc(arc)) {
		destination = getDestination(arc);

		// Node doesn't belong to the marked node area 
		if (getNodeStatus(getDestination(arc)) != 1)
			continue;

		tourBusArc_local(node, arc, nodeTime);

		if (getNodeStatus(node) != 1)
			break;
	}
}
Пример #7
0
ASpreadSheetCell *SimTaDynSheet::isACell(std::string const& word)
{
  if (('A' != word[0]) && ('N' != word[0]) && ('Z' != word[0]))
    return nullptr;

  // Get the unique ID
  Key id = 0u;
  uint32_t i = 1u;
  while ((word[i] != '\0') && (word[i] >= '0') && (word[i] <= '9'))
    {
      id = id * 10U + word[i] - '0';
      ++i;
    }

  // End of the word
  if (word[i] == '\0')
    {
      if ('N' == word[0])
        {
          LOGI("Found Node %u", id);
          return &getNode(id);
        }
      if ('A' == word[0])
        {
          LOGI("Found Arc %u", id);
          return &getArc(id);
        }
      if ('Z' == word[0])
        {
          std::cerr << "Found Zone TODO " << id << std::endl;
          LOGI("Found Zone %u", id);
          return nullptr; // &getZone(id); //FIXME a finir
        }
    }

  return nullptr;
}
Пример #8
0
// Detects sequences that could be simplified through concatentation
// Iterates till graph cannot be more simplified
// Useless nodes are freed from memory and remaining ones are renumbered
void concatenateGraph(Graph * graph)
{
	IDnum nodeIndex;
	Node *node, *twin;

	velvetLog("Concatenation...\n");

	for (nodeIndex = 1; nodeIndex < nodeCount(graph); nodeIndex++) {
		node = getNodeInGraph(graph, nodeIndex);

		if (node == NULL)
			continue;

		twin = getTwinNode(node);
		while (simpleArcCount(node) == 1
		       &&
		       simpleArcCount(getTwinNode
				      (getDestination(getArc(node)))) ==
		       1) {
			if (getDestination(getArc(node)) == twin
			    || getDestination(getArc(node)) == node)
				break;
			concatenateStringOfNodes(node,
					 graph);
		}

		while (simpleArcCount(twin) == 1
		       &&
		       simpleArcCount(getTwinNode
				      (getDestination(getArc(twin)))) ==
		       1) {
			if (getDestination(getArc(twin)) == node
			    || getDestination(getArc(twin)) == twin)
				break;
			concatenateStringOfNodes(twin,
					 graph);
		}
	}

	renumberNodes(graph);
	sortGapMarkers(graph);
	velvetLog("Concatenation over!\n");
}
Пример #9
0
int main(int argc, char *argv[]) {

   int discipline[6] = {STUDENT_THD, STUDENT_BPS, STUDENT_BQN,
                        STUDENT_MJ, STUDENT_MTV, STUDENT_MMONEY}
   int dice[6] = {1, 2, 3, 4, 5, 6}

   newGame(*discipline[], dice[]);

   //Tests void makeAction
   action a;
   a.actionCode = BUILD_CAMPUS;
   a.destination = L;
   a.disciplineFrom = STUDENT_BPS;
   a.disciplineTo = STUDENT_MTV;
   
   assert(a.actionCode == BUILD_CAMPUS);
   assert(a.destination == L);
   assert(a.disciplineFrom == STUDENT_BPS);
   assert(a.discplineTo == STUDENT_MTV);




   //Tests void throwDice
   assert(diceScore >= 2 && diceScore <= 12);

   //Tests int getDiscipline
   assert (getDiscipline(Game g, 0) == STUDENT_BGN); 
   assert (getDiscipline(Game g, 1) == STUDENT_MMONEY);
   assert (getDiscipline(Game g, 2) == STUDENT_MJ);
   assert (getDiscipline(Game g, 3) == STUDENT_MMONEY);
   assert (getDiscipline(Game g, 4) == STUDENT_MJ); 
   assert (getDiscipline(Game g, 5) == STUDENT_BPS);
   assert (getDiscipline(Game g, 6) == STUDENT_MTV);
   assert (getDiscipline(Game g, 7) == STUDENT_MTV);
   assert (getDiscipline(Game g, 8) == STUDENT_BPS);
   assert (getDiscipline(Game g, 9) == STUDENT_MTV);
   assert (getDiscipline(Game g, 10) == STUDENT_BQN);
   assert (getDiscipline(Game g, 11) == STUDENT_MJ);
   assert (getDiscipline(Game g, 12) == STUDENT_BQN);
   assert (getDiscipline(Game g, 13) == STUDENT_THD);
   assert (getDiscipline(Game g, 14) ==  STUDENT_MJ);
   assert (getDiscipline(Game g, 15) == STUDENT_MMONEY);
   assert (getDiscipline(Game g, 16) == STUDENT_MTV);
   assert (getDiscipline(Game g, 17) == STUDENT_BQN);
   assert (getDiscipline(Game g, 18) == STUDENT_BPS);

   //Tests int getDiceValue
   assert (getDiceValue(Game g, 0) == 9); 
   assert (getDiceVale(Game g, 1) == 10);
   assert (getDicevalue(Game g, 2) == 8);
   assert (getDiceValue(Game g, 3) == 12);
   assert (getDiceValue(Game g, 4) == 6); 
   assert (getDiceValue(Game g, 5) == 5);
   assert (getDiceValue(Game g, 6) == 3);
   assert (getDiceValue(Game g, 7) == 11);
   assert (getDiceValue(Game g, 8) == 3);
   assert (getDiceValue(Game g, 9) == 11);
   assert (getDiceValue(Game g, 10) == 4);
   assert (getDiceValue(Game g, 11) == 6);
   assert (getDiceValue(Game g, 12) == 4);
   assert (getDiceValue(Game g, 13) == 7);
   assert (getDiceValue(Game g, 14) ==  9);
   assert (getDiceValue(Game g, 15) == 2);
   assert (getDiceValue(Game g, 16) == 8);
   assert (getDiceValue(Game g, 17) == 10);
   assert (getDiceValue(Game g, 18) == 5);



   //Tests int getMostARCs (Game g)
   assert(getMostARCs(newGame) == NO_ONE);

   //Tests int getMostPublications (Game g)
   assert(getMostPublications(newGame) == No_ONE);

   //Tests int getTurnNumber (Game g)
   assert(getTurnNumber(newGame) == -1);

   //Tests int getWhoseTurn (Game g)
   assert(getWhoseTurn(newGame) == NO_ONE);

   //Tests int getCampus(Game g, path pathToVertex)
   assert (getCampus(Game g, path {\0}) == CAMPUS_A);
   assert (getCampus(Game g, path {‘R’, ‘R’, ‘L’, ‘R’, ‘L’,\0}) == CAMPUS_B);
   assert (getCampus(Game g, path {‘L’, ‘R’, ‘L’, ‘R’, ‘L’, ‘R’,\0}) == CAMPUS_C);


   //Tests int getARC(Game g, path pathToEdge)
   assert (getARC(Game g, path {\0}) == VACANT_ARC);
   assert (getARC(Game g, path {‘R’,\0}) == ARC A);
   assert (getARC(Game g, path {‘R’, ‘R’, ‘L’, ‘R’, ‘L’, ‘L’,\0}) == ARC B);
   assert (getARC(Game g, path {‘L’, ‘R’, ‘L’, ‘R’, ‘L’, ‘R’, ‘B’,\0}) == ARC C);


   //Tests int isLegalAction (Game g, action a)
   if (actionCode != PASS) {
      assert (actionCode >= 0 && actionCode <= 7);

      if (actionCode == BUILD_CAMPUS) {
         assert ((sizeof(destination)-1)/4 >= 0 && (sizeof(destination) - 1)/4 <= PATH_LIMIT);
         assert (getCampus(Game g, path destination) == VACANT_VERTEX);
         assert (getArc(Game g, (destination + 'B')) == ARC_A &&
                 getCampus(Game g, (destination + 'L')) == VACANT_VERTEX &&
                 getCampus(Game g, (destination + 'R')) == VACANT_VERTEX);
         assert (students[STUDENT_BPS] >= 1);
         assert (students[STUDENTS_BQN] >= 1);
         assert (students[STUDENTS_MJ] >= 1);
         assert (students[STUDENTS_MTV] >= 1);
      }
      
      if (actionCode == BUILD_GO8) {
         assert ((sizeof(destination)-1)/4 >= 0 && (sizeof(destination) - 1)/4 <= PATH_LIMIT);
         assert (getCampus(Game g, path destination) == CAMPUS_A);
         assert (students[STUDENTS_MJ] >= 2);
         assert (students[STUDENTS_MMONEY] >= 3);         
      }
      
      if (actionCode == OBTAIN_ARC) {
         assert ((sizeof(destination)-1)/4 >= 0 && (sizeof(destination) - 1)/4 <= PATH_LIMIT);
         assert (getArc(Game g, (destination + 'B')) == ARC_A);
      }
      
      if (actionCode == START_SPINNOFF) {
         assert (students[STUDENT_MJ] >= 1);
         assert (students[STUDENT_MTV] >= 1);
         assert (students[STUDENT_MMONEY] >= 1);
      }
      
      if (actionCode == RETRAIN_STUDENTS) {
         assert (students[disciplineFrom] >= getExchangeRate(Game g, int player, 
                 int disciplineFrom, int disciplineTo));
         assert (disciplineFrom != STUDENT_THD);
         assert (disciplineTo != STUDENT_THD);
      }
Пример #10
0
static NodeList *pathIsClear(Node * node, Node * oppositeNode,
			     Coordinate distance)
{
	Arc *arc;
	Node *candidate, *dest, *current;
	Coordinate extension_distance = 0;
	boolean maxRepeat = 1;
	Node *repeatEntrance = NULL;
	IDnum counter = 0;
	NodeList *path = NULL;
	NodeList *tail = path;

	setSingleNodeStatus(node, 2);

	current = node;
	while (true) {

		//////////////////////////////////
		//  Selecting destination       //
		//////////////////////////////////
		candidate = NULL;

		// First round for priority nodes
		for (arc = getArc(current); arc != NULL;
		     arc = getNextArc(arc)) {
			dest = getDestination(arc);

			if (dest == node || dest == getTwinNode(node))
				continue;

			if (getNodeStatus(dest) <= 0)
				continue;

			if (candidate == NULL
			    || getNodeStatus(candidate) >
			    getNodeStatus(dest)
			    || (getNodeStatus(candidate) ==
				getNodeStatus(dest)
				&& extension_distance >
				localScaffold[getNodeID(dest) +
					      nodeCount(graph)].
				distance - getNodeLength(dest) / 2)) {
				extension_distance =
				    localScaffold[getNodeID(dest) +
						  nodeCount(graph)].
				    distance - getNodeLength(dest) / 2;
				candidate = dest;
			}
		}

		// In case of failure   
		if (candidate == NULL) {
			for (arc = getArc(current); arc != NULL;
			     arc = getNextArc(arc)) {
				dest = getDestination(arc);

				if (getNodeStatus(dest) == 0)
					continue;

				if (dest == node
				    || dest == getTwinNode(node))
					continue;

				if (candidate == NULL
				    || getNodeStatus(candidate) <
				    getNodeStatus(dest)
				    || (getNodeStatus(candidate) ==
					getNodeStatus(dest)
					&& extension_distance <
					localScaffold[getNodeID(dest) +
						      nodeCount(graph)].
					distance -
					getNodeLength(dest) / 2)) {
					extension_distance =
					    localScaffold[getNodeID(dest) +
							  nodeCount
							  (graph)].
					    distance -
					    getNodeLength(dest) / 2;
					candidate = dest;
				}
			}
		}
		if (candidate == NULL) {
			while (path) {
				tail = path->next;
				deallocateNodeList(path);
				path = tail;
			}
			return false;
		}
		// Loop detection
		if (candidate == repeatEntrance
		    && abs_bool(getNodeStatus(candidate)) ==
		    maxRepeat + 1) {
			while (path) {
				tail = path->next;
				deallocateNodeList(path);
				path = tail;
			}
			return false;
		} else if (abs_bool(getNodeStatus(candidate)) > maxRepeat) {
			maxRepeat = abs_bool(getNodeStatus(candidate));
			repeatEntrance = candidate;
		} else if (abs_bool(getNodeStatus(candidate)) == 1) {
			maxRepeat = 1;
			repeatEntrance = NULL;
		}

		if (getNodeStatus(candidate) > 0)
			setSingleNodeStatus(candidate,
					    getNodeStatus(candidate) + 1);
		else
			setSingleNodeStatus(candidate,
					    getNodeStatus(candidate) - 1);


		if (abs_bool(getNodeStatus(candidate)) > 100
		    || counter > nodeCount(graph)) {
			while (path) {
				tail = path->next;
				deallocateNodeList(path);
				path = tail;
			}
			return false;
		}

		// Missassembly detection
		if (getUniqueness(candidate) && oppositeNode
		    && candidate != oppositeNode
		    && extension_distance > distance) {
			while (path) {
				tail = path->next;
				deallocateNodeList(path);
				path = tail;
			}
			return false;
		}

		if (path == NULL) {
			path = allocateNodeList();
			path->next = NULL;
			path->node = candidate;
			tail = path;
		} else {
			tail->next = allocateNodeList();
			tail = tail->next;
			tail->node = candidate;
			tail->next = NULL;
		}

		if (getUniqueness(candidate))
			return path;

		current = candidate;
	}
}
Пример #11
0
// Replaces two consecutive nodes into a single equivalent node
// The extra memory is freed
void concatenateNodes(Node * nodeA, Node * nodeB, Graph * graph)
{
	PassageMarkerI marker, tmpMarker;
	Node *twinA = getTwinNode(nodeA);
	Node *twinB = getTwinNode(nodeB);
	Arc *arc;
	Category cat;

	// Arc management:
	// Freeing useless arcs
	while (getArc(nodeA) != NULL)
		destroyArc(getArc(nodeA), graph);

	// Correct arcs
	for (arc = getArc(nodeB); arc != NULL; arc = getNextArc(arc)) {
		if (getDestination(arc) != twinB)
			createAnalogousArc(nodeA, getDestination(arc),
					   arc, graph);
		else
			createAnalogousArc(nodeA, twinA, arc, graph);
	}

	// Passage marker management in node A:
	for (marker = getMarker(nodeA); marker != NULL_IDX;
	     marker = getNextInNode(marker))
		if (isTerminal(marker))
			incrementFinishOffset(marker,
					      getNodeLength(nodeB));

	// Swapping new born passageMarkers from B to A
	for (marker = getMarker(nodeB); marker != NULL_IDX; marker = tmpMarker) {
		tmpMarker = getNextInNode(marker);

		if (isInitial(marker)
		    || getNode(getPreviousInSequence(marker)) != nodeA) {
			extractPassageMarker(marker);
			transposePassageMarker(marker, nodeA);
			incrementFinishOffset(getTwinMarker(marker),
					      getNodeLength(nodeA));
		} else
			disconnectNextPassageMarker(getPreviousInSequence
						    (marker), graph);
	}

	// Read starts
	concatenateReadStarts(nodeA, nodeB, graph);

	// Gaps
	appendNodeGaps(nodeA, nodeB, graph);

	// Descriptor management (node)
	appendDescriptors(nodeA, nodeB);

	// Update uniqueness:
	setUniqueness(nodeA, getUniqueness(nodeA) || getUniqueness(nodeB));

	// Update virtual coverage
	for (cat = 0; cat < CATEGORIES; cat++)
		incrementVirtualCoverage(nodeA, cat,
					 getVirtualCoverage(nodeB, cat));

	// Update original virtual coverage
	for (cat = 0; cat < CATEGORIES; cat++)
		incrementOriginalVirtualCoverage(nodeA, cat,
						 getOriginalVirtualCoverage
						 (nodeB, cat));

	// Freeing gobbled node
	destroyNode(nodeB, graph);
}
Пример #12
0
// Replaces two consecutive nodes into a single equivalent node
// The extra memory is freed
void concatenateStringOfNodes(Node * nodeA, Graph * graph)
{
	Node *twinA = getTwinNode(nodeA);
	Node * nodeB = nodeA;
	Node * twinB;
	Node *currentNode, *nextNode;
	Coordinate totalLength = 0;
	PassageMarkerI marker, tmpMarker;
	Arc *arc;
	Category cat;

	while (simpleArcCount(nodeB) == 1
	       &&
	       simpleArcCount(getTwinNode
			      (getDestination(getArc(nodeB)))) ==
	       1
	       && getDestination(getArc(nodeB)) != getTwinNode(nodeB)
	       && getDestination(getArc(nodeB)) != nodeA) {
		totalLength += getNodeLength(nodeB);
		nodeB = getDestination(getArc(nodeB));
	}
	twinB = getTwinNode(nodeB);
	totalLength += getNodeLength(nodeB);
	reallocateNodeDescriptor(nodeA, totalLength);

	currentNode = nodeA;
	while (currentNode != nodeB) {		
		currentNode = getDestination(getArc(currentNode));

		// Passage marker management in node A:
		for (marker = getMarker(nodeA); marker != NULL_IDX;
		     marker = getNextInNode(marker))
			if (getNode(getNextInSequence(marker)) != currentNode)
				incrementFinishOffset(marker,
						      getNodeLength(currentNode));

		// Swapping new born passageMarkers from B to A
		for (marker = getMarker(currentNode); marker != NULL_IDX; marker = tmpMarker) {
			tmpMarker = getNextInNode(marker);

			if (isInitial(marker)
			    || getNode(getPreviousInSequence(marker)) != nodeA) {
				extractPassageMarker(marker);
				transposePassageMarker(marker, nodeA);
				incrementFinishOffset(getTwinMarker(marker),
						      getNodeLength(nodeA));
			} else
				disconnectNextPassageMarker(getPreviousInSequence
							    (marker), graph);
		}

		// Read starts
		concatenateReadStarts(nodeA, currentNode, graph);

		// Gaps
		appendNodeGaps(nodeA, currentNode, graph);

		// Update uniqueness:
		setUniqueness(nodeA, getUniqueness(nodeA) || getUniqueness(currentNode));

		// Update virtual coverage
		for (cat = 0; cat < CATEGORIES; cat++)
			incrementVirtualCoverage(nodeA, cat,
						 getVirtualCoverage(currentNode, cat));

		// Update original virtual coverage
		for (cat = 0; cat < CATEGORIES; cat++)
			incrementOriginalVirtualCoverage(nodeA, cat,
							 getOriginalVirtualCoverage
							 (currentNode, cat));
		// Descriptor management (node)
		directlyAppendDescriptors(nodeA, currentNode, totalLength);
	}

	// Correct arcs
	for (arc = getArc(nodeB); arc != NULL; arc = getNextArc(arc)) {
		if (getDestination(arc) != twinB)
			createAnalogousArc(nodeA, getDestination(arc),
					   arc, graph);
		else
			createAnalogousArc(nodeA, twinA, arc, graph);
	}

	// Freeing gobbled nodes
	currentNode = getTwinNode(nodeB);
	while (currentNode != getTwinNode(nodeA)) {
		arc = getArc(currentNode);
		nextNode = getDestination(arc);
		destroyNode(currentNode, graph);
		currentNode = nextNode;
	}
}
Пример #13
0
static Node *bypass()
{
	Node *bypass = getNode(path);
	Node *next = NULL;
	Arc *arc;
	PassageMarkerI nextMarker;

	// Remove unwanted arcs
	while (getArc(bypass) != NULL)
		destroyArc(getArc(bypass), graph);

	// Update extensive variables (length + descriptors + passage markers)
	while (!isTerminal(path)) {
		nextMarker = getNextInSequence(path);
		next = getNode(nextMarker);
		while (next == bypass) {
			disconnectNextPassageMarker(path, graph);
			destroyPassageMarker(nextMarker);
			nextMarker = getNextInSequence(path);
			next = getNode(nextMarker);
		}

		if (next == NULL)
			return bypass;

		// Overall node update 
		if (!getUniqueness(next)) {
			adjustShortReads(bypass, getNextInSequence(path));
			appendSequence(bypass, sequences,
				       getNextInSequence(path), graph);
		} else {
			concatenateReadStarts(bypass, next, graph);

#ifndef SINGLE_COV_CAT
			Category cat;
			for (cat = 0; cat < CATEGORIES; cat++) {
				// Update virtual coverage
				incrementVirtualCoverage(bypass, cat,
							 getVirtualCoverage(next, cat));
				// Update original virtual coverage
				incrementOriginalVirtualCoverage(bypass, cat,
								 getOriginalVirtualCoverage(next, cat));
			}
#else
			incrementVirtualCoverage(bypass, getVirtualCoverage(next));
#endif
			appendDescriptors(bypass, next);
		}

		// Members
		updateMembers(bypass, next);

		// Termination 
		if (isTerminal(path) || getUniqueness(next))
			break;
	}

	// Remove unique groupies from arrival 
	admitGroupies(next, bypass);

	// Copy destination arcs
	for (arc = getArc(next); arc != NULL; arc = getNextArc(arc)) {
		if (getDestination(arc) == next)
			continue;
		else if (getDestination(arc) == getTwinNode(next))
			createAnalogousArc(bypass, getTwinNode(bypass),
					   arc, graph);
		else
			createAnalogousArc(bypass, getDestination(arc),
					   arc, graph);
	}

	destroyNode(next, graph);

	return bypass;
}
Пример #14
0
 bool westArcTaken(int y, int x) const {
     VertexNumber v1 = getVertex(y, x, rot);
     VertexNumber v2 = getVertex(y + 1, x, rot);
     return arcTaken(getArc(v1, v2));
 }
Пример #15
0
void Camera::mouseDragRotation(int x1, int y1, int x2, int y2) {
	getArc(arcball_x, arcball_y, x1, y1, arcball_radius, click_old); // initial click down
	getArc(arcball_x, arcball_y, x2, y2, arcball_radius, click_new);
	rotate( click_new * glm::inverse(click_old) );
	modified = true;
}