|
|
1.1 ! root 1: #include "map.h" ! 2: ! 3: /* christmas wreath projection, 1989 card. ! 4: wreath par1 par2 ! 5: par1 is fraction of full circle the wreath is to cover ! 6: (the gap is where you put the bow) ! 7: par2 tells how deeply to curve the meridians, about .2 - .5 ! 8: inner radius is 1-a, equatorial is 1, outer is 1+a ! 9: ! 10: fudging for beauty: shift things south 30 degrees so ! 11: equator is really not at radius 1, and stretch northern ! 12: hemisphere quadratically away from the equator ! 13: */ ! 14: static double a = .7, b, c; ! 15: int squinge; ! 16: ! 17: static int (*Xcylequalarea)(struct place *, double *, double *); ! 18: ! 19: static int ! 20: Xwreath(struct place *place, double *x, double *y) ! 21: { ! 22: double xx, yy, r, h, theta; ! 23: struct place nplace; ! 24: double l; ! 25: nplace = *place; ! 26: if(squinge) { ! 27: if(nplace.nlat.l < 0) ! 28: nplace.nlat.l -= PI/6-FUZZ; ! 29: else { ! 30: l = nplace.nlat.l; ! 31: nplace.nlat.l = -PI/6 + l + 2*l*l/(3*PI); ! 32: } ! 33: if(nplace.nlat.l < -PI/2) ! 34: return 0; ! 35: sincos(&nplace.nlat); ! 36: } ! 37: Xcylequalarea(&nplace, &xx, &yy); ! 38: r = 1 - a*yy; ! 39: theta = b*xx; ! 40: h = c*sin(theta)*sqrt(1-yy*yy); ! 41: theta += h/r; ! 42: *y = -r*cos(theta); ! 43: *x = r*sin(theta); ! 44: return(1); ! 45: } ! 46: ! 47: proj ! 48: wreath(double par1, double par2) ! 49: { ! 50: Xcylequalarea = cylequalarea(45.); ! 51: b = fabs(par1); ! 52: c = par2; ! 53: squinge = par1<0; ! 54: return Xwreath; ! 55: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.