One good solution is not to sort through your input samples, but over your output positions. That is, you will always draw exactly Mpixels. To calculate the closest sample value for the iith pixel, use the array offset:
[(i*N+M/2)/M]
, ( , N ). , N , M, , , 1 ( , , ). , , , ( - - , ), , , .
source
share