MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / DrawMapLine

Function DrawMapLine

xcharts0.cpp:1695–1736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1693// between them.
1694
1695void DrawMapLine(real lon1, real lat1, real lon2, real lat2,
1696 flag fGlobe, int nScl, CIRC *pcr, real deg)
1697{
1698 int x1, y1, x2, y2;
1699 real lon3, lat3;
1700#ifdef WIRE
1701 int z1, z2;
1702#endif
1703
1704 // Recursive case: Draw each half of the line separately.
1705 if (SphDistance(lon1, lat1, lon2, lat2) > 10.0) {
1706 SphRatio(lon1, lat1, lon2, lat2, 0.5, &lon3, &lat3);
1707 DrawMapLine(lon1, lat1, lon3, lat3, fGlobe, nScl, pcr, deg);
1708 DrawMapLine(lon3, lat3, lon2, lat2, fGlobe, nScl, pcr, deg);
1709 return;
1710 }
1711
1712 // Base case: Draw a single line segment.
1713 lat1 = rDegQuad - lat1;
1714 lat2 = rDegQuad - lat2;
1715#ifdef WIRE
1716 if (gs.ft == ftWire) {
1717 WireGlobeCalc(lon1, lat1, &x1, &y1, &z1, nScl, deg);
1718 WireGlobeCalc(lon2, lat2, &x2, &y2, &z2, nScl, deg);
1719 WireLine(x1, y1, z1, x2, y2, z2);
1720 return;
1721 }
1722#endif
1723 if (!FMapCalc(lon1, lat1, &x1, &y1, fGlobe, -1, 0.0, nScl, pcr, deg) &&
1724 !FMapCalc(lon2, lat2, &x2, &y2, fGlobe, -1, 0.0, nScl, pcr, deg)) {
1725 if (gi.nMode != gWorldMap || gs.fMollweide) {
1726 if (NAbs(x2-x1) < (pcr->xr >> 2))
1727 DrawLine(x1, y1, x2, y2);
1728 } else {
1729 if (lat1 <= 0.0 || lat1 >= rDegHalf)
1730 x1 = x2;
1731 else if (lat2 <= 0.0 || lat2 >= rDegHalf)
1732 x2 = x1;
1733 DrawWrap(x1, Min(y1, gs.yWin-1), x2, Min(y2, gs.yWin-1), 0, gs.xWin-1);
1734 }
1735 }
1736}
1737
1738
1739// Draw a triangle between three coordinates on the globe, in which other

Callers 2

DrawMapTriangleFunction · 0.85
DrawMapSquareFunction · 0.85

Calls 6

SphDistanceFunction · 0.85
SphRatioFunction · 0.85
WireGlobeCalcFunction · 0.85
WireLineFunction · 0.85
FMapCalcFunction · 0.85
DrawWrapFunction · 0.85

Tested by

no test coverage detected