Re: [Algorithms] decompose onto non-orthogonal vectors
Brought to you by:
vexxed72
From: <ro...@do...> - 2000-07-15 15:55:23
|
Peter Dimov wrote: >> Given a point p and two unit vectors a and b like this: >> >> b >> / >> v/----p >> / / >> / / >> / / >> ---------a >> u >> >> how to you get scalars (u,v) such that u*a + v*b = p? >> Ie. decompose p onto a and b. > >Easy. dot the equation with a and b, correspondingly: > >u * (a dot a) + v * (b dot a) = p dot a; >v * (a dot b) + v * (b dot b) = p dot b. > >Solve the system. In the 2D case this is more complicated than it need be, but will give the correct solution (provided, of course that one knows dot product and how to solve a 2x2 system). In the 3D case, this will give the correct solution only if p is indeed in the plane of a and b. It will not detect that there is no solution if p is not coplanar with a and b. |