Closed LogWell closed 2 years ago
Try
mymesh.print()
n = mymesh.celldata["Normals"] # whatever the name is
pts = mymesh.cellCenters()
arrs = Arrows(pts, pts+n*10)
show(mymesh, arrs)
Useful methods:
mymesh.computeNormals(cells=True)
mymesh.reverse()
Here is the solution:
mymesh.c((200, 200, 200))
mymesh.bc((255, 0, 0))
BTY: how to get the actual number of vertices in vedo
?
it's simply mymesh.NPoints()
.
In many cases, NPoints = NCells * 3
, how can I get a result like openmesh
?
mesh_om = om.read_trimesh(path_mesh)
print(mesh_om.n_vertices()) # 49998
print(mesh_om.n_faces()) # 100024
mesh_vedo = load(path_mesh)
print(mesh_vedo.NPoints()) # 300072 = 100024*3
print(mesh_vedo.NCells()) # 100024
In fact, the problem is how to get the real number starting with "v" stored in the obj
file.
Of course, I can also use with open
to read and get the length, but there will be one more read operation:
data_v = []
with open(path_mesh, "r") as fp:
for line in fp:
if line.startswith("#"):
continue
values = line.split()
if not values:
continue
if values[0] == "v":
data_v.append(list(map(float, values[1:4])))
data_v = np.array(data_v)
num_v = data_v.shape[0]
This issue may be a bit related.
yes - indeed if you add mesh1.clean()
you should get the 49998 vertices.
Left: in Blender, Right: in MeshLab