Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- def translate(coords):
- '''
- Coords are in the form [(x, y)]
- '''
- x_arr, y_arr = np.array(coords).transpose()
- x_min = x_arr.min()
- y_min = y_arr.min()
- if x_min < 0:
- x_arr -= x_min
- if y_min < 0:
- y_arr -= y_min
- trans_coords = np.vstack([x_arr, y_arr]).transpose()
- return trans_coords
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement