Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14069

Plot facet normals in trimesh from the facet center

$
0
0

For this sample torus mesh in trimesh, I've managed to plot the normals to facets:

import numpy as npimport trimeshmesh = trimesh.creation.torus(9, 3)# adapted from https://github.com/mikedh/trimesh/issues/549vec = np.column_stack((mesh.facets_origin, mesh.facets_origin + (mesh.facets_normal * mesh.scale * .05)))path = trimesh.load_path(vec.reshape((-1, 2, 3)))trimesh.Scene([mesh, path]).show(smooth=False)

below is the resultant plot:trimesh view

but as you can see, the origin of the facets is simply one of the vertices. How can the center of the facet be used as an origin for normals instead? I see mesh.triangles_center but there's not such luxury defined for facets it seems.


Viewing all articles
Browse latest Browse all 14069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>