mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Add documentation.
This commit is contained in:
parent
6dff2bebb5
commit
4f20dc4c5d
3 changed files with 20 additions and 2 deletions
|
@ -57,6 +57,12 @@ class Layer:
|
|||
return result
|
||||
|
||||
def lineMeshCumulativeTypeChangeCount(self, path: int) -> int:
|
||||
""" The number of line-type changes in this layer up until #path.
|
||||
See also LayerPolygon::cumulativeTypeChangeCounts.
|
||||
|
||||
:param path: The path-index up until which the cumulative changes are counted.
|
||||
:return: The cumulative number of line-type changes up until this path.
|
||||
"""
|
||||
result = 0
|
||||
for polygon in self._polygons:
|
||||
num_counts = len(polygon.cumulativeTypeChangeCounts)
|
||||
|
|
|
@ -55,7 +55,7 @@ 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))
|
||||
self._cumulative_type_change_counts = numpy.zeros(len(self._types)) # See the comment on the 'cumulativeTypeChangeCounts' property below.
|
||||
last_type = self.types[0]
|
||||
current_type_count = 0
|
||||
for i in range(0, len(self._cumulative_type_change_counts)):
|
||||
|
@ -221,6 +221,13 @@ class LayerPolygon:
|
|||
|
||||
@property
|
||||
def cumulativeTypeChangeCounts(self):
|
||||
""" This polygon class stores with a vertex the type of the line to the next vertex. However, in other contexts,
|
||||
other ways of representing this might be more suited to the task (for example, when a vertex can possibly only
|
||||
have _one_ type, it's unavoidable to duplicate vertices when the type is changed). In such situations it's might
|
||||
be useful to know how many times the type has changed, in order to keep the various vertex-indices aligned.
|
||||
|
||||
:return: The total times the line-type changes from one type to another within this LayerPolygon.
|
||||
"""
|
||||
return self._cumulative_type_change_counts
|
||||
|
||||
def getNormals(self) -> numpy.ndarray:
|
||||
|
|
|
@ -166,7 +166,12 @@ class SimulationPass(RenderPass):
|
|||
if layer < self._layer_view._minimum_layer_num:
|
||||
start = end
|
||||
|
||||
# Calculate the range of paths in the last layer
|
||||
# Calculate the range of paths in the last layer. -- The type-change count is needed to keep the
|
||||
# vertex-indices aligned between the two different ways we represent polygons here.
|
||||
# Since there is one type per line, that could give a vertex two different types, if it's a vertex
|
||||
# where a type-chage occurs. However, the shader expects vertices to have only one type. In order to
|
||||
# fix this, those vertices are duplicated. This introduces a discrepancy that we have to take into
|
||||
# account, which is done by the type-change-count.
|
||||
type_change_count = layer_data.getLayer(self._layer_view._current_layer_num).lineMeshCumulativeTypeChangeCount(max(self._layer_view._current_path_num - 1, 0))
|
||||
current_layer_start = end
|
||||
current_layer_end = current_layer_start + self._layer_view._current_path_num + current_polygon_offset + type_change_count
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue