Skip to content

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