This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Solve linear system with 2 unknowns

Tags: None
(comma "," separated)
Zyl
Registered Member
Posts
2
Karma
0

Solve linear system with 2 unknowns

Fri Jan 03, 2014 10:34 pm
Hello.

I need to solve a linear system for 2 unknowns, but I am overwhelmed by the terminology of everything and don't know what I need.
It's something like this:

px = (uo + tx) • (us • ux) + (vo + ty) • (vs • vx)
py = (uo + tx) • (us • uy) + (vo + ty) • (vs • vy)
pz = (uo + tx) • (us • uz) + (vo + ty) • (vs • vz)


All variables except tx and ty, which I want to find, are known. What do I need to use to do something like that with this library?
Thanks in advance!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Your system is overdetermined, so I guess your looking for a least-square solution. Anyway, you need to rewrite your system of equation in matrix form such that it looks like A * t = b with A a 3x2 matrix and b a 3x1 vector and t the 2x1 vector of unknown. Then look at the tutorial on solving linear system: http://eigen.tuxfamily.org/dox/group__T ... gebra.html. For instance, you can get t as:
Code: Select all
Matrix<double,3,2> A;
Vector3d b;
Vector2d t;
A << u_s * u, v_s * v;
b = p - u_o * u_s * u - v_o * v_s * v;
t = A.householderQr().solve(b);
Zyl
Registered Member
Posts
2
Karma
0
I am in a hurry with everything and found a solution to my problem using dot products of vectors. If I have time left later (in 2 weeks or so) I'll still want to give this approach a try since it looks like something worth learning.

In any case, thanks for the answer!


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]