<?php
/*
Calculations
© Charles Chandler
http://qdl.scs-inc.us/?top=15394
*/
function DistanceOverDiameter($names, $inner, $outer) {
$diameter = $inner->radius_mean_km + $outer->radius_mean_km;
$distance = $outer->orbit_mean_km - $inner->orbit_mean_km;
$diamDist = $distance / $diameter;
return '
<tr>
<td>'.$names.'</td>
<td>'.ScientificNotation($distance * 1000, 2).'</td>
<td>'.ScientificNotation($diameter * 1000, 2).'</td>
<td>'.ScientificNotation($diamDist, 2).'</td>
</tr>
';
}
echo '
<table class="standard imageTableRight" style="white-space: nowrap;">
<caption>Table 1. Dist/Diam Ratios</caption>
<tbody>
<tr>
<th>planets</th>
<th>spacing</th>
<th>ave. diam.</th>
<th>dist/diam</th>
</tr>'.
DistanceOverDiameter('Mercury, Venus', $solSys->mercury, $solSys->venus).
DistanceOverDiameter('Venus, Earth', $solSys->venus, $solSys->earth).
DistanceOverDiameter('Earth, Mars', $solSys->earth, $solSys->mars).
DistanceOverDiameter('Mars, Jupiter', $solSys->mars, $solSys->jupiter).
DistanceOverDiameter('Jupiter, Saturn', $solSys->jupiter, $solSys->saturn).
DistanceOverDiameter('Saturn, Uranus', $solSys->saturn, $solSys->uranus).
DistanceOverDiameter('Uranus, Neptune', $solSys->uranus, $solSys->neptune).
DistanceOverDiameter('Neptune, Pluto', $solSys->neptune, $solSys->pluto).
'</tbody></table>
';
?>
|