nschloe / meshio

:spider_web: input/output for many mesh formats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to access nx, ny, nz fields

SyZbidi opened this issue Β· comments

Hi,
I've been trying to convert the x, y, z, nx, ny, nz fields of a ply file from double to float. I managed to do that to x,y,z but I didn't know how to retrieve the normals nx, ny, nz.
Any suggestion on how to do that? πŸ™
Thank you in advance,

#!/usr/bin/env python3

import meshio
import numpy as np

mesh_path = "/workspace/object_reconstruction_ws/src/blade.ply"  # double
mesh = meshio.read(mesh_path)

mesh.points[:] = mesh.points.astype(np.float32)
# convert nx,ny,nz ?
mesh.write("mesh-float.ply")