Anonymous user
Bilinear interpolation: Difference between revisions
must be a draft: task description unfinished and only two (possible) implementations
(fixed some signed-ness stuff) |
(must be a draft: task description unfinished and only two (possible) implementations) |
||
Line 1:
{{draft task}}
Bilinear Interpolation is linear interpolation in 2 dimensions
<!-- TODO: Describe a *task*; must be a draft until that is done, and four implementations are written -->
=={{header|C}}==
<lang c>#include <stdint.h>
typedef struct {
uint32_t *pixels;
unsigned int w;
unsigned int h;
} image_t;
#define getByte(value, n) (value >> (n*8) & 0xFF)
Line 46:
putpixel(dst,x, y, result);
}
}</lang>▼
▲</lang>
=={{header|Racket}}==
This mimics the Wikipedia example.
<lang racket>#lang racket▼
▲<lang racket>
(require images/flomap)
Line 75 ⟶ 71:
(λ (k x y)
(flomap-bilinear-ref
fm k (+ 1/2 (/ x 250)) (+ 1/2 (/ y 250))))))</lang>
|