lonlat.c

来自「c源码」· C语言 代码 · 共 66 行

C
66
字号
/* Display ecliptic longitude and latitude (for * equinox of date, if ofdate nonzero). * Input pp is equatorial rectangular * coordinates for equinox J2000. */#include "kep.h"int lonlat( pp, J, polar, ofdate )double pp[], J, polar[];int ofdate;{double s[3], x, y, z, yy, zz, r;int i;/* Make local copy of position vector * and calculate radius. */r = 0.0;for( i=0; i<3; i++ )	{	x = pp[i];	s[i] = x;	r += x * x;	}r = sqrt(r);/* Precess to equinox of date J * if flag is set */if( ofdate )	{	precess( s, J, -1 );	epsiln(J);	}else	epsiln(J2000);/* Convert from equatorial to ecliptic coordinates */yy = s[1];zz = s[2];x  = s[0];y  =  coseps * yy  +  sineps * zz;z  = -sineps * yy  +  coseps * zz;yy = zatan2( x, y );zz = asin( z/r );polar[0] = yy;polar[1] = zz;polar[2] = r;if( prtflg == 0 )	return(0);printf( "ecliptic long" );dms( yy );printf( " lat" );dms( zz );printf( " rad %.9E\n", r );return(0);}

⌨️ 快捷键说明

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