示例#1
0
main(){
if(!DEBUG){freopen("transform.in","r",stdin);
freopen("transform.out","w",stdout);}
scanf("%d%c",&n,&before[0][0]);
for(i=0;i<n;i++)scanf("%s",before[i]);
for(i=0;i<n;i++)scanf("%s",after[i]);
if(tran1())puts("1");
else if(tran2())puts("2");
else if(tran3())puts("3");
else if(tran4())puts("4");
else if(tran6())puts("6");
else if(tran1() || tran2() || tran3())puts("5");
else puts("7");
if(DEBUG)scanf(" ");
}
示例#2
0
/* calc observation matrix Q for given observer*/
void
findQ(void)
{
	vec1	alpha, beta, gamma, v, w;
	double	E[5][5];
	double	F[5][5];
	double	G[5][5];
	double	H[5][5];
	double	U[5][5];

	/* calc translation matrix F*/
	tran3(eye.x, eye.y, eye.z, F);

	/* calc rotation matrix G*/
	alpha = angle(-direct.x, -direct.y);
	rot3(3, alpha, G);

	/* calc rotation matrix H*/
	v = sqrt(direct.x*direct.x + direct.y*direct.y);
	beta = angle(-direct.z, v);
	rot3(2, beta, H);

	/* calc rotation matrix U*/
	w = sqrt(v*v + direct.z*direct.z);
	gamma = angle(-direct.x*w, direct.y*direct.z);
	rot3(3, -gamma, U);

	/* combine the transformations to find Q*/
	mult3(G, F, Q);
	mult3(H, Q, E);
	mult3(U, E, Q);
}