Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
2ccce488
Commit
2ccce488
authored
Jul 30, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorize box sides creation
parent
79848771
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
actors.py
printrun/gl/libtatlin/actors.py
+14
-17
No files found.
printrun/gl/libtatlin/actors.py
View file @
2ccce488
...
...
@@ -52,6 +52,11 @@ def numpy2vbo(nparray, target = GL_ARRAY_BUFFER, usage = GL_STATIC_DRAW, use_vbo
def
triangulate_rectangle
(
i1
,
i2
,
i3
,
i4
):
return
[
i1
,
i4
,
i3
,
i3
,
i2
,
i1
]
def
triangulate_box
(
i1
,
i2
,
i3
,
i4
,
j1
,
j2
,
j3
,
j4
):
return
[
i1
,
i2
,
j2
,
j2
,
j1
,
i1
,
i2
,
i3
,
j3
,
j3
,
j2
,
i2
,
i3
,
i4
,
j4
,
j4
,
j3
,
i3
,
i4
,
i1
,
j1
,
j1
,
j4
,
i4
]
class
BoundingBox
(
object
):
"""
A rectangular box (cuboid) enclosing a 3D model, defined by lower and upper corners.
...
...
@@ -332,7 +337,7 @@ class GcodeModel(Model):
new_vertices
=
[]
if
prev_is_extruding
:
# Store previous vertices indices
first_prev
=
len
(
vertex_list
)
/
3
-
4
prev_id
=
len
(
vertex_list
)
/
3
-
4
# Average directions
avg_move_x
=
delta_x
+
prev_move_x
avg_move_y
=
delta_y
+
prev_move_y
...
...
@@ -356,14 +361,10 @@ class GcodeModel(Model):
new_vertices
.
extend
((
p2x
,
p2y
,
prev_pos
[
2
]
+
path_halfheight
))
first
=
len
(
vertex_list
)
/
3
# Link to previous
new_indices
+=
triangulate_rectangle
(
first_prev
,
first
,
first
+
1
,
first_prev
+
1
)
new_indices
+=
triangulate_rectangle
(
first_prev
+
1
,
first
+
1
,
first
+
2
,
first_prev
+
2
)
new_indices
+=
triangulate_rectangle
(
first_prev
+
2
,
first
+
2
,
first
+
3
,
first_prev
+
3
)
new_indices
+=
triangulate_rectangle
(
first_prev
+
3
,
first
+
3
,
first
,
first_prev
)
new_indices
+=
triangulate_box
(
prev_id
,
prev_id
+
1
,
prev_id
+
2
,
prev_id
+
3
,
first
,
first
+
1
,
first
+
2
,
first
+
3
)
else
:
# Compute vertices normal to the current move and cap it
p1x
=
prev_pos
[
0
]
-
path_halfwidth
*
move_normal_x
...
...
@@ -391,14 +392,10 @@ class GcodeModel(Model):
end_first
=
len
(
vertex_list
)
/
3
+
len
(
new_vertices
)
/
3
-
4
new_indices
+=
triangulate_rectangle
(
end_first
+
3
,
end_first
+
2
,
end_first
+
1
,
end_first
)
new_indices
+=
triangulate_rectangle
(
first
,
end_first
,
end_first
+
1
,
first
+
1
)
new_indices
+=
triangulate_rectangle
(
first
+
1
,
end_first
+
1
,
end_first
+
2
,
first
+
2
)
new_indices
+=
triangulate_rectangle
(
first
+
2
,
end_first
+
2
,
end_first
+
3
,
first
+
3
)
new_indices
+=
triangulate_rectangle
(
first
+
3
,
end_first
+
3
,
end_first
,
first
)
new_indices
+=
triangulate_box
(
first
,
first
+
1
,
first
+
2
,
first
+
3
,
end_first
,
end_first
+
1
,
end_first
+
2
,
end_first
+
3
)
index_list
+=
new_indices
vertex_list
+=
new_vertices
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment