ArrayIteratorNumbers feeding into PointMaterial - point scale changes unexpectedly #296
Replies: 3 comments 1 reply
-
for adding numbers to an array you can use https://dev.cables.gl/op/Ops.Array.ArraySetNumber_v2 and work with the lenght of an array. adding one number to an array3 does not really make sense though, since it essentially is not an array3 then anymore...as you might be aware, as it seems your workaround lives on that. |
Beta Was this translation helpful? Give feedback.
-
Thanks steam0r. I'll use your suggested op instead next time for my workaround (I hadn't seen that). I'm still curious though - do you think the need for the work around is because the scale change is actually designed into PointMaterial in some way that I'm not understanding or is it an accidental quirk/bug? |
Beta Was this translation helpful? Give feedback.
-
Sure, good point! I'll see if I can replicate it with just a few ops. |
Beta Was this translation helpful? Give feedback.
-
In my NASA API coronal mass ejections patch https://cables.gl/p/-QzI58, I have an array of speed values that I plot as points by setting point size according to speed value. The speed values have been normalized to be between 0 and 1 by dividing by the global maximum speed value.
In simplified terms I'm plotting the points by doing this - feeding an ArrayIteratorNumbers into a PointMaterial:
As I hoped, the points are plotted at different sizes according to their speed value.
However, I found that if I selected different ranges of years to plot, the overall scale of the points changed depending on the value of the last item in the selected speed array. If the last value was smaller, the point scale was smaller and if the last value was larger the point scale was larger (even though the points still showed the same variation in relative sizes).
I got around this by appending the global maximum speed value to the end of the selection array every time a new year range of speed values is selected. I wanted to do this by appending a single value but I couldn't find a single-number push op, only Array3PushNumbers, so I actually append 3 values, the last of which is set to be the maximum speed value.
As far as I can tell, these dummy points shouldn't plotted because the array of point coordinates still has the original length, so the 3 extra dummy values in the speed array would have no coordinates to be plotted with and so would (hopefully) be dropped.
So, I've achieved what I wanted but I had to do it with this hack. I've highlighted the hacking op in red in the editor.
Does anyone know why the PointMaterial behaves in this way, ie. changing scale according to the value of the last iteration's input value? Is it a feature, a bug or an accident? Or have I done something wrong?
Any thoughts would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions