interpolation between arbitrary quadrilaterals

Started by
12 comments, last by Kepakiano 11 years, 5 months ago
Quote:Original post by diegovar
However, there must be something wrong with my calculations, because the texture is not displaying properly. Substituting A by M yields a correct t (0), and the same happens for B (0), but substituting for C doesn't...


I ran through this again (after sleeping) and have a successfully tested solution. If you still need it, I'll post it. (Otherwise, it's too much typing!)
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
Advertisement
In the end, the coefficients were right. For the sake of completeness, here's a, b and c of the quadratic.


a = (A-D)⊗(C-B)
b = (M-A)⊗(A-D+C-B) + (A-D)⊗(B-A)
c = (M-A)⊗(B-A)

Here's a pic showing the texture coords at work.
textured quad

I must've messed up the code previously, because it worked, we presented our work on Thursday and the professor was very pleased :D.

Here's a couple of pictures of our resulting work.

img 1

img 2

Thanks a lot for all your help!


Diego
Quote:Original post by diegovar
we presented our work on Thursday and the professor was very pleased :D.


Good!

Quote:
Here's a couple of pictures of our resulting work.


Those all look fantastic!
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
I know this is a VERY old thread, but I encountered this problem as well and found the only solution here.
Unfortunately, I think erissian's formula is flawed. There is a small error which kept me busy for a while, but I solved it and thought I could share the solution:

erissian wrote:
M[sub]x[/sub] = (1-s)A[sub]x[/sub] + st(A-D+C-B)[sub]x[/sub] - t(A-D)[sub]x[/sub]
M[sub]y[/sub] = (1-s)A[sub]y[/sub] + st(A-D+C-B)[sub]y[/sub] - t(A-D)[sub]y[/sub]

But it should be:
M[sub]x[/sub] = [color=#ff0000]sB[sub]x[/sub]+(1-s)A[sub]x[/sub] + st(A-D+C-B)[sub]x[/sub] - t(A-D)[sub]x[/sub]
M[sub]y[/sub] = [color=#ff0000]sB[sub]y[/sub]+(1-s)A[sub]y[/sub] + st(A-D+C-B)[sub]y[/sub] - t(A-D)[sub]y[/sub]

This simplifies to these coefficients of the quadratic equation at[sup]2[/sup] + bt + ct = 0
a = C?D+D?B+A?C+B?A
b = M?C+D?M+B?M+M?A+C?A+B?D+2(A?B)
c = M?B+A?M+B?A

I don't know if these are the same values diegovar calculated in the end, but they work :)

This topic is closed to new replies.

Advertisement