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

Function NCheckEclipseSolarLoc

calc.cpp:2348–2393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2346// BmpDarkenKv() to darken parts on the globe that are under a solar eclipse.
2347
2348int NCheckEclipseSolarLoc(real lon, real lat, real *prPct)
2349{
2350 CI ciSav;
2351 PT3R ptSav[oMoo+1], ptDiff;
2352 real obj[oMoo+1], alt[oMoo+1], r1, r2, r3, r4, r5, r6;
2353 int i, et = etUndefined;
2354 flag fSav1, fSav2;
2355
2356 // Save existing chart settings to be restored later.
2357 ciSav = ciCore;
2358 fSav1 = us.fEclipseAny; us.fEclipseAny = fFalse;
2359 fSav2 = us.fTopoPos; us.fTopoPos = 2;
2360 for (i = oSun; i <= oMoo; i++) {
2361 ptSav[i] = space[i];
2362 obj[i] = planet[i]; alt[i] = planetalt[i];
2363 }
2364
2365 // Compute the topocentric position of the Sun at a particular location.
2366 i = oSun;
2367 OO = lon; AA = lat;
2368 if (!FSwissPlanet(i, JulianDayFromTime(is.T), us.objCenter,
2369 &r1, &r2, &r3, &r4, &r5, &r6))
2370 goto LDone;
2371 planet[i] = Mod(r1 + is.rSid); planetalt[i] = r2;
2372 SphToRec(r4, planet[i], planetalt[i],
2373 &space[i].x, &space[i].y, &space[i].z);
2374
2375 // For the Moon, for speed just apply the vector between the Sun positions.
2376 i = oMoo;
2377 ptDiff = space[oSun]; PtSub2(ptDiff, ptSav[oSun]);
2378 PtAdd2(space[i], ptDiff);
2379 RecToSph3(space[i].x, space[i].y, space[i].z, &planet[i], &planetalt[i]);
2380
2381 et = NCheckEclipse(oSun, oMoo, prPct);
2382
2383LDone:
2384 // Restore chart settings saved earlier.
2385 ciCore = ciSav;
2386 us.fEclipseAny = fSav1;
2387 us.fTopoPos = fSav2;
2388 for (i = oSun; i <= oMoo; i++) {
2389 planet[i] = obj[i]; planetalt[i] = alt[i];
2390 space[i] = ptSav[i];
2391 }
2392 return et;
2393}
2394#endif
2395
2396

Callers 1

BmpDarkenKvFunction · 0.85

Calls 5

FSwissPlanetFunction · 0.85
ModFunction · 0.85
SphToRecFunction · 0.85
RecToSph3Function · 0.85
NCheckEclipseFunction · 0.85

Tested by

no test coverage detected