Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AnalyseMorphologique
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
INSTANCE de PREPROD
Les données peuvent être supprimées à tout moment.
Show more breadcrumbs
Scanner3D
AnalyseMorphologique
Commits
af36b95e
Commit
af36b95e
authored
1 year ago
by
Djalim Simaila
Browse files
Options
Downloads
Patches
Plain Diff
refactored folders and added vispy 3Drender
parent
2729ac5f
No related branches found
No related tags found
1 merge request
!6
3D Verticalisation
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
integration_tests/data_test.py
+1
-1
1 addition, 1 deletion
integration_tests/data_test.py
utils/graph3D/mpl_render.py
+4
-3
4 additions, 3 deletions
utils/graph3D/mpl_render.py
utils/graph3D/visplot_render.py
+33
-0
33 additions, 0 deletions
utils/graph3D/visplot_render.py
with
38 additions
and
4 deletions
integration_tests/data_test.py
+
1
−
1
View file @
af36b95e
...
...
@@ -6,7 +6,7 @@ import time
import
numpy
as
np
from
main
import
get_discrete_data
,
get_raw_data
from
utils.files
import
output
from
utils.files.input
import
ScannedObject
from
utils.files.input
import
ScannedObject
,
parse_result_file
def
check_discrete_data
(
expected_file
:
str
,
actual_file
:
str
,
ndigits
=
7
,
eps
=
0.00001
,
silent
:
bool
=
False
)
->
dict
:
"""
...
...
This diff is collapsed.
Click to expand it.
utils/
3d
/mpl_render.py
→
utils/
graph3D
/mpl_render.py
+
4
−
3
View file @
af36b95e
from
mpl_toolkits.mplot3d.art3d
import
Poly3DCollection
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
utils.files.input
import
ScannedObject
def
render3D
(
data
:
di
ct
):
def
render3D
(
obj
:
ScannedObje
ct
):
"""
Render a 3D model using matplotlib poly3dcollection
:param data: A dict with the vertices and faces
"""
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
projection
=
'
3d
'
)
faces
=
np
.
array
(
data
[
'
faces
'
]
)
verts
=
np
.
array
(
list
(
zip
(
data
[
'
x
'
],
data
[
'
y
'
],
data
[
'
z
'
])
))
faces
=
np
.
array
(
obj
.
get_
faces
()
)
verts
=
np
.
array
(
obj
.
get_vertices
(
))
mesh
=
Poly3DCollection
(
verts
[
faces
],
alpha
=
0.25
,
edgecolor
=
'
none
'
)
ax
.
add_collection3d
(
mesh
)
plt
.
show
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
utils/graph3D/visplot_render.py
0 → 100644
+
33
−
0
View file @
af36b95e
import
numpy
as
np
from
vispy
import
app
,
scene
from
vispy.scene.visuals
import
Mesh
from
vispy.scene
import
transforms
from
vispy.visuals.filters
import
ShadingFilter
,
WireframeFilter
from
utils.files.input
import
ScannedObject
def
render3D
(
obj
:
ScannedObject
):
vertices
=
np
.
asarray
(
obj
.
get_vertices
())
faces
=
np
.
asarray
(
obj
.
get_faces
())
canvas
=
scene
.
SceneCanvas
(
keys
=
'
interactive
'
,
bgcolor
=
'
white
'
)
view
=
canvas
.
central_widget
.
add_view
()
view
.
camera
=
'
arcball
'
view
.
camera
.
depth_value
=
1e3
mesh
=
Mesh
(
vertices
,
faces
,
color
=
(.
5
,
.
7
,
.
5
,
1
))
view
.
add
(
mesh
)
wireframe_filter
=
WireframeFilter
(
width
=
0
)
shading_filter
=
ShadingFilter
(
shininess
=
0
)
mesh
.
attach
(
wireframe_filter
)
mesh
.
attach
(
shading_filter
)
def
attach_headlight
(
view
):
light_dir
=
(
0
,
1
,
0
,
0
)
shading_filter
.
light_dir
=
light_dir
[:
3
]
initial_light_dir
=
view
.
camera
.
transform
.
imap
(
light_dir
)
@view.scene.transform.changed.connect
def
on_transform_change
(
event
):
transform
=
view
.
camera
.
transform
shading_filter
.
light_dir
=
transform
.
map
(
initial_light_dir
)[:
3
]
attach_headlight
(
view
)
canvas
.
show
()
app
.
run
()
\ No newline at end of file
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