The max value was being calculated as the product of the max line width, max layer thickness
and max feedrate but it should be calculated as the maximum of the products of the width,
thickness and feedrate for each individual line. i.e. calculate the flow for each line
and use the min and max values of the flows.
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 prevents previous measurements from influencing the colour scheme. Essentially previously it was showing the colour scheme based on all lines you had ever seen, rather than just the line types you were currently seeing.
If the user makes certain structures visible or invisible, and this then causes the limits of the colour scheme to change, this now triggers the layer view to be re-rendered and updates the legend in the simulation view menu component.
This is just a refactor that shouldn't have any influence on the behaviour.
It is a necessary prerequisite to be able to trigger the updating of the layer view colour spectrum more frequently, i.e. if the visible line types change.
This way, if travel moves are not currently visible in the layer view, the travel moves don't get counted with the limits to determine the colour spectrum to grade each line with. Quite often, travel moves had a much greater speed than other moves, like 120mm/s instead of the fastest printed line 60mm/s. This caused all of the layer view to be pushed into the lower end of the spectrum. It makes it hard to distinguish the differences in speed and line width because travel moves influence the spectrum so much. This way, the travel moves only influence the spectrum if they are visible. If they are visible, it might be relevant to the user. Otherwise, the user gets the full spectrum to differentiate between all the line widths and speeds.
This currently doesn't update correctly yet. That is something we'll need to fix.
Just a few calls to min() or max() do the trick, rather than if statements.
I consider this more semantic, because we just intend to clamp values here, and min() and max() are commonly used to do that.
It should also be slightly faster because it's less Python and more internal in CPython, but considering that this happens at best like 60 times per second the performance impact of this will be practically nil.
This was probably copy-pasted wrongly years ago.
The Cura interface currently doesn't allow changing the minimum path anyway, so this doesn't have any effect on the actual behaviour of Cura. Still, can't hurt to fix this, for posterity.
Also adds a "show starts" option to the SimulationViewMenuComponent and corresponding logic
SimulationPass.py adds a prev_line_types attribute to the shader, which the shader uses to compare with its line_type to detect starts.