| 1740 | // triangles should be nested a specified number of levels deep. |
| 1741 | |
| 1742 | void DrawMapTriangle(real lon1, real lat1, real lon2, real lat2, real lon3, |
| 1743 | real lat3, flag fGlobe, int nScl, CIRC *pcr, real deg, int nLevel, int grf) |
| 1744 | { |
| 1745 | real x1, y1, x2, y2, x3, y3; |
| 1746 | |
| 1747 | // Recursive case: Draw four smaller triangles composing this triangle. |
| 1748 | if (nLevel > 0) { |
| 1749 | SphRatio(lon1, lat1, lon2, lat2, 0.5, &x1, &y1); |
| 1750 | SphRatio(lon2, lat2, lon3, lat3, 0.5, &x2, &y2); |
| 1751 | SphRatio(lon3, lat3, lon1, lat1, 0.5, &x3, &y3); |
| 1752 | DrawMapTriangle(x1, y1, x2, y2, x3, y3, fGlobe, nScl, pcr, deg, |
| 1753 | nLevel-1, 7); |
| 1754 | DrawMapTriangle(lon1, lat1, x1, y1, x3, y3, fGlobe, nScl, pcr, deg, |
| 1755 | nLevel-1, grf & 5); |
| 1756 | DrawMapTriangle(lon2, lat2, x1, y1, x2, y2, fGlobe, nScl, pcr, deg, |
| 1757 | nLevel-1, grf & 5); |
| 1758 | DrawMapTriangle(lon3, lat3, x2, y2, x3, y3, fGlobe, nScl, pcr, deg, |
| 1759 | nLevel-1, grf & 5); |
| 1760 | return; |
| 1761 | } |
| 1762 | |
| 1763 | // Base case: Draw the three sides of the triangle. |
| 1764 | if (!fGlobe) { |
| 1765 | lon1 = Mod(lon1 + deg); |
| 1766 | lon2 = Mod(lon2 + deg); |
| 1767 | lon3 = Mod(lon3 + deg); |
| 1768 | } |
| 1769 | if (grf & 1) |
| 1770 | DrawMapLine(lon1, lat1, lon2, lat2, fGlobe, nScl, pcr, deg); |
| 1771 | if (grf & 2) |
| 1772 | DrawMapLine(lon2, lat2, lon3, lat3, fGlobe, nScl, pcr, deg); |
| 1773 | if (grf & 4) |
| 1774 | DrawMapLine(lon3, lat3, lon1, lat1, fGlobe, nScl, pcr, deg); |
| 1775 | } |
| 1776 | |
| 1777 | |
| 1778 | // Draw a square between four coordinates on the globe, in which other |
no test coverage detected