Model Solar System (and related problems)

What did you draw?
Post Reply
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Model Solar System (and related problems)

Post by A Random Player »

So.. I've made something. Check this out:

Code: Select all

Gravity Fun at TestTubeGames.com: [ForceGr: r^(-2),Qual: 1,Zoom: 1,xSet: 0,ySet: 0], [x0: 0,y0: 0,vx: 0,vy: 0,t0: 0,who: 2,m: 100000000,n:Sun,c: 2], [x0: 14959.8261,y0: 0,vx: 0,vy: 81.7592177204741,t0: 0,who: 2,m: 300.3467,n:Earth,c: 2], [x0: 14998.266,y0: 0,vx: 0,vy: 84.5544654777364,t0: 0,who: 2,m: 3.6943,n:Moon,c: 2], [x0: 5790.905,y0: 0,vx: 0,vy: 131.409505131638,t0: 0,who: 2,m: 16.6012,n:Mercury,c: 2], [x0: 10820.8,y0: 0,vx: 0,vy: 96.132517340063,t0: 0,who: 2,m: 244.781,n:Venus,c: 2]
It's a semi-realistic model of the inner solar system. Radius isn't to scale (working on that), but all distances and masses *should* be (lookin' at you, Wikipedia).
When you open the code, you see the BIIIIG sun. Zoom out all the way, then scroll to the right. Catch up to Earth, Ptolemy, and do stuff.

Now, this runs into a few problems. Note the scale of the Earth-Moon system. Try setting Earth and Moon's densities to a very large number (At least 1e+09. You find that there's a limit on how small planets can be. This is problem 1. (I've made a formula to calculate the exact radii, but they don't fit: http://upload.wikimedia.org/wikipedia/c ... -scale.svg. (If you can't see the moon, scroll right.)

Now try loading this code:

Code: Select all

Gravity Fun at TestTubeGames.com: [ForceGr: r^(-2),Qual: 1,Zoom: 1,xSet: 0,ySet: 0], [x0: 0,y0: 0,vx: 0,vy: 0,t0: 0,who: 2,m: 100000000,n:Sun,c: 2], [x0: 14959.8261,y0: 0,vx: 0,vy: 81.7592177204741,t0: 0,who: 2,m: 300.3467,n:Earth,c: 2], [x0: 14998.266,y0: 0,vx: 0,vy: 84.5544654777364,t0: 0,who: 2,m: 3.6943,n:Moon,c: 2], [x0: 5790.905,y0: 0,vx: 0,vy: 131.409505131638,t0: 0,who: 2,m: 16.6012,n:Mercury,c: 2], [x0: 10820.8,y0: 0,vx: 0,vy: 96.132517340063,t0: 0,who: 2,m: 244.781,n:Venus,c: 2], [x0: 22793.91,y0: 0,vx: 0,vy: 66.2354643645988,t0: 0,who: 2,m: 32.2713,n:Mars,c: 2]
This adds Mars (but neither of the moons, since their orbital period is too small for now). Play the sim. Where's Jupiter? Ignoring the fact that it's not there, (while playing) scroll to the right and look for it. Go a few (~6-7) screen lengths to the right, come back.
Wait. Look up in the sky. Where's the sun?! (Don't believe me? Try selecting the sun while leaving. It disappears in a bit.)
Yeah, problem 2 is that objects that are too far away when the sim is running disappear.
---
Now I'm pretty sure that the radius issue is simply to make small particles easy to see, but it causes some problems here, so there should be an option. The problem of things disappearing I'm not entirely sure of, though Andy probably knows how to fix it. (Unless it's a precision issue, in which case fixing it might make the sim slower. Then you shouldn't fix it, or add an option if possible.)

These two problems limit the scale range of models in GSim (radius on small side and disappearance on big side), so simply scaling the model wouldn't work that much.
---
Notes on the model:
This assumes orbits are circular, and perturbations on the primary by a satellite are negligible. (Moon's orbit is slightly eccentric because of that.) This means you might want to CoM the sim right after you load.

Ninja-edit: A similar problem to problem 2 is observed for trails that are too far out of the viewing range. (I'm reasonably sure) the cutoff is based on current zoom level.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: Model Solar System (and related problems)

Post by testtubegames »

Ooh - the most accurate solar system in the sim to date! Nice!

I finally got a chance to look over these, and I can indeed explain the two problems. The first one is simplest. There is indeed a 'minimum' size that objects have so they show up on the screen. (2 pixels or so). This bug seems to be connected to that system, which must be implemented wrong. If you zoom in on a really, really dense object, it should always remain that minimum 2 pixels... instead right now it gets bigger. So that's fixable.

The second one is going to be a bit more challenging. Right now, when an object is extremely far off-screen, it gets deleted. This helps prevent random wayward objects from slowing the sim down, and also keeps the system from crashing as much when orbits are drawn. I *should* be able to get around these problems somewhat, though. I can (a) make this auto-cropping only happen when you've got a large number of objects... or (b) find a way to preserve the objects up to a huge distance... preventing it from drawing orbits, but not necessarily deleting the object entirely. Since, as we see here, sometimes you want to go back to it.

Out of curiosity, is there a reason you haven't scaled this model down more? It'd be nice (ideally) if you could fit more on the screen. Of course, I should really increase zooming even more... which would be another fix.
Post Reply