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

Wrap Trimesh #970

Merged
merged 4 commits into from
Oct 29, 2020
Merged

Wrap Trimesh #970

merged 4 commits into from
Oct 29, 2020

Conversation

akaszynski
Copy link
Member

Wrap Trimesh

Given a few issues that have demonstrated the use of (or mentioned problems with) trimesh, I thought it was time that we wrapped trimesh.Trimesh instances. See issue #966. For example:

import trimesh
points = [[0, 0, 0], [0, 0, 1], [0, 1, 0]]
faces = [[0, 1, 2]]
tmesh = trimesh.Trimesh(points, faces=faces, process=False)
mesh = pv.wrap(tmesh)

I did some tests and the wrap is quite fast as it only generates a new faces array, which you can do fairly quickly. For those users used to trimesh, this means that we can now plot those mesh types with pyvista.plot(tmesh).

I've also taken the liberty to update codespell and pydocstyle since our versions are old and updating them didn't introduce any additional spelling or style changes.

@codecov
Copy link

codecov bot commented Oct 29, 2020

Codecov Report

Merging #970 into master will increase coverage by 0.32%.
The diff coverage is 83.33%.

@@            Coverage Diff             @@
##           master     #970      +/-   ##
==========================================
+ Coverage   86.79%   87.12%   +0.32%     
==========================================
  Files          36       36              
  Lines        9112     9357     +245     
==========================================
+ Hits         7909     8152     +243     
- Misses       1203     1205       +2     

@darikg
Copy link
Contributor

darikg commented Oct 29, 2020

re #966, I was thinking it'd be convenient just in general to have the PolyData constructor assume that a two-dimensional faces array implies that every face has the same number of vertices, viz. the number of columns. Not sure how to handle backwards compatibility though -- an alternative static constructor like PolyData.from_faces_array(verts, faces) maybe?

@akaszynski akaszynski linked an issue Oct 29, 2020 that may be closed by this pull request
@banesullivan
Copy link
Member

I was thinking it'd be convenient just in general to have the PolyData constructor assume that a two-dimensional faces array implies that every face has the same number of vertices, viz. the number of columns. ...

I agree that would be useful. It seems the cell types in the faces array throws folks off quite frequently. I could try implementing this support while maintaining backward compatibility.

Copy link
Member

@banesullivan banesullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

@akaszynski akaszynski merged commit 026ef1f into master Oct 29, 2020
@akaszynski akaszynski mentioned this pull request Nov 8, 2020
@akaszynski akaszynski deleted the feat/wrap_trimesh branch November 10, 2020 19:53
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

Successfully merging this pull request may close these issues.

Segmentation fault while visualizing Trimesh object
3 participants