diff options
author | Jaime van Kessel <nallath@gmail.com> | 2017-03-22 13:38:55 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2017-03-22 13:38:55 +0300 |
commit | 94c6b234181b4205fed877ac225df5353e94afdf (patch) | |
tree | 1439f7c0c307df09db6c2092d74a559acac4915e /cura/Layer.py | |
parent | 808df4c228118923b2476d943ef388cd45597a30 (diff) |
Codestyle & removal unused imports
Diffstat (limited to 'cura/Layer.py')
-rw-r--r-- | cura/Layer.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/cura/Layer.py b/cura/Layer.py index 869b84ed90..d5ef5c9bb4 100644 --- a/cura/Layer.py +++ b/cura/Layer.py @@ -1,10 +1,8 @@ -from .LayerPolygon import LayerPolygon - -from UM.Math.Vector import Vector from UM.Mesh.MeshBuilder import MeshBuilder import numpy + class Layer: def __init__(self, layer_id): self._id = layer_id @@ -80,8 +78,7 @@ class Layer: else: for polygon in self._polygons: line_count += polygon.jumpCount - - + # Reserve the neccesary space for the data upfront builder.reserveFaceAndVertexCount(2 * line_count, 4 * line_count) @@ -94,7 +91,7 @@ class Layer: # Line types of the points we want to draw line_types = polygon.types[index_mask] - # Shift the z-axis according to previous implementation. + # Shift the z-axis according to previous implementation. if make_mesh: points[polygon.isInfillOrSkinType(line_types), 1::3] -= 0.01 else: @@ -106,13 +103,14 @@ class Layer: # Scale all normals by the line width of the current line so we can easily offset. normals *= (polygon.lineWidths[index_mask.ravel()] / 2) - # Create 4 points to draw each line segment, points +- normals results in 2 points each. Reshape to one point per line + # Create 4 points to draw each line segment, points +- normals results in 2 points each. + # After this we reshape to one point per line. f_points = numpy.concatenate((points-normals, points+normals), 1).reshape((-1, 3)) - # __index_pattern defines which points to use to draw the two faces for each lines egment, the following linesegment is offset by 4 + + # __index_pattern defines which points to use to draw the two faces for each lines egment, the following linesegment is offset by 4 f_indices = ( self.__index_pattern + numpy.arange(0, 4 * len(normals), 4, dtype=numpy.int32).reshape((-1, 1)) ).reshape((-1, 3)) f_colors = numpy.repeat(polygon.mapLineTypeToColor(line_types), 4, 0) builder.addFacesWithColor(f_points, f_indices, f_colors) - return builder.build()
\ No newline at end of file |