Quadrilateral Interpolation
BlitzMax Forums/BlitzMax Programming/Quadrilateral Interpolation
| ||
Given four points, each with a 2D texcoord, how do you find the texcoord of any point within? The quad cannot be split into two triangles and solved separately. http://www.gamedev.net/community/forums/topic.asp?topic_id=538963 ![]() |
| ||
Don't know the answer but I'm positive there was some Blitz3D sample code (written by Birdie?) that did exactly this. If his code was based on a mathematical algorithm then it wouldn't be hard to adapt to Blitzmax. |
| ||
is there any way you can use the texture matrix to solve this? |
| ||
That quad does look an awful lot like a frustum matrix, but I am not sure how to turn it into one. |
| ||
I wonder if the poly rendering sites would be helpful here. It's a point in a poly translated into a normal |
| ||
I solved it this way: Find the point where the top and bottom lines meet. Find the angle of each point from the intersection point. Now find the angle of the point we want to find, from the intersection point. It will be between the other two angles, and its percentage of each tells you how to interpolate between those two values. Do the same for the left and right side, for the other coordinate. You have to check for the case where the edges are parallel, but that is easy. |
| ||
sorry, empty post |
| ||
Thanks. |
| ||
I would prefer a simple geometric solution: |
| ||
Nice! I tried for ages a couple of years ago to do this, to no avail. I imagine I'll make use of this at some point -- thanks. |