Example #1
0
void generation2(StarCatalog cat, const char * fname2, Triangle central, double avg, clock_t mainStart){

	clock_t start = clock() / (double)CLOCKS_PER_SEC * 1000; 		//###
	clock_t end = clock() / (double)CLOCKS_PER_SEC * 1000; 			//###
	cout << "Creating triangle vector" << endl;
	TriangleCatalog tcat;
	tcat.createCatalog(cat, avg);
	end = clock() / (double)CLOCKS_PER_SEC * 1000; 					//###
	cout << "\t#t#Trianglevector completed after " << end-start << "ms" << endl;
	cout << "__________________________________________________________________________" << endl;
	
	cout << "Vectorsearching" << endl;
	Vector3D solutionAngles(0,0,0);
	RID3 solutionIDs(0,0,0);
	double thres = 0;																								//
	int matchID = 0;																								//
	clock_t vstart = clock() / (double)CLOCKS_PER_SEC * 1000; 		//###
	while(!tcat.containsTriangle(central, thres, &solutionAngles, &solutionIDs, &matchID) && thres < 0.01) thres += 0.000001;	//iteratives vergroessern des Suchthresholds
	clock_t vend = clock() / (double)CLOCKS_PER_SEC * 1000; 		//###
	TriangleEntry tmatch = tcat.at(matchID);
	
	if(thres >= 0.01) cout << "--search inconclusive after " << vend-vstart << "ms" << endl;
	else{
		cout << "\t#t#Vectorsearch was conclusive after " << vend-vstart << "ms" << endl;
		cout << "-Match accuracy: " << thres*180/M_PI << "°(deg) = " << thres*180/M_PI*3600 << "\"(arcsec)" <<  " = " << thres << " rad = " << thres/avg << " pixel-units"  << endl;
		cout << "-Alphas: " << solutionAngles.c[0] << " " << solutionAngles.c[1] << " " << solutionAngles.c[2] << endl;
		cout << "-Beta: " << acos(-0.5*(tmatch.getD(0)*tmatch.getD(0) - tmatch.getD(1)*tmatch.getD(1) - tmatch.getD(2)*tmatch.getD(2))/(tmatch.getD(1)*tmatch.getD(2))) << endl;
		cout << "-Solution IDs: " << cat.getMainCatalog().at(solutionIDs.rID[0]).getID() << " " << cat.getMainCatalog().at(solutionIDs.rID[1]).getID() << " " << cat.getMainCatalog().at(solutionIDs.rID[2]).getID() << endl;
	cout << "__________________________________________________________________________" << endl;
	double mainstar[3];
	mainstar[0]=cat.getMainCatalog().at(solutionIDs.rID[0]).getE(0);
	mainstar[1]=cat.getMainCatalog().at(solutionIDs.rID[0]).getE(1);
	mainstar[2]=cat.getMainCatalog().at(solutionIDs.rID[0]).getE(2);
	//cout<<mainstar[0]<<" "<<mainstar[1]<<" "<<mainstar[2]<<endl;

	double nextstar[3];
	nextstar[0]=cat.getMainCatalog().at(solutionIDs.rID[1]).getE(0);
	nextstar[1]=cat.getMainCatalog().at(solutionIDs.rID[1]).getE(1);
	nextstar[2]=cat.getMainCatalog().at(solutionIDs.rID[1]).getE(2);
	//cout<<nextstar[0]<<" "<<nextstar[1]<<" "<<nextstar[2]<<endl;
	Rotation r;
	r.getRotationmatrix(mainstar,nextstar);
	r.printRotor(1);
	quaternion quat= r.getQuaternion(mainstar,nextstar);
	r.printQuat(quat,1);
	cout << "__________________________________________________________________________" << endl;
	}
}