From: Wayne Piekarski Subject: Re: Solution to a vector problem To: rusin@math.niu.edu (Dave Rusin) Date: Tue, 22 Nov 1994 15:06:00 +1523847 (CST) > >I have an equation p = o + Xu + Yv where p, o, u, and v are all three > >dimensional vectors, and X and Y are numerical values. I want to be able > >to solve for X and Y. I cannot see any normal way to do this, so I > > If I understand you right, you're trying to find real numbers X and Y > such that the linear combination Xu+Yv of vectors comes out to the > vector p-o, right? First off, this may not be possible. You need to Yes, basically a virtual screen is defined in 3D with the origin at 'o' and the u and v vectors defining up and right. > verify that p-o lies in the plane spanned by u and v. One way to > do this is to take the cross product of the vectors u and v, then > take the dot product of that with p-o. If you don't get zero, quit -- no > X's and Y's can be found. If you do get zero proceed as follows. Take > a vector w perpendicular to u but not to v -- (u x v) x u will do -- > and then take dot products with both sides of the equation. The Xu will > drop out and you can solve for Y = (w . (p-o)) / (w. v). Similarly, > you solve for X. > > Is that what you wanted? Thanks for that. It is exactly what I wanted. I'll try it out and see what happens.... thanks, Wayne _ | \ /\ / |_) | waynep@cleese.apana.org.au | | \/ \/ ayne | iekarski | Adelaide - South Australia |