亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 3dconf.c

?? 攝影測量中的三維空間變換程序,供攝影測量初學者使用
?? C
?? 第 1 頁 / 共 2 頁
字號:

#include	<stdio.h>
#include	<stdlib.h>
#include	<string.h>
#include	<math.h>
#include	<conio.h>




/* Maximum numbers of common and unknown points. Change as needed */
#define		MAXCOM		200
#define		MAXUNK		400

#define     M_PI        3.141592653589793238

/* Macro to access upper triangular matrix stored as 1D array */
#define     INDUT(i,j)  ( (((j) * ((j)-1)) / 2) + i )

/* Macro to compute the square of a number */
#define		SQR(x)		((x)*(x))




typedef struct {
	char	name[16];
	double	xcon, ycon, zcon, xarb, yarb, zarb, xres, yres, zres;
} CommonPointType;

typedef struct {
	char	name[16];
	double	x, y, z;
} UnkPointType;

typedef struct {
    double  m11, m12, m13,
            m21, m22, m23,
            m31, m32, m33,
            so, sp, sk,
            co, cp, ck,
			st, ss, sa,
			ct, cs, ca;
} RotationMatrixType;




void ReadData( char *rootname, CommonPointType *ComPoints, UnkPointType *UnkPoints, 
			  int *Pnumcom, int *Pnumunk );
void InitApprox( CommonPointType *ComPoints, int numcom, double *params, FILE *outf);
void solve( double *a, double *b, int n, int invflag );
void RotationMatrixOPK(double omega, double phi, double kappa,
					   RotationMatrixType *PRotMat);
void RotationMatrixTSA(double tilt, double swing, double azimuth,
					   RotationMatrixType *PRotMat);
double FormNormals(double *norm, double *rhs, RotationMatrixType RotMat, 
				   CommonPointType *ComPoints, int numcom, double *params);
void FormAI( double AI[4][8], RotationMatrixType RotMat, double scale,
			double x, double y, double z );
void AddCorrections( double *rhs, double *params );
void PrintIter( double *rhs, double *params, CommonPointType *ComPoints, int numcom,
			   double s0, int iter, FILE *outf, char pnames[8][8] );
void PrintResults( FILE *outf, double *norm, double s0, double *params, int numunk,
				  UnkPointType *UnkPoints, char pnames[8][8] );
void pause(void);




void main(void)
{
	char				rootname[50], filename[50];
	int					numcom, numunk, iter=0, converge=0, diverge=0;
	double				s0=1.0e30, s0old, norm[29], rhs[8], params[8];
	CommonPointType		ComPoints[MAXCOM];
	UnkPointType		UnkPoints[MAXUNK];
	RotationMatrixType	RotMat;
	FILE				*outf;
	char				pnames[8][8] = {"", "scale", "omega", "phi", "kappa", 
										"Tx", "Ty", "Tz"};

	ReadData( rootname, ComPoints, UnkPoints, &numcom, &numunk );

	/* Open output file (use .out extension) */
	strcpy(filename, rootname);
	strcat(filename, ".out");
	outf = fopen(filename, "w");

	/* Compute initial approximations for unknown parameters */
	InitApprox( ComPoints, numcom, params, outf );

	do {
		iter++;         /* Increment iteration count */
		s0old = s0;     /* Save former value of s0 for convergence test */
		/* Compute rotation matrix elements */
		RotationMatrixOPK( params[2], params[3], params[4], &RotMat); 
		s0 = FormNormals(norm, rhs, RotMat, ComPoints, numcom, params);
		printf("ITERATION %d     S0 = %6.5lf\n", iter, s0);

		/* Check for convergence or divergence */
		if (fabs(s0old-s0)/s0 < 0.0001) converge=1;
		else if (s0 > s0old) diverge=1;

		/* Solve for corrections
		   If converged or diverged call for inverse also */
		solve(norm, rhs, 7, converge|diverge);
		AddCorrections( rhs, params );
		PrintIter( rhs, params, ComPoints, numcom, s0, iter, outf, pnames );
	} while (!converge && !diverge);
	
	PrintResults( outf, norm, s0, params, numunk, UnkPoints, pnames );

	fclose(outf);
	pause();
}




void ReadData( char *rootname, CommonPointType *ComPoints, UnkPointType *UnkPoints, 
			  int *Pnumcom, int *Pnumunk )
{
    char    filename[50], tempstr[50];
    FILE    *infile;
    int     done;

	/* Get name of input file and open if it exists */
    printf("Enter root name of data file (.dat assumed) --> ");
    scanf("%s", rootname);
    strcpy(filename, rootname);
    strcat(filename, ".dat");
    printf("\n");
    infile = fopen(filename, "r");
    if (infile == NULL) {
        printf("ERROR. Could not open file %s\n", filename);
		pause();
        exit(1);
    }

	/* Read coordinates of common points until the end flag character, # */
	*Pnumcom = 0;
	done = 0;
	do {
		fscanf(infile, "%s", tempstr);
		if (strcmp(tempstr, "#") == 0) done = 1;
		else {
			if (*Pnumcom == MAXCOM) {
				printf("ERROR. More than %d common points in data file.\n", MAXCOM);
				pause();
				exit(1);
			}
			else {
				strcpy( ComPoints[*Pnumcom].name, tempstr );
				fscanf(infile, "%lf %lf %lf %lf %lf %lf", &(ComPoints[*Pnumcom].xarb),
					&(ComPoints[*Pnumcom].yarb), &(ComPoints[*Pnumcom].zarb),
					&(ComPoints[*Pnumcom].xcon), &(ComPoints[*Pnumcom].ycon), 
					&(ComPoints[*Pnumcom].zcon) );
				(*Pnumcom)++;
			}
		}
	} while (!done);

	/* Be sure there are enough points */
	if (*Pnumcom < 3) {
		printf("ERROR. Less than 3 common points.\n");
		pause();
		exit(1);
	}

	/* Read coordinates of unknown points until the end flag character, # */
	*Pnumunk = 0;
	done = 0;
	do {
		fscanf(infile, "%s", tempstr);
		if (strcmp(tempstr, "#") == 0) done = 1;
		else {
			if (*Pnumunk == MAXUNK) {
				printf("ERROR. More than %d unknown points in data file.\n", MAXUNK);
				pause();
				exit(1);
			}
			else {
				strcpy( UnkPoints[*Pnumunk].name, tempstr );
				fscanf(infile, "%lf %lf %lf", &(UnkPoints[*Pnumunk].x),
					&(UnkPoints[*Pnumunk].y), &(UnkPoints[*Pnumunk].z) );
				(*Pnumunk)++;
			}
		}
	} while (!done);

	fclose(infile);
	
}




void InitApprox( CommonPointType *ComPoints, int numcom, double *params, FILE *outf )
/*	This function computes initial approximations for scale, omega, phi, kappa,
	Tx, Ty, and Tz. The method used is from:
	
	  Dewitt, B.A.: "Initial Approximations for the Three-Dimensional Conformal
			Coordinate Transformation, Photogrammetric Engineering and Remote
			Sensing, vol. 62, no. 1, p. 79, 1996.
*/
{
	int		numscale, i, j, pt1, pt2, pt3, ind1, ind2, ind3;
	double	sumscale, distcon, distarb, maxaltsq, dsq12, dsq23, dsq13, a2, b2, c2, h2,
			a_arb, b_arb, c_arb, a_con, b_con, c_con, arb_tilt, arb_az,
			con_tilt, con_az, x_arb1, y_arb1, x_arb2, y_arb2,
			x_con1, y_con1, x_con2, y_con2, azimuth_con, azimuth_arb, swing,
			txsum, tysum, tzsum;
	RotationMatrixType	ArbRotMat, ConRotMat, FullRotMat;
	
	/* Calculate approximation for scale using all pairs of points */
	numscale = 0;
	sumscale = 0;
	for (i=0; i<numcom-1; i++) {
		for (j=i+1; j<numcom; j++) {
			distcon = sqrt(	SQR(ComPoints[i].xcon - ComPoints[j].xcon) +
							SQR(ComPoints[i].ycon - ComPoints[j].ycon) +
							SQR(ComPoints[i].zcon - ComPoints[j].zcon)   );
			distarb = sqrt(	SQR(ComPoints[i].xarb - ComPoints[j].xarb) +
							SQR(ComPoints[i].yarb - ComPoints[j].yarb) +
							SQR(ComPoints[i].zarb - ComPoints[j].zarb)   );
			sumscale += distcon / distarb;
			numscale++;
		}
	}
	params[1] = sumscale / numscale;

	/*  Find geometrically strongest triangle of 3 points
		Strength is based on triangle with the largest altitude
		Altitude is defined as the perpendicular distance from the longest
		leg (or extension thereof) to the point not on the longest leg */
	maxaltsq = 0;
	for (ind1=0; ind1<numcom-2; ind1++) {
		for (ind2=ind1+1; ind2<numcom-1; ind2++) {
			dsq12 = SQR(ComPoints[ind1].xcon - ComPoints[ind2].xcon) +
					SQR(ComPoints[ind1].ycon - ComPoints[ind2].ycon) +
					SQR(ComPoints[ind1].zcon - ComPoints[ind2].zcon);
			for (ind3=ind2+1; ind3<numcom; ind3++) {
				dsq13 = SQR(ComPoints[ind1].xcon - ComPoints[ind3].xcon) +
						SQR(ComPoints[ind1].ycon - ComPoints[ind3].ycon) +
						SQR(ComPoints[ind1].zcon - ComPoints[ind3].zcon);
				dsq23 = SQR(ComPoints[ind2].xcon - ComPoints[ind3].xcon) +
						SQR(ComPoints[ind2].ycon - ComPoints[ind3].ycon) +
						SQR(ComPoints[ind2].zcon - ComPoints[ind3].zcon);

				if ((dsq12 >= dsq13) && (dsq12 >= dsq23)) {
					c2 = dsq12;
					a2 = dsq13;
					b2 = dsq23;
				}
				else {
					if ((dsq13 >= dsq12) && (dsq13 >= dsq23)) {
						c2 = dsq13;
						a2 = dsq12;
						b2 = dsq23;
					}
					else {
						c2 = dsq23;
						a2 = dsq12;
						b2 = dsq13;
					}
				}
				h2 = (2*(c2*(a2+b2)+a2*b2)-a2*a2-b2*b2-c2*c2)/(4*c2);
				if (h2 < 0) {
					printf("ERROR IN ALTITUDE COMPUTATION\n");
					pause();
					exit(1);
				}
				if (h2 > maxaltsq) {
					pt1 = ind1;
					pt2 = ind2;
					pt3 = ind3;
					maxaltsq = h2;
				}
			}
		}
	}

	/*  Compute coefficients of equation of plane through the 3 points
		in the arbitrary system */
	a_arb = ComPoints[pt1].yarb*ComPoints[pt2].zarb +
			ComPoints[pt2].yarb*ComPoints[pt3].zarb +
			ComPoints[pt3].yarb*ComPoints[pt1].zarb -
			ComPoints[pt1].yarb*ComPoints[pt3].zarb -
			ComPoints[pt2].yarb*ComPoints[pt1].zarb -
			ComPoints[pt3].yarb*ComPoints[pt2].zarb;
	b_arb = -ComPoints[pt1].xarb*ComPoints[pt2].zarb -
			ComPoints[pt2].xarb*ComPoints[pt3].zarb -
			ComPoints[pt3].xarb*ComPoints[pt1].zarb +
			ComPoints[pt1].xarb*ComPoints[pt3].zarb +
			ComPoints[pt2].xarb*ComPoints[pt1].zarb +
			ComPoints[pt3].xarb*ComPoints[pt2].zarb;
	c_arb = ComPoints[pt1].xarb*ComPoints[pt2].yarb +
			ComPoints[pt2].xarb*ComPoints[pt3].yarb +
			ComPoints[pt3].xarb*ComPoints[pt1].yarb -
			ComPoints[pt1].xarb*ComPoints[pt3].yarb -
			ComPoints[pt2].xarb*ComPoints[pt1].yarb -
			ComPoints[pt3].xarb*ComPoints[pt2].yarb;


	/*  Compute coefficients of equation of plane through the 3 points
		in the control system */
	a_con = ComPoints[pt1].ycon*ComPoints[pt2].zcon +
			ComPoints[pt2].ycon*ComPoints[pt3].zcon +
			ComPoints[pt3].ycon*ComPoints[pt1].zcon -
			ComPoints[pt1].ycon*ComPoints[pt3].zcon -
			ComPoints[pt2].ycon*ComPoints[pt1].zcon -
			ComPoints[pt3].ycon*ComPoints[pt2].zcon;
	b_con = -ComPoints[pt1].xcon*ComPoints[pt2].zcon -
			ComPoints[pt2].xcon*ComPoints[pt3].zcon -
			ComPoints[pt3].xcon*ComPoints[pt1].zcon +
			ComPoints[pt1].xcon*ComPoints[pt3].zcon +
			ComPoints[pt2].xcon*ComPoints[pt1].zcon +
			ComPoints[pt3].xcon*ComPoints[pt2].zcon;
	c_con = ComPoints[pt1].xcon*ComPoints[pt2].ycon +
			ComPoints[pt2].xcon*ComPoints[pt3].ycon +
			ComPoints[pt3].xcon*ComPoints[pt1].ycon -
			ComPoints[pt1].xcon*ComPoints[pt3].ycon -
			ComPoints[pt2].xcon*ComPoints[pt1].ycon -
			ComPoints[pt3].xcon*ComPoints[pt2].ycon;

	/* Compute tilt & azimuth of plane in arbitrary system */
	arb_tilt = atan2( c_arb, hypot(a_arb, b_arb) ) + M_PI/2;
	arb_az = atan2( a_arb, b_arb );
	/* Compute tilt & azimuth of plane in control system */
	con_tilt = atan2( c_con, hypot(a_con, b_con) ) + M_PI/2;
	con_az = atan2( a_con, b_con );
	/*  Compute the corresponding rotation matrices with swing = 0 */
	RotationMatrixTSA(arb_tilt, 0.0, arb_az, &ArbRotMat);
	RotationMatrixTSA(con_tilt, 0.0, con_az, &ConRotMat);
	/*  Rotate arbitrary and control coordinates for points 1 and 2
		to get a line in the arbitrary system and the corresponding
		line in the control system.  Don't need to rotate Z because
		with these rotations all of the z values must be the same. */
	x_arb1 =	ArbRotMat.m11*ComPoints[pt1].xarb +
				ArbRotMat.m12*ComPoints[pt1].yarb +
				ArbRotMat.m13*ComPoints[pt1].zarb;
	y_arb1 =	ArbRotMat.m21*ComPoints[pt1].xarb +
				ArbRotMat.m22*ComPoints[pt1].yarb +
				ArbRotMat.m23*ComPoints[pt1].zarb;
	x_arb2 =	ArbRotMat.m11*ComPoints[pt2].xarb +
				ArbRotMat.m12*ComPoints[pt2].yarb +
				ArbRotMat.m13*ComPoints[pt2].zarb;
	y_arb2 =	ArbRotMat.m21*ComPoints[pt2].xarb +
				ArbRotMat.m22*ComPoints[pt2].yarb +
				ArbRotMat.m23*ComPoints[pt2].zarb;
	x_con1 =	ConRotMat.m11*ComPoints[pt1].xcon +
				ConRotMat.m12*ComPoints[pt1].ycon +
				ConRotMat.m13*ComPoints[pt1].zcon;
	y_con1 =	ConRotMat.m21*ComPoints[pt1].xcon +
				ConRotMat.m22*ComPoints[pt1].ycon +
				ConRotMat.m23*ComPoints[pt1].zcon;
	x_con2 =	ConRotMat.m11*ComPoints[pt2].xcon +
				ConRotMat.m12*ComPoints[pt2].ycon +
				ConRotMat.m13*ComPoints[pt2].zcon;
	y_con2 =	ConRotMat.m21*ComPoints[pt2].xcon +
				ConRotMat.m22*ComPoints[pt2].ycon +
				ConRotMat.m23*ComPoints[pt2].zcon;
	/* Get swing by subtracting azimuths */
	azimuth_con = atan2( x_con2-x_con1, y_con2-y_con1 );
	azimuth_arb = atan2( x_arb2-x_arb1, y_arb2-y_arb1 );
	swing = azimuth_con - azimuth_arb;
	RotationMatrixTSA(arb_tilt, swing, arb_az, &ArbRotMat);
	/*  Now compute (ConRotMat:transpose * ArbRotMat):transpose
		This is overall rotation matrix */
	FullRotMat.m11 = ConRotMat.m11*ArbRotMat.m11 + ConRotMat.m21*ArbRotMat.m21 +
					 ConRotMat.m31*ArbRotMat.m31;
	FullRotMat.m21 = ConRotMat.m11*ArbRotMat.m12 + ConRotMat.m21*ArbRotMat.m22 +
					 ConRotMat.m31*ArbRotMat.m32;
	FullRotMat.m31 = ConRotMat.m11*ArbRotMat.m13 + ConRotMat.m21*ArbRotMat.m23 +
					 ConRotMat.m31*ArbRotMat.m33;
	FullRotMat.m12 = ConRotMat.m12*ArbRotMat.m11 + ConRotMat.m22*ArbRotMat.m21 +
					 ConRotMat.m32*ArbRotMat.m31;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩夫妻久久| 日本高清不卡在线观看| 亚洲国产精品一区二区www| 国产精品少妇自拍| 精品国产乱码91久久久久久网站| 日韩视频一区二区三区在线播放 | 欧美国产一区视频在线观看| 日韩免费观看高清完整版在线观看| 91麻豆精品秘密| 91影院在线免费观看| 99视频有精品| 欧美性猛交xxxxxxxx| 欧美人与禽zozo性伦| 欧美日本在线视频| 日韩一级大片在线观看| 日韩欧美精品在线视频| 久久久午夜精品| 国产亚洲精品中文字幕| 国产精品免费人成网站| 亚洲欧美另类在线| 亚洲.国产.中文慕字在线| 亚洲永久免费av| 久久精品久久久精品美女| 国产福利一区二区三区视频| 成人精品免费看| 色噜噜狠狠成人中文综合 | 91精品国产欧美一区二区18| 日韩欧美亚洲一区二区| 中文一区二区完整视频在线观看| 中文字幕制服丝袜成人av| 中文字幕欧美国产| 亚洲免费高清视频在线| 免费成人在线观看视频| 国产成人在线看| 欧美年轻男男videosbes| 2023国产精华国产精品| 亚洲人成伊人成综合网小说| 蜜桃久久久久久| 91麻豆福利精品推荐| 日韩精品中文字幕一区 | 欧美日韩激情一区| 26uuu国产一区二区三区| 亚洲激情av在线| 韩日av一区二区| 91电影在线观看| 久久精品在线免费观看| 婷婷亚洲久悠悠色悠在线播放| 久久99久久99小草精品免视看| 一本久久综合亚洲鲁鲁五月天| 欧美精品一区二区三区一线天视频| 综合久久久久久久| 国产伦精品一区二区三区免费| 91福利资源站| ...中文天堂在线一区| 久久精品国产精品青草| 欧美在线免费播放| 国产精品伦一区二区三级视频| 蜜臀av性久久久久蜜臀aⅴ流畅| 91亚洲国产成人精品一区二区三| 亚洲精品一区二区三区在线观看 | 欧美日韩一本到| 国产精品美女久久久久久久久久久| 青草国产精品久久久久久| 欧美日韩一区中文字幕| 日韩美女视频19| 成人不卡免费av| 国产亚洲欧美色| 国内精品国产三级国产a久久| 欧美三级一区二区| 亚洲精品欧美二区三区中文字幕| 成人一区二区三区中文字幕| 久久理论电影网| 精品夜夜嗨av一区二区三区| 欧美sm美女调教| 激情五月播播久久久精品| 欧美一区日韩一区| 男女男精品网站| 日韩亚洲欧美中文三级| 美女一区二区视频| 日韩网站在线看片你懂的| 琪琪一区二区三区| 欧美一区二区三区啪啪| 蜜桃久久久久久| 亚洲精品一区二区三区影院| 精品在线播放免费| 久久综合色8888| 国产成人在线看| 亚洲品质自拍视频网站| 色婷婷久久久综合中文字幕| 亚洲综合色丁香婷婷六月图片| 色视频成人在线观看免| 亚洲国产成人av| 日韩一区国产二区欧美三区| 另类小说一区二区三区| 国产色产综合产在线视频| 91蜜桃网址入口| 午夜精品久久久久久久久久久 | 91精品福利在线一区二区三区| 蜜桃久久久久久| 国产精品久久影院| 欧美天堂一区二区三区| 麻豆一区二区在线| 日本一区二区三区国色天香 | 亚洲高清久久久| 欧美二区三区的天堂| 国产美女精品人人做人人爽| 国产精品国产馆在线真实露脸| 91丨porny丨户外露出| 午夜视频在线观看一区二区三区 | 91视频www| 欧美a一区二区| 综合久久给合久久狠狠狠97色| 欧美日韩高清在线播放| 国产成人小视频| 五月天激情综合网| 国产精品久久久久久久久快鸭| 欧美日韩中文字幕一区二区| 久久精品999| 亚洲精品视频在线观看网站| 精品国产a毛片| 欧美撒尿777hd撒尿| 国产成人免费xxxxxxxx| 99久久久久免费精品国产| 蜜桃精品视频在线观看| 中文字幕亚洲视频| 精品日韩成人av| 欧美视频一区在线观看| 成人涩涩免费视频| 蜜臂av日日欢夜夜爽一区| 亚洲欧美日韩系列| 欧美激情中文不卡| 欧美mv日韩mv国产网站app| 在线观看亚洲专区| 99re这里都是精品| 成人影视亚洲图片在线| 久久99精品久久久| 日韩黄色在线观看| 夜夜嗨av一区二区三区 | 在线视频你懂得一区| 成人动漫av在线| 成人激情免费视频| 国产精品自拍在线| 久久精品国产**网站演员| 香港成人在线视频| 性做久久久久久免费观看欧美| 综合久久国产九一剧情麻豆| 国产精品色眯眯| 欧美高清在线视频| 中文字幕免费不卡在线| 国产亚洲精品超碰| 国产欧美一区视频| 国产精品全国免费观看高清 | 中文字幕第一区| 国产清纯美女被跳蛋高潮一区二区久久w | 久久精品二区亚洲w码| 日本欧美在线看| 日本aⅴ免费视频一区二区三区| 日日夜夜免费精品| 美女视频黄 久久| 国产精品影视在线| 国产不卡视频在线观看| 国产一区二区三区在线观看免费视频| 国产在线国偷精品免费看| 国内外精品视频| 粉嫩av亚洲一区二区图片| 99re在线精品| 在线综合视频播放| 精品国产青草久久久久福利| 久久久综合九色合综国产精品| 日本一区二区久久| 亚洲综合免费观看高清在线观看| 亚洲国产综合人成综合网站| 石原莉奈在线亚洲二区| 国产毛片一区二区| 91一区二区三区在线播放| 欧美二区三区91| 国产视频在线观看一区二区三区| 一区二区三区在线观看动漫| 日韩av中文在线观看| 国产精品香蕉一区二区三区| 91麻豆国产香蕉久久精品| 欧美一区二区在线播放| 国产欧美一区二区在线| 亚洲一区二区中文在线| 国产麻豆精品久久一二三| 色综合网站在线| 欧美v亚洲v综合ⅴ国产v| 中文字幕一区二区三| 日本特黄久久久高潮| 99综合电影在线视频| 欧美顶级少妇做爰| 中文字幕一区二区三区四区| 日韩国产欧美在线视频| 不卡的av网站| 日韩精品一区二区三区在线观看 | 欧美在线色视频| 国产网站一区二区三区| 首页亚洲欧美制服丝腿| 成人av电影免费观看| 日韩欧美国产小视频|