⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 triview.c

📁 linux环境下利用fortran语言开发
💻 C
字号:
/* Copyright (c) Colorado School of Mines, 2007.*//* All rights reserved.                       */#include "par.h"char *sdoc[] = {"									"," TRIVIEW - View 3-d coordinates in 2-d					","									"," triview <(3-d ascii coords) [optional parameters] >(2-d ascii coords)	","									"," Optional Parameters:							"," theta=   viewing angle (elevation)					"," phi=     viewing angle (azimuth)					"," xs0=     x translation of 2-d coords					"," ys0=     y translation of 2-d coords					","									",NULL};/* * AUTHOR:  Phil Anno, Colorado School of Mines, 10/26/91 * */#define  DEG2RAD (PI/180.)intmain (int argc, char **argv){	int      itrios,ntrios,icolor;	float    theta,phi,x,y,z,xs,ys,xs0,ys0;	/* hook up getpar */        initargs(argc,argv);        requestdoc(1);        /* get command line parameters, if present */        if (!getparfloat("theta",&theta)) theta=0.;        if (!getparfloat("phi",&phi))     phi=0.;        if (!getparfloat("xs0",&xs0))     xs0=0.;        if (!getparfloat("ys0",&ys0))     ys0=0.;	theta = DEG2RAD*theta;	phi   = DEG2RAD*phi;	/* loop over coord list groups */	while (fscanf(stdin,"%d %d\n",&ntrios,&icolor) != EOF) {		/* valid ntrios & icolor, so */		fprintf(stdout,"%d %d\n",ntrios,icolor);		/* loop over coord list */		for (itrios=1; itrios<=ntrios; ++itrios) {						if (fscanf(stdin,"%f %f %f\n",&x,&y,&z) == 3) {				/* valid coord, so */				xs = cos(phi)*x + sin(phi)*y + xs0;				ys = cos(phi)*sin(theta)*y -				     sin(phi)*sin(theta)*x + z + ys0;				fprintf (stdout,"%f %f\n",xs,ys);			} else {				err("invalid coordinate trio\n");			}		}	}	return EXIT_SUCCESS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -