📄 xoptions.c
字号:
l = FALSE;
}
}
DrawColor(on);
DrawEllipse(0, 0, chartx-1, charty-1);
/* Now, only if we are in bonus chart mode, draw each planet at its */
/* zenith location on the globe, assuming that location is visible. */
if (modex != MODEG || !xbonus)
return;
j = Lon;
if (j < 0.0)
j += DEGREES;
for (i = 1; i <= total; i++) {
planet1[i] = DTOR(planet[i]);
planet2[i] = DTOR(planetalt[i]);
EclToEqu(&planet1[i], &planet2[i]); /* Calculate zenith long. & lat. */
}
for (i = 1; i <= total; i++) if (Proper(i)) {
x1 = planet1[_MC]-planet1[i];
if (x1 < 0.0)
x1 += 2.0*PI;
if (x1 > PI)
x1 -= 2.0*PI;
x1 = Mod(DEGHALF-j-RTOD(x1));
y1 = DEGQUAD-RTOD(planet2[i]);
X[i] = GlobeCalc(x1, y1, &u, &v, cx, cy, rx, ry, deg) ? -1000 : u;
Y[i] = v; M[i] = X[i]; N[i] = Y[i]+unit/2;
}
/* Now that we have the coordinates of each object, figure out where to */
/* draw the glyphs. Again, we try not to draw glyphs on top of each other. */
for (i = 1; i <= total; i++) if (Proper(i)) {
k = l = chartx+charty;
/* For each planet, we draw the glyph either right over or right under */
/* the actual zenith location point. So, find out the closest distance */
/* of any other planet assuming we place ours at both possibilities. */
for (J = 1; J < i; J++) if (Proper(J)) {
k = MIN(k, abs(M[i]-M[J])+abs(N[i]-N[J]));
l = MIN(l, abs(M[i]-M[J])+abs(N[i]-unit-N[J]));
}
/* Normally, we put the glyph right below the actual point. If however */
/* another planet is close enough to have their glyphs overlap, and the */
/* above location is better of, then we'll draw the glyph above instead. */
if (k < unit || l < unit)
if (k < l)
N[i] -= unit;
}
for (i = total; i >= 1; i--) if (X[i] >= 0 && Proper(i)) /* Draw the */
DrawObject(i, M[i], N[i]); /* glyphs. */
for (i = total; i >= 1; i--) if (X[i] >= 0 && Proper(i)) {
DrawColor(objectcolor[i]);
DrawSpot(X[i], Y[i]);
}
}
/* Draw one "Ley line" on the world map, based coordinates given in terms of */
/* longitude and vertical fractional distance from the center of the earth. */
void DrawLeyLine(l1, f1, l2, f2)
real l1, f1, l2, f2;
{
l1 = Mod(l1); l2 = Mod(l2);
/* Convert vertical fractional distance to a corresponding coordinate. */
f1 = DEGQUAD-ASIN(f1)/(PI/2.0)*DEGQUAD;
f2 = DEGQUAD-ASIN(f2)/(PI/2.0)*DEGQUAD;
DrawWrap((int) (l1*(real)SCALE+ROUND)+1,
(int) (f1*(real)SCALE+ROUND)+1,
(int) (l2*(real)SCALE+ROUND)+1,
(int) (f2*(real)SCALE+ROUND)+1, 1, chartx-2);
}
/* Draw the main set of planetary Ley lines on the map of the world. This */
/* consists of drawing an icosahedron and then a dodecahedron lattice. */
void DrawLeyLines(deg)
int deg;
{
real off = (real)deg, phi, h, h1, h2, r, i;
phi = (sqrt(5.0)+1.0)/2.0; /* Icosahedron constants. */
h = 1.0/(phi*2.0-1.0);
DrawColor(aspectcolor[10]);
for (i = off; i < DEGREES+off; i += 72.0) { /* Draw icosahedron edges. */
DrawLeyLine(i, h, i+72.0, h);
DrawLeyLine(i-36.0, -h, i+36.0, -h);
DrawLeyLine(i, h, i, 1.0);
DrawLeyLine(i+36.0, -h, i+36.0, -1.0);
DrawLeyLine(i, h, i+36.0, -h);
DrawLeyLine(i, h, i-36.0, -h);
}
r = 1.0/sqrt(3.0)/phi/cos(DTOR(54.0)); /* Dodecahedron constants. */
h2 = sqrt(1.0-r*r); h1 = h2/(phi*2.0+1.0);
DrawColor(aspectcolor[13]);
for (i = off; i < DEGREES+off; i += 72.0) { /* Draw docecahedron edges. */
DrawLeyLine(i-36.0, h2, i+36.0, h2);
DrawLeyLine(i, -h2, i+72.0, -h2);
DrawLeyLine(i+36.0, h2, i+36.0, h1);
DrawLeyLine(i, -h2, i, -h1);
DrawLeyLine(i+36.0, h1, i+72.0, -h1);
DrawLeyLine(i+36.0, h1, i, -h1);
}
}
/* Draw a map of the world on the screen. This is similar to drawing the */
/* globe, but is simplified because this is just a rectangular image, and */
/* the window coordinates are proportional to the longitude and latitude. */
void DrawWorld(deg)
int deg;
{
char *nam, *loc, *lin, d;
int lon, lat, x, y, xold, yold, i;
colpal c;
/* Loop through each coastline string, drawing it on the world map. */
while (ReadWorldData(&nam, &loc, &lin)) {
i = nam[0]-'0';
c = modex == MODEL ? on : (i ? rainbowcolor[i] : maincolor[6]);
/* Get starting longitude and latitude of current coastline piece. */
lon = (loc[0] == '+' ? 1 : -1)*
((loc[1]-'0')*100 + (loc[2]-'0')*10 + (loc[3]-'0'));
lat = (loc[4] == '+' ? 1 : -1)*((loc[5]-'0')*10 + (loc[6]-'0'));
xold = x = (int) Mod((real)(181-lon+deg));
yold = y = 91-lat;
/* Go down the coastline piece, drawing each segment on world map. */
for (i = 0; d = lin[i]; i++) {
if (d == 'L' || d == 'H' || d == 'G')
x--;
else if (d == 'R' || d == 'E' || d == 'F')
x++;
if (d == 'U' || d == 'H' || d == 'E')
y--;
else if (d == 'D' || d == 'G' || d == 'F')
y++;
if (x > DEGR) {
x = 1;
xold = 0;
}
/* If we are doing a Mollewide map projection, then transform the */
/* coordinates appropriately before drawing the segment. */
DrawColor(c);
if ((exdisplay & DASHXW0) > 0 && modex != MODEL)
DrawLine((180+(xold-180)*
(int)sqrt((real)(32400-4*(yold-91)*(yold-91)))/180)*SCALE,
yold*SCALE,
(180+(x-180)*(int)sqrt((real)(32400-4*(y-91)*(y-91)))/180)*SCALE,
y*SCALE);
else
DrawLine(xold*SCALE, yold*SCALE, x*SCALE, y*SCALE);
if (x < 1)
x = DEGR;
xold = x; yold = y;
}
}
/* Again, if we are doing the non-rectangular Mollewide map projection, */
/* draw the outline of the globe/map itself. */
if ((exdisplay & DASHXW0) > 0 && modex != MODEL) {
if (!xbonus) {
DrawColor(on);
for (xold = 0, y = -89; y <= 90; y++, xold = x)
for (x = (int)(sqrt((real)(32400-4*y*y))+ROUND), i = -1; i < 2; i += 2)
DrawLine((180+i*xold)*SCALE, (90+y)*SCALE,
(180+i*x)*SCALE, (91+y)*SCALE);
}
}
}
/* Given a zodiac degree, adjust it if need be to account for the expanding */
/* and compacting of parts the zodiac that happen when we display a graphic */
/* wheel chart such that all the houses appear the same size. */
real XHousePlaceIn(deg)
real deg;
{
int in;
if (modex == MODEv) /* We only adjust for the -w -X combination. */
return deg;
in = HousePlaceIn(deg);
return Mod(STOZ(in)+MinDistance(house[in], deg)/
MinDistance(house[in], house[Mod12(in+1)])*30.0);
}
/*
******************************************************************************
** Multiple Chart Graphics Subprograms.
******************************************************************************
*/
/* Draw another wheel chart; however, this time we have two rings of planets */
/* because we are doing a relationship chart between two sets of data. This */
/* chart is obtained when the -r0 is combined with the -X switch. */
void XChartWheelRelation()
{
real xsign[SIGNS+1], xhouse1[SIGNS+1], xplanet1[TOTAL+1], xplanet2[TOTAL+1],
symbol[TOTAL+1];
int cx, cy, i, j;
real asc, unitx, unity, px, py, temp;
/* Set up variables and temporarily automatically decrease the horizontal */
/* chart size to leave room for the sidebar if that mode is in effect. */
if (xtext && !(exdisplay & DASHv0))
chartx -= SIDET;
cx = chartx/2 - 1; cy = charty/2 - 1;
unitx = (real)cx; unity = (real)cy;
asc = xeast ? planet1[abs(xeast)]+90*(xeast < 0) : house1[1];
InitCircle();
/* Fill out arrays with the degree of each object, cusp, and sign glyph. */
if (modex == MODEv) {
for (i = 1; i <= SIGNS; i++)
xhouse1[i] = PZ(house1[i]);
} else {
asc -= house1[1];
for (i = 1; i <= SIGNS; i++)
xhouse1[i] = PZ(STOZ(i));
}
for (i = 1; i <= SIGNS; i++)
xsign[i] = PZ(XHousePlaceIn(STOZ(i)));
for (i = 1; i <= total; i++)
xplanet1[i] = PZ(XHousePlaceIn(planet1[i]));
for (i = 1; i <= total; i++)
xplanet2[i] = PZ(XHousePlaceIn(planet2[i]));
/* Draw the horizon and meridian lines across whole chart, and draw the */
/* zodiac and house rings, exactly like before. We are drawing only the */
/* houses of one of the two charts in the relationship, however. */
DrawColor(hilite);
DrawDash(cx+POINT(unitx, 0.99, PX(xhouse1[1])),
cy+POINT(unity, 0.99, PY(xhouse1[1])),
cx+POINT(unitx, 0.99, PX(xhouse1[7])),
cy+POINT(unity, 0.99, PY(xhouse1[7])), !xcolor);
DrawDash(cx+POINT(unitx, 0.99, PX(xhouse1[10])),
cy+POINT(unity, 0.99, PY(xhouse1[10])),
cx+POINT(unitx, 0.99, PX(xhouse1[4])),
cy+POINT(unity, 0.99, PY(xhouse1[4])), !xcolor);
for (i = 0; i < DEGR; i += 5-(xcolor || psfile || metafile)*4) {
temp = PZ(XHousePlaceIn((real)i));
px = PX(temp); py = PY(temp);
DrawColor(i%5 ? gray : on);
DrawDash(cx+POINT(unitx, 0.78, px), cy+POINT(unity, 0.78, py),
cx+POINT(unitx, 0.82, px), cy+POINT(unity, 0.82, py),
((psfile || metafile) && i%5)*2);
}
DrawColor(on);
DrawCircle(cx, cy, (int)(unitx*0.95+ROUND), (int)(unity*0.95+ROUND));
DrawCircle(cx, cy, (int)(unitx*0.82+ROUND), (int)(unity*0.82+ROUND));
DrawCircle(cx, cy, (int)(unitx*0.78+ROUND), (int)(unity*0.78+ROUND));
DrawCircle(cx, cy, (int)(unitx*0.70+ROUND), (int)(unity*0.70+ROUND));
for (i = 1; i <= SIGNS; i++) {
temp = xsign[i];
DrawColor(on);
DrawLine(cx+POINT(unitx, 0.95, PX(temp)),
cy+POINT(unity, 0.95, PY(temp)),
cx+POINT(unitx, 0.82, PX(temp)),
cy+POINT(unity, 0.82, PY(temp)));
DrawLine(cx+POINT(unitx, 0.78, PX(xhouse1[i])),
cy+POINT(unity, 0.78, PY(xhouse1[i])),
cx+POINT(unitx, 0.70, PX(xhouse1[i])),
cy+POINT(unity, 0.70, PY(xhouse1[i])));
if (xcolor && i%3 != 1) {
DrawColor(gray);
DrawDash(cx, cy, cx+POINT(unitx, 0.70, PX(xhouse1[i])),
cy+POINT(unity, 0.70, PY(xhouse1[i])), 1);
}
temp = Midpoint(temp, xsign[Mod12(i+1)]);
DrawColor(signcolor(i));
DrawSign(i, cx+POINT(unitx, 0.885, PX(temp)),
cy+POINT(unity, 0.885, PY(temp)));
temp = Midpoint(xhouse1[i], xhouse1[Mod12(i+1)]);
DrawHouse(i, cx+POINT(unitx, 0.74, PX(temp)),
cy+POINT(unity, 0.74, PY(temp)));
}
/* Draw the outer ring of planets (based on the planets in the chart */
/* which the houses do not reflect - the houses belong to the inner ring */
/* below). Draw each glyph, a line from it to its actual position point */
/* in the outer ring, and then draw another line from this point to a */
/* another dot at the same position in the inner ring as well. */
for (i = 1; i <= total; i++)
symbol[i] = xplanet2[i];
FillSymbolRing(symbol);
for (i = 1; i <= total; i++) if (Proper(i)) {
if (xlabel) {
temp = symbol[i];
DrawColor(ret2[i] < 0.0 ? gray : on);
DrawDash(cx+POINT(unitx, 0.58, PX(xplanet2[i])),
cy+POINT(unity, 0.58, PY(xplanet2[i])),
cx+POINT(unitx, 0.61, PX(temp)),
cy+POINT(unity, 0.61, PY(temp)),
(ret2[i] < 0.0 ? 1 : 0) - xcolor);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -