Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def load_vertices(fname):
- with open(fname) as f:
- res = [
- map(float, s.split(' ')[1:])
- for s in f if s.startswith('v ')
- ]
- return np.array(res)
- def save_vertices(fname, new_vertices):
- with open(fname) as f:
- lines = f.readlines()
- counter = 0
- with open(fname, 'w') as f:
- for s in lines:
- if not s.startswith('v '):
- f.write(s)
- f.write('\n')
- continue
- f.write('v {} {} {}\n'.format(new_vertices[counter]))
- counter += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement