| 2609 | // the middle, as done when the -S is combined with the -X switch. |
| 2610 | |
| 2611 | void XChartOrbit() |
| 2612 | { |
| 2613 | int cx = gs.xWin / 2, cy = gs.yWin / 2, unit, x1, y1, x2, y2, |
| 2614 | i, j, k, l, nSav; |
| 2615 | real sx, sy, sz, xp, yp, xp2, yp2, xpEar = 0.0, ypEar = 0.0, rT; |
| 2616 | ObjDraw rgod[objMax]; |
| 2617 | char szT[cchSzDef], chT; |
| 2618 | #ifdef SWISS |
| 2619 | ES es, *pes1, *pes2; |
| 2620 | int j2, k2; |
| 2621 | #endif |
| 2622 | |
| 2623 | unit = Max(6*gi.nScale, gs.fText*Max(12, yFont*gi.nScaleText/2)*gi.nScaleT); |
| 2624 | x1 = y1 = unit; x2 = gs.xWin-1-unit; y2 = gs.yWin-1-unit; |
| 2625 | |
| 2626 | // Determine the scale of the chart. For a scale size of 400, make the |
| 2627 | // graphic 1 AU in radius (just out to Earth's orbit). For 300, make the |
| 2628 | // chart 6 AU in radius (enough for inner planets out to asteroid belt). |
| 2629 | // For a scale of 200, make window 30 AU in radius (enough for planets out |
| 2630 | // to Neptune). For scale of 100, make it 90 AU in radius (enough for all |
| 2631 | // planets including the orbits of the Uranians). For larger text scale, |
| 2632 | // make it .006 AU (a little more than Moon's orbit around Earth). Finally, |
| 2633 | // if -YXS switch is set, use that custom value over all the above defaults. |
| 2634 | |
| 2635 | i = gi.nScale/gi.nScaleT; |
| 2636 | sz = gs.rspace > 0.0 ? gs.rspace : (i <= 1 ? 90.0 : (i == 2 ? 30.0 : |
| 2637 | (i == 3 ? 6.0 : (gi.nScaleText/2 <= 1 ? 1.0 : 0.006)))); |
| 2638 | sx = (real)(cx-x1)/sz; sy = (real)(cy-y1)/sz; |
| 2639 | ClearB((pbyte)rgod, sizeof(rgod)); |
| 2640 | for (i = 0; i <= is.nObj; i++) if (FProper(i)) { |
| 2641 | xp = space[i].x; yp = space[i].y; |
| 2642 | if (us.fStar || gs.fAllStar) { |
| 2643 | xp /= rLYToAU; yp /= rLYToAU; |
| 2644 | } |
| 2645 | if (us.fHouse3D) |
| 2646 | OrbitPlot(&xp, &yp, NULL, sz, i, space); |
| 2647 | rgod[i].x = cx-(int)(xp*sx); rgod[i].y = cy+(int)(yp*sy); |
| 2648 | rgod[i].obj = i; |
| 2649 | rgod[i].kv = ~0; |
| 2650 | rgod[i].f = fTrue; |
| 2651 | } |
| 2652 | |
| 2653 | // Draw planet disks (which become visible if zoomed in enough). |
| 2654 | if (!gs.fAlt) |
| 2655 | for (i = 0; i <= is.nObj; i++) if (FProper(i)) { |
| 2656 | rT = RObjDiam(i) / 2.0 / rAUToKm; |
| 2657 | j = (int)(rT * sx); |
| 2658 | k = (int)(rT * sy); |
| 2659 | if ((j > 1 || k > 1) && |
| 2660 | FInRect(rgod[i].x, rgod[i].y, x1-j, y1-j, x2+j, y2+j)) { |
| 2661 | DrawColor(kDkGreenB); |
| 2662 | DrawCircle2(rgod[i].x, rgod[i].y, j, k); |
| 2663 | |
| 2664 | // Draw rings around Saturn or other planet. |
| 2665 | l = FBetween(i, oJuC, oNeC) ? i - oJuC + oJup : |
| 2666 | (FBetween(i, oJup, oNep) && ignore[i + oJuC - oJup] ? i : |
| 2667 | (i == oHau || i == oQua ? i : -1)); |
| 2668 | if (l >= 0) { |
no test coverage detected