Getting pretty close on Section 5
This commit is contained in:
@@ -76,14 +76,14 @@ Output: a random reasonable orbit
|
||||
"""
|
||||
function gen_orbit(T::Float64, mass::Float64, primary::Body=Sun)
|
||||
μ = primary.μ
|
||||
i = rand(0.0:0.01:0.4999π)
|
||||
inc = rand(0.0:0.01:0.4999π)
|
||||
θ = rand(0.0:0.01:2π)
|
||||
i = 0
|
||||
while true
|
||||
i += 1
|
||||
e = rand(0.0:0.01:0.5)
|
||||
a = ∛(μ * ( T/2π )^2 )
|
||||
a*(1-e) < 1.1primary.r || return [ oe_to_xyz([ a, e, i, 0., 0., θ ], μ); mass ]
|
||||
a*(1-e) < 1.1primary.r || return [ oe_to_xyz([ a, e, inc, 0., 0., θ ], μ); mass ]
|
||||
i < 100 || throw(GenOrbit_Error)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,14 +44,14 @@ Generates a layout that works for most plots. Requires a title and a limit.
|
||||
"""
|
||||
function standard_layout(limit::Float64, title::AbstractString)
|
||||
limit *= 1.1
|
||||
Layout(title=title,
|
||||
# width=1400,
|
||||
# height=800,
|
||||
Layout(title=attr(font=attr(color="rgb(250,250,250)"), yanchor="top", y=0.95, text=title),
|
||||
textfont = attr(color="rgb(250,250,250)"),
|
||||
margin=attr(b=20, t=0, l=0, r=0),
|
||||
paper_bgcolor="rgba(5,10,40,1.0)",
|
||||
plot_bgcolor="rgba(100,100,100,0.01)",
|
||||
scene = attr(xaxis = attr(autorange = false,range=[-limit,limit]),
|
||||
yaxis = attr(autorange = false,range=[-limit,limit]),
|
||||
zaxis = attr(autorange = false,range=[-limit,limit]),
|
||||
plot_bgcolor="rgba(200,200,200,0.01)",
|
||||
scene = attr(xaxis = attr(autorange = false,range=[-limit,limit],color="rgb(255,255,255)"),
|
||||
yaxis = attr(autorange = false,range=[-limit,limit],color="rgb(255,255,255)"),
|
||||
zaxis = attr(autorange = false,range=[-limit,limit],color="rgb(255,255,255)"),
|
||||
aspectratio=attr(x=1,y=1,z=1),
|
||||
aspectmode="manual"))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user