I see a general problem in interpretation of the "spiral" 
so I took some drawing for aquadratíc and a rectangular matrix. 

  1. depending on the starting point you have to take a pre-designed direction
  2. if you hit the diagonal you have to turn right
  3. you have to invalidate the row/column you just were on
  4. proceeding to invalid points is not allowed.
  5. start a the central point is an immediate termination as it has no direction to proceed

The diagonal came to my mind thinking how to NOT increase the imaginative radius of the spiral.
The related subscripts for the diagonale points of an n*m are found as (-n/2+x,-m/2+y) 
The pink subscripts are obviously (n/2,m/2) and might be just virtual.   

As subscripts start with 1 and first  piece position  is also 1
some more adjustment of coordinates is required

I haven't written any useful line yet.

Open Exchange applications:
Certifications & Credly badges:
Global Masters badges:
Followers:
Following: