Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TheophileLebrun opened this issue Jan 4, 2021 · 2 comments
Open

Comments

@TheophileLebrun
Copy link

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

@mikedh
Copy link
Owner

mikedh commented Jan 4, 2021

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)>

@TheophileLebrun
Copy link
Author

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

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

Best regards
Theophile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants