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

📄 lune.c

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 C
字号:
#include <u.h>#include <libc.h>#include "map.h"int Xstereographic(struct place *place, double *x, double *y);static struct place eastpole;static struct place westpole;static double eastx, easty;static double westx, westy;static double scale;static double pwr;/* conformal map w = ((1+z)^A - (1-z)^A)/((1+z)^A + (1-z)^A),   where A<1, maps unit circle onto a convex lune with x= +-1   mapping to vertices of angle A*PI at w = +-1 *//* there are cuts from E and W poles to S pole,   in absence of a cut routine, error is returned for   points outside a polar cap through E and W poles */static Xlune(struct place *place, double *x, double *y){	double stereox, stereoy;	double z1x, z1y, z2x, z2y;	double w1x, w1y, w2x, w2y;	double numx, numy, denx, deny;	if(place->nlat.l < eastpole.nlat.l-FUZZ)		return	-1;	Xstereographic(place, &stereox, &stereoy);	stereox *= scale;	stereoy *= scale;	z1x = 1 + stereox;	z1y = stereoy;	z2x = 1 - stereox;	z2y = -stereoy;	cpow(z1x,z1y,&w1x,&w1y,pwr);	cpow(z2x,z2y,&w2x,&w2y,pwr);	numx = w1x - w2x;	numy = w1y - w2y;	denx = w1x + w2x;	deny = w1y + w2y;	cdiv(numx, numy, denx, deny, x, y);	return 1;}	projlune(double lat, double theta){	deg2rad(lat, &eastpole.nlat);	deg2rad(-90.,&eastpole.wlon);	deg2rad(lat, &westpole.nlat);	deg2rad(90. ,&westpole.wlon);	Xstereographic(&eastpole, &eastx, &easty);	Xstereographic(&westpole, &westx, &westy);	if(fabs(easty)>FUZZ || fabs(westy)>FUZZ ||	   fabs(eastx+westx)>FUZZ)		abort();	scale = 1/eastx;	pwr = theta/180;	return Xlune;}

⌨️ 快捷键说明

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