[help] Calculate 10 closest objects from an array
#8

Quote:
Originally Posted by °ғαιιοцт°
Quote:
Originally Posted by MadeMan
Find the closest one 10 times (loop), but every time you find one, save it to a variable and skip it on next check.
I know.. but looping 10 times isn't an option
I want it with looping just once

it must be possible, looping 10 times is reading every coordinate 9 times too much
You can calculate the distances only once, save them to an array and then loop them.

Other option is to create an array with 10 slots, save 10 first distances to this array and then every time find the longest distance from that array and replace it with smaller. This way you will loop 10 items, but you have to do it on every object.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)