From: "Michel Chabroux"
Subject: Re: Bilinear Interpolation
Date: 23 May 2000 00:00:00 GMT
Message-ID:
References: <392A7E8C.164BD689@cad.ntu-kpi.kiev.ua>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
X-Trace: news.uswest.net 959097625 63.228.109.30 (Tue, 23 May 2000 11:00:25 CDT)
X-MSMail-Priority: Normal
NNTP-Posting-Date: Tue, 23 May 2000 11:00:25 CDT
Newsgroups: comp.graphics.algorithms
"meloman" wrote in message
news:392A7E8C.164BD689@cad.ntu-kpi.kiev.ua...
> Can someone tell me about subj?
Well, not that much complicate... Here's what to do at each pixel once
you've the real mapping coordinates (let's say u and v):
f0=(1-frac(u)*(1-frac(v))
f1=frac(u)*(1-frac(v))
f2=frc(u)*frac(v)
f3=(1-frac(u))*frac(v)
where frac(t) is the fractionnal part of t.
Then you'll use the colors are the 4 surrounding points P0, P1, P2 and P3 as
shown below :
P0 P1
+--------+
| . |
|...X....|
| . |
| . |
+--------+
P3 P2
The "bilinear filtered" color of your point (marked by the X) will be :
R=R0*f0+R1*f1+R2*f2+R3*f3
G=G0*f0+G1*f1+G2*f2+G3*f3
B=B0*f0+B1*f1+B2*f2+B3*f3
Voila ! Hope it'll help.
Michel