summaryrefslogtreecommitdiff
path: root/src/python/gudhi
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2022-11-11 18:59:42 +0100
committerMarc Glisse <marc.glisse@inria.fr>2022-11-11 18:59:42 +0100
commit2d5039b7eeb16116ab859076aa0a93f092250d88 (patch)
tree9a89610dc9ff78fcb06126ed9cf9008fca08c209 /src/python/gudhi
parent4118bcb622c624130e768d9116a7e147a5e45c68 (diff)
Special case for writing 3d OFF
Diffstat (limited to 'src/python/gudhi')
-rw-r--r--src/python/gudhi/off_utils.pyx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/python/gudhi/off_utils.pyx b/src/python/gudhi/off_utils.pyx
index a8142791..9276c7b0 100644
--- a/src/python/gudhi/off_utils.pyx
+++ b/src/python/gudhi/off_utils.pyx
@@ -54,4 +54,9 @@ def write_points_to_off_file(fname, points):
"""
points = np.array(points, copy=False)
assert len(points.shape) == 2
- np.savetxt(fname, points, header='nOFF\n{} {} 0 0'.format(points.shape[1], points.shape[0]), comments='')
+ dim = points.shape[1]
+ if dim == 3:
+ head = 'OFF\n{} 0 0'.format(points.shape[0])
+ else:
+ head = 'nOFF\n{} {} 0 0'.format(dim, points.shape[0])
+ np.savetxt(fname, points, header=head, comments='')