Skip to content

Commit

Permalink
fix: #35 tentatively solved the boundary anomaly of the bilinear methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ROGERWQH committed Aug 7, 2024
1 parent d025797 commit bc4e481
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/TIFFImageryProvider/src/helpers/resample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ export function resampleBilinear(data: TypedArray, options: ResampleDataOptions)
for (let y = 0; y < targetHeight; y++) {
const rawY = effectiveSourceHeight * (y0 + y / targetHeight * windowHeight) + buffer;
const yl = Math.floor(rawY);
const yh = Math.min(Math.ceil(rawY), sourceHeight - 1);
const yh = Math.min(Math.ceil(rawY), sourceHeight - buffer - 1);

for (let x = 0; x < targetWidth; x++) {
const rawX = effectiveSourceWidth * (x0 + x / targetWidth * windowWidth) + buffer;
const tx = rawX % 1;

const xl = Math.floor(rawX);
const xh = Math.min(Math.ceil(rawX), sourceWidth - 1);
const xh = Math.min(Math.ceil(rawX), sourceWidth - buffer - 1);

const ll = data[(yl * sourceWidth) + xl];
const hl = data[(yl * sourceWidth) + xh];
Expand Down

0 comments on commit bc4e481

Please sign in to comment.