Skip to content

Instantly share code, notes, and snippets.

@ando-takahiro
Created June 7, 2018 03:28
Show Gist options
  • Select an option

  • Save ando-takahiro/426ec5399cdd6bb43c9a06d610b0602e to your computer and use it in GitHub Desktop.

Select an option

Save ando-takahiro/426ec5399cdd6bb43c9a06d610b0602e to your computer and use it in GitHub Desktop.
a function convert numpy to wavefront .obj mesh
import numpy as np
def save(file_path: str, vertices: np.ndarray, indices: np.ndarray) -> None:
with open(file_path, 'w') as out:
for v in vertices:
out.write('v %f %f %f\n' % tuple(v))
for f in indices:
out.write('f %d %d %d\n' % tuple(f + 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment