def _gridded_perm_translation(self, gp: GriddedPerm, placed_cell: Cell) -> GriddedPerm: """ Return the gridded permutation with all of the cells translated assuming that the point was placed at placed cell """ newpos = [ self._point_translation(gp, index, placed_cell) for index in range(len(gp)) ] return gp.__class__(gp.patt, newpos)
def _gridded_perm_translation_with_point(self, gp: GriddedPerm, point_index: int) -> GriddedPerm: """ Return the stretched gridded permutation obtained when the point at point_index in gp is placed. """ # TODO: to prepare for intervals consider all ways of drawing a # rectangle around point in cell. new_pos = [ self._point_translation(gp, i, (point_index, gp.patt[point_index])) if i != point_index else self._placed_cell(gp.pos[point_index]) for i in range(len(gp)) ] return gp.__class__(gp.patt, new_pos)