Пример #1
0
void CAMERA::Update()
{
	position = position + pos_vel;
	
	/*if (strcmp(cam_mode.c_str(), "chase") == 0)
		Chase(entities.entity_array[chase_ent]);
	else if (strcmp(cam_mode.c_str(), "cockpit") == 0)
	{
		dir = entities.entity_array[chase_ent].dir.ReturnConjugate();
		position.x = -entities.entity_array[chase_ent].x;
		position.y = -entities.entity_array[chase_ent].y;
		position.z = -entities.entity_array[chase_ent].z;
	}*/
	
	//position.DebugPrint();
	
	GenerateTransform();
}
Пример #2
0
/*
Finish capture and run registration
*/
void MainWindow::on_CapDone_Btn()
{
	//disconnect pick callback
	m_3d_View->DisablePick();

	std::vector<double*> temp_dst;
	if (m_3d_View->GetMarkerList().size() == 0)
	{
		double a1[] = { 176.286, 195.733, 90.0183 };
		double a2[] = { 75.7988, 192.343, 88.1086 };
		double a3[] = { 124.12, 139.966, 167.357 };
		double a4[] = { 122.669, 40.1707, 116.375 };

		temp_dst.push_back(a1);
		temp_dst.push_back(a2);
		temp_dst.push_back(a3);
		temp_dst.push_back(a4);
	}
	else
	{
		temp_dst = m_3d_View->GetMarkerList();
	}
	//if (m_3d_View->GetMarkerList().size() != m_Marker_Capture->GetMarkerList().size())
	//{
	//	std::cout << "Markers invalid" << std::endl;
	//	m_3d_View->ClearMarkers();
	//	m_Marker_Capture->ClearMarkers();
	//}

	// start registration here
	auto temp_src = m_Marker_Capture->GetMarkerList();


	auto reg = vtkSmartPointer<vtkTrackingLandMarkRegistration>::New();
	reg->SetSourcePoints(temp_src);
	reg->SetTargetPoints(temp_dst);
	reg->GenerateTransform();
	auto res2 = reg->GetTransformMatrix();
	std::cout << "Result" << std::endl;
	std::cout << "Error is: " << reg->EstimateRegistrationError() << std::endl;
	for (int i = 0; i < 4; i++)
	{
		for (int j = 0; j < 4; j++)
			std::cout << res2->GetElement(i, j) << ",";
		std::cout << std::endl;
	}

	// a messagebox for user to accecpt or discard the error
	QMessageBox msgBox;
	msgBox.setWindowTitle("Register Box");
	QString msg = "Accept the registration error:\n   ";
	msg = msg + QString::number(reg->EstimateRegistrationError());
	msgBox.setInformativeText(msg);
	msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Discard);
	msgBox.setDefaultButton(QMessageBox::Yes);
	int ret = msgBox.exec();
	if (ret == QMessageBox::Yes)
	{
		m_3d_View->SetRegisterTransform(res2);
		//m_3d_View->SetLandMarks(temp_src,temp_dst);
	}
	else
	{
		m_Marker_Capture->ClearMarkers();
		m_3d_View->ClearMarkers();
	}
}