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

Issue with return_ids when checking intersections between a mesh and line. #774

Closed
ManuGraiph opened this issue Dec 29, 2022 · 4 comments
Closed

Comments

@ManuGraiph
Copy link

ManuGraiph commented Dec 29, 2022

Hi!

This issue is something new, probably related to some recent update, because this exact same code worked flawlessly for me for a long time.

I'm using the mesh.intersect_with_line() function to check the intersection between a mesh and a line. If i do it without the return_ids argument, it works, returning the intersection point:

array([[18444.52929688, 11806.72460938, 2475. ]])

But when i add the return_ids = True argument, i'm getting the following error:

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (1, 2) + inhomogeneous part.

Any idea what could this be? As i said, this worked perfect for me, never an error, but just today this popped.

Edit: I think it's some numpy related issue.

@ManuGraiph
Copy link
Author

After some quick debugging, a fast fix (for my case when i just want/have one intersection per line) is just to change the line 2189 in mesh.py to:

return np.array(pts_ids[0][1])

That'd basically output the id.

@marcomusy
Copy link
Owner

Thanks for reporting this.
I believe this is due to the new numpy 1.24 which doesn't like inhomogeneous parts by default.
I will change the return value to a tuple of points and ids as separate objects:
return (pts, np.array(pts_ids)

marcomusy added a commit that referenced this issue Jan 8, 2023
@ManuGraiph
Copy link
Author

I switched it to just return pts for a more generic object, then i just convert it based on the length.

@ManuGraiph
Copy link
Author

Thanks for reporting this. I believe this is due to the new numpy 1.24 which doesn't like inhomogeneous parts by default. I will change the return value to a tuple of points and ids as separate objects: return (pts, np.array(pts_ids)

Oh, i just actually "read" your answer, i was literally gonna do that, add the ids in the same return as the points (i'm basically running the code twice to get the points and the ids).

Thanks!

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