| 2519 | // so its distance from the central body is on a logarithmic scale. |
| 2520 | |
| 2521 | void OrbitPlot(real *pxp, real *pyp, real *pzp, real sz, int obj, PT3R *rgspc) |
| 2522 | { |
| 2523 | real xp, yp, zp, xd, yd, zd, rDist; |
| 2524 | int objCenter; |
| 2525 | PT3R *spc; |
| 2526 | |
| 2527 | // Copy input parameters. Only care about Z-axis in 3D wireframe charts. |
| 2528 | xp = *pxp; yp = *pyp; |
| 2529 | zp = pzp != NULL ? *pzp : 0.0; |
| 2530 | |
| 2531 | // Tempoarily treat things orbiting planets as that planet's position. |
| 2532 | objCenter = ObjOrbit(obj); |
| 2533 | if (objCenter >= 0 && objCenter != oSun) { |
| 2534 | spc = rgspc + objCenter; |
| 2535 | xd = (xp - spc->x); |
| 2536 | yd = (yp - spc->y); |
| 2537 | zd = (zp - spc->z); |
| 2538 | xp = spc->x; |
| 2539 | yp = spc->y; |
| 2540 | zp = spc->z; |
| 2541 | } |
| 2542 | |
| 2543 | // Compute distance, determine ratio, and recompute coordinates. |
| 2544 | rDist = RLength3(xp, yp, zp); |
| 2545 | if (rDist < rSmall) |
| 2546 | return; |
| 2547 | rDist = (RLog(rDist / sz * 100.0 + 1.0) / rLog101) / (rDist / sz); |
| 2548 | xp *= rDist; yp *= rDist; zp *= rDist; |
| 2549 | |
| 2550 | // Scale things orbiting planets to be more distant from them. |
| 2551 | if (objCenter >= 0 && objCenter != oSun) { |
| 2552 | rDist = 1000.0 * (objCenter == oEar ? 1.0 : (objCenter == oMar ? 15.0 : |
| 2553 | (objCenter == oJup ? 0.9 : (objCenter == oSat ? 0.7 : |
| 2554 | (objCenter == oUra ? 4.0 : (objCenter == oNep ? 0.4 : 25.0)))))); |
| 2555 | #if FALSE |
| 2556 | // Modify radius with AstroExpression if one set. |
| 2557 | if (!us.fExpOff && FSzSet(us.szExpOrbit)) { |
| 2558 | ExpSetN(iLetterY, obj); |
| 2559 | ExpSetR(iLetterZ, rDist); |
| 2560 | ParseExpression(us.szExpOrbit); |
| 2561 | rDist = RExpGet(iLetterZ); |
| 2562 | } |
| 2563 | #endif |
| 2564 | xp += xd * rDist; |
| 2565 | yp += yd * rDist; |
| 2566 | zp += zd * rDist; |
| 2567 | } |
| 2568 | |
| 2569 | // Copy back to input parameters. |
| 2570 | *pxp = xp; *pyp = yp; |
| 2571 | if (pzp != NULL) |
| 2572 | *pzp = zp; |
| 2573 | } |
| 2574 | |
| 2575 | |
| 2576 | // This is a subprocedure of XChartOrbit(). Append the current set of planet |
no test coverage detected