-
Notifications
You must be signed in to change notification settings - Fork 238
fix: value extraction of point cloud colors enum in display #995
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a696c97
docs: fix point cloud display with colors using enum
3102f7b
fix: revert previous commit
7925c82
fix: enum value extraction in display point cloud
18197cb
test: add test for mesh and point cloud enum value extraction
2a9c256
test: fix test for point cloud enum
f78c4ad
test: remove useless test again
0f235d4
fix: value extraction for mesh enum
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -85,8 +85,8 @@ def load_uri_to_vertices_and_faces(self: 'T') -> 'T': | |||||
| faces = mesh.faces.view(np.ndarray) | ||||||
|
|
||||||
| self.chunks = [ | ||||||
| Document(name=MeshEnum.VERTICES, tensor=vertices), | ||||||
| Document(name=MeshEnum.FACES, tensor=faces), | ||||||
| Document(name=MeshEnum.VERTICES.value, tensor=vertices), | ||||||
| Document(name=MeshEnum.FACES.value, tensor=faces), | ||||||
| ] | ||||||
|
|
||||||
| return self | ||||||
|
|
@@ -101,9 +101,9 @@ def load_vertices_and_faces_to_point_cloud(self: 'T', samples: int) -> 'T': | |||||
| faces = None | ||||||
|
|
||||||
| for chunk in self.chunks: | ||||||
| if chunk.tags['name'] == MeshEnum.VERTICES: | ||||||
| if chunk.tags['name'] == MeshEnum.VERTICES.value: | ||||||
| vertices = chunk.tensor | ||||||
| if chunk.tags['name'] == MeshEnum.FACES: | ||||||
| if chunk.tags['name'] == MeshEnum.FACES.value: | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same here |
||||||
| faces = chunk.tensor | ||||||
|
|
||||||
| if vertices is not None and faces is not None: | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,7 +133,10 @@ def _is_3d_vertices_and_faces(self): | |
| """ | ||
| if self.chunks is not None: | ||
| name_tags = [c.tags['name'] for c in self.chunks] | ||
| if MeshEnum.VERTICES in name_tags and MeshEnum.FACES in name_tags: | ||
| if ( | ||
| MeshEnum.VERTICES.value in name_tags | ||
| and MeshEnum.FACES.value in name_tags | ||
| ): | ||
|
Comment on lines
+136
to
+139
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same lets support the old way as well |
||
| return True | ||
| else: | ||
| return False | ||
|
|
@@ -173,11 +176,13 @@ def display_vertices_and_faces(self): | |
| import trimesh | ||
|
|
||
| vertices = [ | ||
| c.tensor for c in self.chunks if c.tags['name'] == MeshEnum.VERTICES | ||
| c.tensor | ||
| for c in self.chunks | ||
| if c.tags['name'] == MeshEnum.VERTICES.value | ||
| ][-1] | ||
| faces = [ | ||
| c.tensor for c in self.chunks if c.tags['name'] == MeshEnum.FACES.value | ||
| ][-1] | ||
| faces = [c.tensor for c in self.chunks if c.tags['name'] == MeshEnum.FACES][ | ||
| -1 | ||
| ] | ||
| mesh = trimesh.Trimesh(vertices=vertices, faces=faces) | ||
| display(mesh.show()) | ||
|
|
||
|
|
@@ -191,7 +196,7 @@ def display_point_cloud_tensor(self) -> None: | |
| for chunk in self.chunks: | ||
| if ( | ||
| 'name' in chunk.tags.keys() | ||
| and chunk.tags['name'] == PointCloudEnum.COLORS | ||
| and chunk.tags['name'] == PointCloudEnum.COLORS.value | ||
| and chunk.tensor.shape[-1] in [3, 4] | ||
| ): | ||
| colors = chunk.tensor | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for sake of compatibility with previous version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay it was not released so not needed actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I changed the
Meshclass toMeshEnum(Enum)in a previous PR, but didn't adjust the enum value extraction accordingly. This PR hasn't been in a release yet, therefore no need to add theMeshEnum.VERTICES.