Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qim3d
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QIM
Tools
qim3d
Commits
5f1fe78c
Commit
5f1fe78c
authored
4 months ago
by
Alessia Saccardo
Browse files
Options
Downloads
Patches
Plain Diff
change default backend method in mesh visualization
parent
496a8bd5
No related branches found
No related tags found
1 merge request
!156
Mesh pygel3d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/assets/screenshots/pygel3d_visualization.png
+0
-0
0 additions, 0 deletions
docs/assets/screenshots/pygel3d_visualization.png
qim3d/viz/_k3d.py
+8
-9
8 additions, 9 deletions
qim3d/viz/_k3d.py
with
8 additions
and
9 deletions
docs/assets/screenshots/pygel3d_visualization.png
0 → 100644
+
0
−
0
View file @
5f1fe78c
197 KiB
This diff is collapsed.
Click to expand it.
qim3d/viz/_k3d.py
+
8
−
9
View file @
5f1fe78c
...
@@ -176,7 +176,7 @@ def volumetric(
...
@@ -176,7 +176,7 @@ def volumetric(
def
mesh
(
def
mesh
(
mesh
,
mesh
,
backend
:
str
=
"
k
3d
"
,
backend
:
str
=
"
pygel
3d
"
,
wireframe
:
bool
=
True
,
wireframe
:
bool
=
True
,
flat_shading
:
bool
=
True
,
flat_shading
:
bool
=
True
,
grid_visible
:
bool
=
False
,
grid_visible
:
bool
=
False
,
...
@@ -184,14 +184,14 @@ def mesh(
...
@@ -184,14 +184,14 @@ def mesh(
save
:
bool
=
False
,
save
:
bool
=
False
,
**
kwargs
,
**
kwargs
,
)
->
Optional
[
k3d
.
Plot
]:
)
->
Optional
[
k3d
.
Plot
]:
"""
Visualize a 3D mesh using `
k
3d` or `
pygel
3d`.
"""
Visualize a 3D mesh using `
pygel
3d` or `
k
3d`.
Args:
Args:
mesh (pygel3d.hmesh.Manifold): The input mesh object.
mesh (pygel3d.hmesh.Manifold): The input mesh object.
backend (str, optional): The visualization backend to use.
backend (str, optional): The visualization backend to use.
Choose between `
k
3d` (default) and `
pygel
3d`.
Choose between `
pygel
3d` (default) and `
k
3d`.
wireframe (bool, optional): If True, displays the mesh as a wireframe.
wireframe (bool, optional): If True, displays the mesh as a wireframe.
Works both with `
k
3d` and `
pygel
3d`. Defaults to True.
Works both with `
pygel
3d` and `
k
3d`. Defaults to True.
flat_shading (bool, optional): If True, applies flat shading to the mesh.
flat_shading (bool, optional): If True, applies flat shading to the mesh.
Works only with `k3d`. Defaults to True.
Works only with `k3d`. Defaults to True.
grid_visible (bool, optional): If True, shows a grid in the visualization.
grid_visible (bool, optional): If True, shows a grid in the visualization.
...
@@ -214,22 +214,21 @@ def mesh(
...
@@ -214,22 +214,21 @@ def mesh(
- If `backend=
"
pygel3d
"
`, the function displays the mesh but does not return a plot object.
- If `backend=
"
pygel3d
"
`, the function displays the mesh but does not return a plot object.
Raises:
Raises:
ValueError: If `backend` is not `
'
k
3d
'
` or `
'
pygel
3d
'
`.
ValueError: If `backend` is not `
pygel
3d` or `
k
3d`.
Example:
Example:
```python
```python
import qim3d
import qim3d
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
synthetic_blob = qim3d.generate.noise_object(noise_scale = 0.015)
mesh = qim3d.mesh.from_volume(synthetic_blob)
mesh = qim3d.mesh.from_volume(synthetic_blob)
qim3d.viz.mesh(mesh, backend=
"
k
3d
"
) # or qim3d.viz.mesh(mesh, backend=
"
pygel
3d
"
)
qim3d.viz.mesh(mesh, backend=
"
pygel
3d
"
) # or qim3d.viz.mesh(mesh, backend=
"
k
3d
"
)
```
```
<iframe src=
"
https://platform.qim.dk/k3d/mesh_visualization.html
"
width=
"
100%
"
height=
"
500
"
frameborder=
"
0
"
></iframe>

"""
"""
if
backend
not
in
[
"
k3d
"
,
"
pygel3d
"
]:
if
backend
not
in
[
"
k3d
"
,
"
pygel3d
"
]:
raise
ValueError
(
"
Invalid backend. Choose
'
k
3d
'
or
'
pygel
3d
'
.
"
)
raise
ValueError
(
"
Invalid backend. Choose
'
pygel
3d
'
or
'
k
3d
'
.
"
)
# Extract vertex positions and face indices
# Extract vertex positions and face indices
face_indices
=
list
(
mesh
.
faces
())
face_indices
=
list
(
mesh
.
faces
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment