Fix accidentally always taking 0th line along

The input array here is 2D, but always 1 by N long. The output of where then gives a tuple of two arrays, one indicating the Y positions and the other the X positions. The X positions were therefore always 0. The amin and amax functions were then always taking this index 0 along in their results, regardless of whether the line at that index was visible at all or not.
This will also improve performance since it's checking the limits now only for half as many indices.
This commit is contained in:
Ghostkeeper 2021-04-03 17:19:24 +02:00
parent 9b1941a4a2
commit 6209a08121
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -501,8 +501,8 @@ class SimulationView(CuraView):
for layer_index in layer_data.getLayers():
for polyline in layer_data.getLayer(layer_index).polygons:
is_visible = numpy.isin(polyline.types, visible_line_types)
visible_indices = numpy.where(is_visible)
if visible_indices[0].size == 0: # No items to take maximum or minimum of.
visible_indices = numpy.where(is_visible)[0]
if visible_indices.size == 0: # No items to take maximum or minimum of.
continue
visible_feedrates = numpy.take(polyline.lineFeedrates, visible_indices)
visible_linewidths = numpy.take(polyline.lineWidths, visible_indices)