Created
June 7, 2018 03:28
-
-
Save ando-takahiro/426ec5399cdd6bb43c9a06d610b0602e to your computer and use it in GitHub Desktop.
a function convert numpy to wavefront .obj mesh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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