mikedh/trimesh

How to create a Z map and how to create Path3D from entities.Line

Opened this issue · 2 comments

Hello,

I have a mesh whose x,y,z mins have been zeroed. I now want to build a Z map with spacing: two dimensional ndarray (xMax/spacing,yMax/spacing) whose [i,j] values are equal to the max mesh z value at coordinates [spacingi,spacingj].

is there a smart way to do it via trimesh features or do I need to iterate through the array elements and perform a ray casting to capture the intersections?

Additional questions:

I am able to create a path.entities.Line object, but how can i create a path3d object from it?

good - line=trimesh.path.entities.Line([(1,2,3),(2,3,4)])
wrong - path3d=trimesh.path.Path3D(entities=line,vertices=line.points)

Best regards
Theophile

Hey, you might try using the trimesh.load_path helper function:

In [1]: import trimesh

In [2]: p = trimesh.load_path([[[1,2,3], [2,3,4]]])

In [3]: p
Out[3]: <trimesh.Path3D(vertices.shape=(2, 3), len(entities)=1)>

The load path function is working great, thanks a lot!

for the Z map, any recommendation on how I should proceed?

Best regards
Theophile