parameters: (p1, p2)
return_statement: return [p3] + stitching_positions(p1, p3) + stitching_positions(p2, p3)
docstring: Returns a list of positions between p1 and p2 between MIN_SYSTEM_SEPARATION and MAX_STARLANE_LENGTH apart
docstring_summary: Returns a list of positions between p1 and p2 between MIN_SYSTEM_SEPARATION and MAX_STARLANE_LENGTH apart
docstring_tokens: Returns a list of positions between p1 and p2 between MIN_SYSTEM_SEPARATION and MAX_STARLANE_LENGTH apart
function: def stitching_positions(p1, p2):
      """
      Returns a list of positions between p1 and p2 between MIN_SYSTEM_SEPARATION and MAX_STARLANE_LENGTH apart
      """
      if 2 * universe_tables.MIN_SYSTEM_SEPARATION >= universe_tables.MAX_STARLANE_LENGTH:
          util.report_error(
              "MAX_STARLANE_LENGTH must be twice MIN_SYSTEM_SEPARATION to "
              "allow extra positions to be added to enforce MAX_STARLANE_LENGTH"
          )
          return []
  
      max_dist = universe_tables.MAX_STARLANE_LENGTH
      min_dist = universe_tables.MIN_SYSTEM_SEPARATION
      p1_p2_dist = util.distance(p1, p2)
      if p1_p2_dist < max_dist:
          return []
  
      # Pick a random point in an 2:1 ratio ellipse and then rotate and slide it in between p1 and p2
      p1_p2_theta = acos((p2[0] - p1[0]) / p1_p2_dist)
      p1_p2_scale = (p1_p2_dist - 2 * min_dist) / 2
      p1_p2_translation = ((p1[0] + p2[0]) / 2, (p1[1] + p2[1]) / 2)
  
      radius_0space = uniform(0.0, 1.0)
      angle_0space = uniform(0.0, 2.0 * pi)
      rotated_point = (
          radius_0space * p1_p2_scale * cos(angle_0space + p1_p2_theta),
          radius_0space * p1_p2_scale * sin(angle_0space + p1_p2_theta),
      )
  
      p3 = (rotated_point[0] + p1_p2_translation[0], rotated_point[1] + p1_p2_translation[1])
  
      return [p3] + stitching_positions(p1, p3) + stitching_positions(p2, p3)
function_tokens: def stitching_positions ( p1 , p2 ) : if 2 * universe_tables . MIN_SYSTEM_SEPARATION >= universe_tables . MAX_STARLANE_LENGTH : util . report_error ( "MAX_STARLANE_LENGTH must be twice MIN_SYSTEM_SEPARATION to " "allow extra positions to be added to enforce MAX_STARLANE_LENGTH" ) return [ ] max_dist = universe_tables . MAX_STARLANE_LENGTH min_dist = universe_tables . MIN_SYSTEM_SEPARATION p1_p2_dist = util . distance ( p1 , p2 ) if p1_p2_dist < max_dist : return [ ] # Pick a random point in an 2:1 ratio ellipse and then rotate and slide it in between p1 and p2 p1_p2_theta = acos ( ( p2 [ 0 ] - p1 [ 0 ] ) / p1_p2_dist ) p1_p2_scale = ( p1_p2_dist - 2 * min_dist ) / 2 p1_p2_translation = ( ( p1 [ 0 ] + p2 [ 0 ] ) / 2 , ( p1 [ 1 ] + p2 [ 1 ] ) / 2 ) radius_0space = uniform ( 0.0 , 1.0 ) angle_0space = uniform ( 0.0 , 2.0 * pi ) rotated_point = ( radius_0space * p1_p2_scale * cos ( angle_0space + p1_p2_theta ) , radius_0space * p1_p2_scale * sin ( angle_0space + p1_p2_theta ) , ) p3 = ( rotated_point [ 0 ] + p1_p2_translation [ 0 ] , rotated_point [ 1 ] + p1_p2_translation [ 1 ] ) return [ p3 ] + stitching_positions ( p1 , p3 ) + stitching_positions ( p2 , p3 )