Solving second degree simultaneous equation
What would be the solution to the following two equations ?
A1uv + B1u 开发者_开发知识库+ C1v + D1 = 0
A2uv + B2u + C2v + D2 = 0
u, v in [0, 1]
The solution needs to be blazing fast because it needs to be solved for each pixel, hopefully a direct rather than iterative solution.
This is basically trying to find the inverse of a coons patch where the boundaries are straight lines.
Solve equation 1 for u, you get u = (-C_1v -D_1)/(A_1v+B_1)
. Substitute that into equation 2, multiply through by (A_1v+B_1)
, and you should get a quadratic in v. Use the quadratic equation to solve for v.
Bonus points for figuring out what happens when A_1v+B_1
is zero.
I used wolfram alpha.
The generic form timed out while calculating, but I did get a solution substituting one constant with a number.
The resulting solution was pages long :P.
I thing I will have to go with some other solution that approximates u,v, the direct solution will be too slow for a per pixel approach.
精彩评论