Skip to navigation

BBC Micro Elite

Drawing meridians and equators

The algorithms behind the meridians and equators of planets like Lave
---------------------------------------------------------------------
References: PL9 (Part 2 of 3)
  This deep dive is a work in progress. It covers part 2 of the PL9 routine,
  which draws meridians and equators on planets.
  
  Part 2 of PL9 calculates the following and, for each meridian, calls PLS2 to
  do the actual plotting.
  
  For meridian 1, we calculate the following
  
    CNT2 = arctan(-nosev_z_hi / roofv_z_hi) / 4
           with opposite sign to nosev_z_hi
  
    (XX16   K2  ) = nosev_x / z
    (XX16+1 K2+1) = nosev_y / z
    (XX16+2 K2+2) = roofv_x / z
    (XX16+3 K2+3) = roofv_y / z
  
  Then PLS2 does this, with CNT2 stepping through a half circle from the
  starting point set above:
  
    K6(1 0) = K3(1 0) + (XX16 K2) * cos(CNT2) + (XX16+2 K2+2) * sin(CNT2)
            = K3(1 0) + (nosev_x / z) * cos(CNT2) + (roofv_x / z) * sin(CNT2)
  
    (T X) = - |XX16+1 K2+1| * cos(CNT2) - |XX16+3 K2+3| * sin(CNT2)
          = - |nosev_y / z| * cos(CNT2) - |roofv_y / z| * sin(CNT2)
  
  calling BLINE each iteration to plot segments to:
  
    x = K6(1 0), y = K4(1 0) + (T X)
  
  and counting CNT2 through half a circle from its starting point.
  
  For meridian 2, we calculate the following
  
    CNT2 = arctan(-nosev_z_hi / sidev_z_hi) / 4
           with opposite sign to nosev_z_hi
  
    (XX16   K2  ) = nosev_x / z
    (XX16+1 K2+1) = nosev_y / z
    (XX16+2 K2+2) = sidev_x / z
    (XX16+3 K2+3) = sidev_y / z
  
  Then PLS2 does this, with CNT2 stepping through a half circle from the
  starting point set above:
  
    K6(1 0) = K3(1 0) + (XX16 K2) * cos(CNT2) + (XX16+2 K2+2) * sin(CNT2)
            = K3(1 0) + (nosev_x / z) * cos(CNT2) + (sidev_x / z) * sin(CNT2)
  
    (T X) = - |XX16+1 K2+1| * cos(CNT2) - |XX16+3 K2+3| * sin(CNT2)
          = - |nosev_y / z| * cos(CNT2) - |sidev_y / z| * sin(CNT2)
  
  calling BLINE each iteration to plot segments to:
  
    x = K6(1 0), y = K4(1 0) + (T X)
  
  and counting CNT2 through half a circle from its starting point.