Okay, sometimes you have to select in a loop, but the main issue in your original post was the duplicate work. You can take advantage of subtracting bit arrays to avoid the duplicated work. Check out these two functions below. The first takes 11 seconds on a default teapot and the second takes 1/10th of a second. The only…
Thank you. Some code here is a "placeholder", like moving elements. I need to move them to few different places and use "default" shift in this example just to have overall "weight" of calculations as close to what it will be in the end. Collecting elements in groups instead of moving each individually every iteration…