@@ -98,7 +98,7 @@ struct flt {
9898 int m2 ; // 18-36
9999};
100100
101- /* All values use earth's radius as the base distance unit (RE) */
101+ /* All values use earth's radius (R_E) as the base distance unit */
102102
103103// Planet radius squared
104104double prsq [32 ];
@@ -250,7 +250,7 @@ const struct flt py_[] = {
250250
251251double pw [32 ];
252252
253- // Planet orbit velocity in radians squared
253+ // Planet negative orbital angular velocity squared (i.e. -GM/r^3)
254254double pww [32 ];
255255const struct flt pww_ [] = {
256256 {0000 ,0000000 ,0000000 },
@@ -617,6 +617,7 @@ void invert(int p)
617617 updpln (p );
618618}
619619
620+ /* Get floating-point error of absxy */
620621void absv (int p )
621622{
622623 absx = absy = 0 ;
@@ -635,7 +636,7 @@ void absv(int p)
635636 }
636637}
637638
638- /* Get absolute planet position */
639+ /* Get planet absolute position */
639640void absxy (int p )
640641{
641642 // get distance from planet to sun
@@ -650,7 +651,7 @@ void absxy(int p)
650651 return ;
651652}
652653
653- /* Set absolute ship position */
654+ /* Set ship absolute position */
654655void shipxy (void )
655656{
656657 shipx = - (absx + x );
@@ -855,24 +856,24 @@ void updshp(void)
855856 // return if we're already set to the planet with strongest gravity
856857 if (par == maxj ) return ;
857858
858- // update ship position
859+ // update ship absolute position
859860 absxy (par );
860861 shipxy ();
861862
862- // ??
863+ // get dx and dy
863864 absv (par );
864865 ox = absx + x - ox ;
865866 oy = absy + y - oy ;
866867
867868 // set the current planet to the one with strongest gravity
868869 par = maxj ;
869870
870- // ??
871+ // get -dx and -dy
871872 absv (par );
872873 ox = absx - ox ;
873874 oy = absy - oy ;
874875
875- // set new relative position
876+ // update ship relative position
876877 absxy (par );
877878 x = - (absx + shipx );
878879 ox += x ;
0 commit comments