Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OFF Exporter #11

Merged
merged 3 commits into from
Nov 23, 2017
Merged

OFF Exporter #11

merged 3 commits into from
Nov 23, 2017

Conversation

davidstutz
Copy link

Functionality to export a mesh as .off file; see e.g. here for a description of the format. Roughly, the format looks as follows:

OFF
n_vertices n_faces n_edges
v1_x v1_y v1_z
v2_x v2_y v2_z
...
f1_n_vertices f1_v1 f1_v2 f1_v3 ... v1_vn
f2_n_vertices f2_v1 f1_v2 f2_v3 ... v2_vn
...

where n_edges is 0 when using export_off and only triangular faces are used, i.e. fi_n_vertices is always 3.

Usage is similar to exporting meshes as .obj or .dae:

f = lambda x, y, z: x**2 + y**2 + z**2
vertices, triangles = mcubes.marching_cubes_func((-10,-10,-10), (10,10,10), 100, 100, 100, f, 16)
mcubes.export_off(vertices, triangles, "sphere.off")

@pmneila pmneila merged commit 9fd6059 into pmneila:master Nov 23, 2017
@pmneila
Copy link
Owner

pmneila commented Nov 23, 2017

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants