int main()
{
	srand((unsigned)time(NULL));
	string playerName;
	int nrOfCardDecks = 1;
	int cardSum = 0;
	int cardPos = 0;
	Card lastCard;

	Card cardDeck[SIZE];

	makeCardDeck(cardDeck);
	shuffleCardDeck(cardDeck);
	
	CircularList<Player> players;

	addPlayers(players);
	cout<<endl;
	cardPos = dealCards(cardDeck, players);
	
	while (players.size() > 1)
	{
		cout<<"Ny runda"<<endl;

		cardSum = 0;
		while (handleCurrentPlayer(cardDeck, cardPos, players, cardSum));
		
		cout<<players.currentItem().getName()<<" förlorade dennna runda"<<endl;
		players.remove(players.currentItem());
		// ny giv
		shuffleCardDeck(cardDeck);
		cardPos = dealCards(cardDeck, players);
	}

	cout<<"Segrare :"<<players.currentItem().getName()<<endl;

	return 0;	
}
	QPixmap RectificationController::toAffineFromProjection(ClickableLabel* projectedImageLabel)
	{
		CircularList<SelectedPixel*>* points = projectedImageLabel->getSelectedPixels();
		if (points->size() != 8)
		{
			throw logic_error("8 points that define two pairs of parallel lines in affine space should be"
				"selected in the label"
			);
		}
		
		vector<pair<VectorXd, VectorXd>> parallelPairs = pointsToLinesPairs(projectedImageLabel);
		
		AffineFromProjRectificator rectificator(parallelPairs);
		MatrixXd projToAffine = *rectificator.getTransformation();
		
		// Qt uses the transpose of the usual transformation representation.
		QTransform qProjToAffine(
			projToAffine(0, 0), projToAffine(1, 0), projToAffine(2, 0),
			projToAffine(0, 1), projToAffine(1, 1), projToAffine(2, 1),
			projToAffine(0, 2), projToAffine(1, 2), projToAffine(2, 2)
		);
		
		return projectedImageLabel->pixmap()->transformed(qProjToAffine, Qt::SmoothTransformation);
	}
	QPixmap RectificationController::toSimilarityFromProjection(ClickableLabel* projectionImageLabel)
	{
		CircularList<SelectedPixel*>* points = projectionImageLabel->getSelectedPixels();
		if (points->size() != 20)
		{
			throw logic_error("20 points that define five pairs of orthogonal lines in similarity space should be"
				"selected in the label."
			);
		}
		
		vector<pair<VectorXd, VectorXd>> orthoPairs = pointsToLinesPairs(projectionImageLabel);
		SimilarityFromProjRectificator rectificator = SimilarityFromProjRectificator(orthoPairs);
		
		MatrixXd projToSimilarity = *rectificator.getTransformation();
		
		// Qt uses the transpose of the usual transformation representation.
		QTransform qProjToSimilarity(
			projToSimilarity(0, 0), projToSimilarity(1, 0), projToSimilarity(2, 0),
			projToSimilarity(0, 1), projToSimilarity(1, 1), projToSimilarity(2, 1),
			projToSimilarity(0, 2), projToSimilarity(1, 2), projToSimilarity(2, 2)
		);
		
		return projectionImageLabel->pixmap()->transformed(qProjToSimilarity, Qt::SmoothTransformation);
	}
Ejemplo n.º 4
0
void GfxCanvas::dumpTiming()
{
    for(int ii = 0; ii < gfxCanvasTiming.size(); ++ii)
        qWarning() << gfxCanvasTiming[ii].first << gfxCanvasTiming[ii].second;
    gfxCanvasTiming.clear();
}