PyMesh / PyMesh

Geometry Processing Library for Python
1.88k stars 358 forks source link

Weird bug related to seaborn when saving ply files #77

Open ThibaultGROUEIX opened 6 years ago

ThibaultGROUEIX commented 6 years ago

Here is a minimal example.

import pymesh
import seaborn as sns
import numpy as np
sns.palplot(sns.color_palette("hls", 10))
mesh = pymesh.form_mesh(vertices=np.array([[0.1,0.1,0.1]]), faces=np.array([[0,0,0]]))
pymesh.meshio.save_mesh("test.ply", mesh, ascii=True)

It saves ply files in the european ply standart (with comas for floats). If you remove sns.palplot you get what you want, which is US ply standarts (floats with dots), and which is what meshlab expect. I don't really know why it happens though. So if you use seaborn and pymesh, be cautious :) Cheers

qnzhou commented 6 years ago

Hmmm, I am unable to reproduce this error... Are you using linux or mac? Which version of python?

ThibaultGROUEIX commented 6 years ago

Strange, it retested and it does happen for me. I'm with ubuntu 16.04, python 2.7. The output is :

ply
format ascii 1.0
comment Generated by PyMesh
element vertex 1
property double x
property double y
property double z
element face 1
property list uchar int vertex_indices
end_header
0,1 0,1 0,1
3 0 0 0

Notice the comas. Anyway, it's not very important, just wanted to point it out in case others run into the same thing, as pinpointing the cause of the issue is unnatural here.

qnzhou commented 6 years ago

Does it use comma when you save in other formats (e.g. .obj)?

ThibaultGROUEIX commented 6 years ago

No

 # Generated with PyMesh
v 0.1 0.1 0.1 
f 1 1 1