Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Kris
Posts:
1
Registered:
8/20/09


Target vector
Posted:
Aug 20, 2009 8:52 PM


Okay, I'm by no means a mathematics wizard. I was required in college to get a math minor and every course was pretty brutal so bear with me if this seems remarkably obvious to some of you.
Here's my problem. I'm working on a graphics program. I'm doing a bit of 3D visualization programming (which I'm also not especially great at.. but whatareyagonnado..) in which I have a few 3D models moving through an open space.
Each model is represented by a 4x4 matrix: The first three rows of the matrix represent the rotation/orientation of the model relative to the absolute world XYZ axis.. first is the x orientation, second is y, third is z. The last row is the model's translation away from the absolute world origin (0,0,0).
(I'm assuming most of you found that really obvious but then again I'm really bad at explaining things, particularly in math, so excuse me while I go overboard..)
Thus if we have a model of a jet, and the wings are parallel to it's xaxis and the body is parallel to the yaxis, and at the moment the model's matrix was: 0 1 0 0 0 0 1 0 1 0 0 0 10 10 10 1
Then the model is at (10,10,10), with it's nose pointed straight up the xaxis and wings parallel to the yaxis.
(Alright that was probably far more explanation than need be but like I said, I tend to explain things poorly..)
Anyway... what I'm trying to do now is figure out how to orient the yaxis of the model toward a target XYZ location. Now, I know how to come up with a target vector... (targetXYZlocationXYZ)/(magnitude). I was going to use that as the yvector in the model matrix, but I can't figure out what to use as the x and z vectors. ie. the wings vector and the top of the plane vector.
Any help with this would be IMMENSELY appreciated. I've taken a linear algebra course, but obviously not a great deal of it stuck. Haha.



