You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, to calculate the prefix sum of a numerical array in GDscript you would have to do it manually via for loop. This is fine for smaller arrays, but for large arrays it would be preferable to have a built in solution, as it would be more performant.
The method could look something like this: Array.prefix_sum(numerical_array, exclusive = false)
Since the regular Array type can hold Variant types, perhaps it would be better to limit this to only Packed[NumberType]Array?
I'm not well versed in C++ or Godot internals, but from my understanding it would be relatively easy to implement, as C++ provides the methods already: std::inclusive_scan and std::exclusive_scan.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, to calculate the prefix sum of a numerical array in GDscript you would have to do it manually via
for loop
. This is fine for smaller arrays, but for large arrays it would be preferable to have a built in solution, as it would be more performant.The method could look something like this:
Array.prefix_sum(numerical_array, exclusive = false)
Since the regular Array type can hold Variant types, perhaps it would be better to limit this to only
Packed[NumberType]Array
?I'm not well versed in C++ or Godot internals, but from my understanding it would be relatively easy to implement, as C++ provides the methods already:
std::inclusive_scan
andstd::exclusive_scan
.Beta Was this translation helpful? Give feedback.
All reactions