diff options
Diffstat (limited to 'cura/LayerPolygon.py')
-rw-r--r-- | cura/LayerPolygon.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cura/LayerPolygon.py b/cura/LayerPolygon.py index 2c3b432b1d..ddb3a86289 100644 --- a/cura/LayerPolygon.py +++ b/cura/LayerPolygon.py @@ -55,6 +55,14 @@ class LayerPolygon: self._jump_mask = self.__jump_map[self._types] self._jump_count = numpy.sum(self._jump_mask) + self._cumulative_type_change_counts = numpy.zeros(len(self._types)) + last_type = self.types[0] + current_type_count = 0 + for i in range(0, len(self._cumulative_type_change_counts)): + if last_type != self.types[i]: + current_type_count += 1 + last_type = self.types[i] + self._cumulative_type_change_counts[i] = current_type_count self._mesh_line_count = len(self._types) - self._jump_count self._vertex_count = self._mesh_line_count + numpy.sum(self._types[1:] == self._types[:-1]) @@ -180,6 +188,10 @@ class LayerPolygon: return self._data @property + def vertexCount(self): + return self._vertex_end - self._vertex_begin + + @property def elementCount(self): return (self._index_end - self._index_begin) * 2 # The range of vertices multiplied by 2 since each vertex is used twice @@ -207,6 +219,10 @@ class LayerPolygon: def jumpCount(self): return self._jump_count + @property + def cumulativeTypeChangeCounts(self): + return self._cumulative_type_change_counts + def getNormals(self) -> numpy.ndarray: """Calculate normals for the entire polygon using numpy. |