The algorithms behind the huge craters of planets like Diso
This deep dive is a work in progress. It covers part 3 of the PL9 routine, which draws craters on planets.
Part 3 of PL9 calculates the following and calls PLS22 to do the actual plotting.
First, the calculations:
K3(1 0) = 222 * roofv_x / z + x-coordinate of planet centre K4(1 0) = 222 * roofv_x / z - y-coordinate of planet centre (XX16 K2 ) = nosev_x / 2z (XX16+1 K2+1) = nosev_y / 2z (XX16+2 K2+2) = sidev_x / 2z (XX16+3 K2+3) = sidev_y / 2z
Then PLS22 does this with CNT2 stepping through a whole circle:
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 a whole circle from 0.