Welcome, Guest. Please Login.
Gravity Simulator
11/23/17 at 08:59:12
News: Registration for new users has been disabled to discourage spam. If you would like to join the forum please send me an email with your desired screen name to tony at gravitysimulator dot com.
Home Help Search Login


1  General / Discussion / Re: Autopilot in the browser version
 on: 11/18/17 at 14:22:48 
Started by Tony | Post by Tony
Here is a way to make a customized, borderless, draggable date.
In the menu Autopilot > Now textbox paste the following and hit Update.
Code:
lblBlankTitle.style.visibility = 'hidden';
btnBlankClose.style.visibility = 'hidden';
divBlank.style.backgroundColor = 'rgba(0,0,255,0.0)'; 
divBlank.style.border = 'none';

divInBlank.style.width = '300px';
divInBlank.style.color = '#FFFF00';
divInBlank.style.fontSize = '20px';
divInBlank.style.fontFamily = 'Arial';
 


You can customize the font size, font color, and font.
Courier is a good font for tables of numbers because all characters are the same size.
 
In the menu Autopilot > Per graphic update textbox paste the following and press Update:
Code:
var d = UTC(elapsedTime * 1000 + startDate);
var arrd = d.split(" ");
var arrd2 = arrd[4].split(":");
d = '';
d = d + arrd[1]; //Month
d = d + " " + arrd[2]; //Date
d = d + " " + arrd[3]; //Year
d = d + " " + arrd2[0]; //Hour
d = d + ":" + arrd2[1]; //colon and minute
d = d + ":" + arrd2[2]; //colon and second
d = d + " UTC";
divInBlank.innerHTML = d;  


Note that you can remove lines of code if for example you don't want to display the minutes and seconds.
You can rearrange the lines of code if you prefer a different date format, for example, Year first.
Reply Quote Notify of replies  

2  General / Discussion / Re: Autopilot in the browser version
 on: 11/18/17 at 14:00:32 
Started by Tony | Post by Tony
In the Display menu is a choice called "Blank". It gives you a blank, unused interface that you can customize if you know a little HTML and Javascript.
 
Open the blank interface: menu Display > Blank
Open the Autopilot Now: menu Autopilot > Now
 
You can give the interface a name:
Enter the following into the Autopilot Now textarea and press Update.
Code:
lblBlankTitle.innerHTML = 'My Custom Div'; 


 
If you don't want your interface to have a title bar, use this line of code:
Code:
lblBlankTitle.style.visibility = 'hidden';
 


If you don't want your interface to have a close button, use this line of code:
Code:
btnBlankClose.style.visibility = 'hidden';
 


You can change the background color and opacity if your div with this line of code:
Code:
divBlank.style.backgroundColor = 'rgba(0,0,255,0.0)'; 
 

Setting the opacity to 0.0 means it will be transparent.
 
If you don't want your interface to have a border, use this line of code:
Code:
divBlank.style.border = 'none';
 


If you don't want your interface to be draggable, use this line of code (make sure to position it where you want it first!):
Code:
$("#divBlank").draggable({ disabled: true});
 


Your interface has a div (short for division. Basically a group of controls) inside it called divInBlank. Using this prevents you from messing up the title bar, borders, and close button. If you've eliminated your borders, title bar, close button, you don't have to use divInBlank. You can simply use divBlank instead.
 
Let's make an interface that give the user a text area where they can set the mass of the Sun in Solar masses, and a button that applies this change:
Code:
lblBlankTitle.innerHTML = "Set Sun's mass";
divInBlank.innerHTML = "<input type = 'text' id = 'txtSunMass' value = 1><br><input type = 'button' value = 'Apply' onclick = 'objMass[1] =Number(txtSunMass.value) * 332946.050894783;'>"; 


The line divInBlank.innerHTML lets you set the HTML inside this div. Don't press enter when typing this code. It has to be all one line. It can be as long as you like, but it has to be all one line.
Reply Quote Notify of replies  

3  General / Discussion / Re: Autopilot in the browser version
 on: 11/06/17 at 09:51:18 
Started by Tony | Post by Tony
This turns off the border and makes the background transparent for the date interface.
Put it in the Autopilot Now box.
Note: this hides the close button. To get it back you have to do btnCalendarDateUTCClose.style.visibility = 'visible';
 
Code:
lblCalendarUTC.style.visibility = 'hidden';
btnCalendarDateUTCClose.style.visibility = 'hidden';
divCalendarDateUTC.style.backgroundColor = 'rgba(0,0,255,0.0)'; 
divCalendarDateUTC.style.border = 'none';
 

Reply Quote Notify of replies  

4  General / Discussion / Re: Autopilot in the browser version
 on: 11/01/17 at 17:46:08 
Started by Tony | Post by Tony
Place Camera B at a certain RA and Dec (one time or per graphic update)
Code:
var RA = 18 + 36/60 + 56/3600;
var Dec = 38+47/60;

Dec = Math.PI * Dec / 180;
RA = Math.PI * RA / 12;
var d = 1e20;
var c = objects + 2;

var e = Math.PI * 23.4392810833333 / 180;

var xEq = Math.cos(RA) * Math.cos(Dec);
var yEq = Math.sin(RA) * Math.cos(Dec);
var zEq = Math.sin(Dec);

unitVectorVelocityX = xEq;
unitVectorVelocityY = Math.cos(e) * yEq + Math.sin(e) * zEq;
unitVectorVelocityZ = -Math.sin(e) * yEq +Math.cos(e) * zEq;
distance = 5e20;

objx[c] = distance * unitVectorVelocityX;
objy[c] = distance * unitVectorVelocityY;
objz[c] = distance * unitVectorVelocityZ;
objvx[c] = 0;
objvy[c] = 0;
objvz[c] = 0;
 


Reply Quote Notify of replies  

5  General / Discussion / Re: Galileo saw Neptune
 on: 10/15/17 at 15:08:25 
Started by frankuitaalst | Post by Tony
Thanks Frank. I forgot we had this thread. I'm glad to see that the two models agree with each other.
Reply Quote Notify of replies  

6  General / Discussion / Galileo saw Neptune - simulation with html
 on: 10/15/17 at 11:58:56 
Started by frankuitaalst | Post by frankuitaalst

Using the new html simulator Tony got this :  
 
http://orbitsimulator.com/gravitySimulatorCloud/simulations/1508018576963_Galile o%20observes%20Neptune.html
Reply Quote Notify of replies  

7  General / Discussion / Re: 2012 TC4
 on: 10/12/17 at 12:56:54 
Started by frankuitaalst | Post by Tony
Thanks for that!
The Daily Express used a still shot of the animation to announce that the asteroid "could smash into the MOON".  
http://www.express.co.uk/news/science/864681/asteroid-2012-tc4-belt-flight-path- destroy-earth-moon
Reply Quote Notify of replies  

8  General / Discussion / 2012 TC4
 on: 10/12/17 at 10:56:40 
Started by frankuitaalst | Post by frankuitaalst
Hello Tony ,
 
Just to let know your animation  of 2012TC4 is on local media via Wiki Commons  
 
https://www.vrt.be/vrtnws/nl/2017/10/12/asteroide-zoeft-langs-de-aarde--nasa-tes t-waarschuwingssysteem/
 
 
Congrats !
Reply Quote Notify of replies  

9  General / Discussion / Re: Orbital elements
 on: 09/08/17 at 08:26:04 
Started by jwbrase | Post by Tony
http://orbitsimulator.com/gsim.html
 
I added on_load to the Autopilot Single Events.
It will execute the code in between {{  }} the moment the update button is pressed, just like the Autopilot Now, if you saved your sim, the moment it loads.
 
You can use
on_load {{ }}
onload {{ }}
onLoad {{ }}
now {{ }}
They all do the same thing.
I also just learned that you can define global variables from within the auto pilots by simply assigning them a value without using a var statement. For example:
 
var helloWorld = 7;
would create a local variable that will not be saved after the current iteration is executed. It can not be shared between auto pilots.
 
helloWorld = 7;
will create a global variable.
 
Give it a test and let me know if it works for you.
Reply Quote Notify of replies  

10  General / Discussion / Re: Orbital elements
 on: 09/06/17 at 07:30:18 
Started by jwbrase | Post by Tony
I could probably add an "on load", but for the moment, you can just set the single event timer to 1 second after the start of your sim.
But any variables you define that way will be only local and temporary. I think there is a way to define global variables from within a function. I'll have to Google it to figure it out.
Reply Quote Notify of replies