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

Function DrawWrap

xgeneral.cpp:785–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

783// running around the world and hence off the edges of the maps.
784
785void DrawWrap(int x1, int y1, int x2, int y2, int xmin, int xmax)
786{
787 int xmid, ymid, i, j, k;
788
789 if (x1 < 0) { // Special case for drawing world map.
790 DrawPoint(x2, y2);
791 return;
792 }
793 j = (xmin < 0); // Negative xmin means always draw forward.
794 if (j)
795 neg(xmin);
796 xmid = (xmax-xmin) / 2;
797 if (j)
798 k = (x1 < x2 ? xmid*7 : xmid)/4;
799 else
800 k = xmid;
801
802 // If endpoints aren't near opposite edges, just draw the line and return.
803 if (NAbs(x2-x1) < k) {
804 DrawLine(x1, y1, x2, y2);
805 return;
806 }
807 if ((i = (xmax-xmin+1) + (!j && x1 < xmid ? x1-x2 : x2-x1)) == 0)
808 i = 1;
809
810 // Determine vertical coordinate where our line runs off edges of screen.
811 ymid = y1+(int)((real)(y2-y1)*
812 (!j && x1 < xmid ? (real)(x1-xmin) : (real)(xmax-x1))/(real)i + rRound);
813 DrawLine(x1, y1, !j && x1 < xmid ? xmin : xmax, ymid);
814 DrawLine(j || x2 < xmid ? xmin : xmax, ymid, x2, y2);
815}
816
817
818// This routine, and its companion below, clips a line defined by its

Callers 6

DrawLeyLineFunction · 0.85
DrawMapLineFunction · 0.85
xcharts0.cppFile · 0.85
XChartAstroGraphFunction · 0.85
XChartHorizonFunction · 0.85
XChartEphemerisFunction · 0.85

Calls 1

DrawPointFunction · 0.85

Tested by

no test coverage detected