Difference between revisions of "Template:OrbitAltitude"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (Fix comment.)
(+Use Template:Formatnum with automatic decimal separator usage;)
Line 1: Line 1:
{{#if: {{{radius_km|}}}|<!--
+
<includeonly>{{formatnum|{{#expr:((({{{period_s}}}^2 * {{G}} * {{{mass_kg}}}/(4 * pi^2)) ^ (1/3)) {{#if: {{{radius_km|}}}|*1000}} - {{#if: {{{radius_km|}}}|{{{radius_km}}}|{{{radius_m}}}}}}}|2}}{{#if: {{{suffix|}}}|&nbsp;{{#if: {{{radius_km|}}}|km|m}}}}</includeonly><noinclude>
-->{{#expr: <!--
 
-->    ( <!--
 
-->        ( <!--
 
-->            ( <!--
 
-->                {{{period_s}}}^2 * {{G}} * {{{mass_kg}}} <!--
 
-->                / (4 * pi^2) <!--
 
-->            ) ^ (1/3) <!--
 
-->        ) / 1000 <!--
 
-->    ) - {{{radius_km}}} <!--
 
-->    {{{round|}}} <!--
 
-->}} {{{suffix|km}}}<!--
 
-->|<!--
 
-->{{#expr: <!--
 
-->    ( <!--
 
-->        ( <!--
 
-->            ( <!--
 
-->                {{{period_s}}}^2 * {{G}} * {{{mass_kg}}} <!--
 
-->                / (4 * pi^2) <!--
 
-->            ) ^ (1/3) <!--
 
-->        ) <!--
 
-->    ) - {{{radius_m}}} <!--
 
-->    {{{round|}}} <!--
 
-->}} {{{suffix|m}}}<!--
 
-->}}<noinclude>
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 33: Line 9:
 
|}
 
|}
  
This template calculates the altitude of an orbit, given the mass of the planet (in kg), the planet's radius (in km), and the period of the orbit (in seconds).
+
This template calculates the altitude of an orbit, given the mass of the planet (in kg), the planet's radius (in km or m), and the period of the orbit (in seconds).
  
[[Category:Templates|OrbitAltitude]]
+
[[Category:Templates|OrbitAltitude]]</noinclude>
</noinclude>
 

Revision as of 19:38, 6 April 2013


Usage Produces
{{OrbitAltitude | period_s=64980 | mass_kg=4.515e21 | radius_km=320}}
0.00 m
{{OrbitAltitude | period_s=64980 | mass_kg=4.515e21 | radius_m=320000}}
0.00 m

This template calculates the altitude of an orbit, given the mass of the planet (in kg), the planet's radius (in km or m), and the period of the orbit (in seconds).