root@MCIRPS2.MED.NYU.EDU (07/06/90)
I need a line segment with a 3d arrow head with some finite width, shadng and depcueing, and surface properties that looks like a textbook cartoon vector. My first thoughts on the problem was to make an object and transform via rigid body translations and rotations, then stretch to fit the endpoints. Now, what is the best way to construct a xform matrix from two points? I don't care about roll about the long axis of the vector object(at least not yet). I was thinking about doing the rigid body xform by decomposing the vector between the endpoints, and getting the direction cosines from the implicit co-ordinate system of the vectors. If I understand correctly, the transformation matrix IS the matrix of direction cosines. Then finding the direction cosines would directly give the matrix. Once the vector object was stretched/compressed to the right length, the object would be rotated to the right direction(assuming that the back end of the vector was at the origin), and then translated into position (the x,y,z of the first point defining the desired fixed vector) For an arbitrary vector Rv(x,y,z), where x=x2-x1,y=y2-y1, and z=z2-z1, what I want is a transformation matrix T that will take a unit vector pointing in some direction and make it point congruent with Rv. Another way to put it is I want a transformation of the co-ordinate system of S into R. That would mean I would put a co-ordinate triad tail on our cartoon vector. Then that woud mean I would have to calculate the end points of the two other legs of the triad. For the untransformed vector that would be easy, (1,0,0),(0,1,0), and (0,0,1). Now for the vector I want, how would you find the other two legs of its co-ordinate system tail, each orthogonal to each other ? The first leg would be any vector in the normal plane to the desired vector, and the second leg would be the cross product to that. How do you not introduce a spurious roll in the transformation, even though it is unspecified and undetermined in the problem ? I am certain there is a simple way to do this. dan(who was asleep in vector algebra) -- +-----------------------------------------------------------------------------+ | karron@nyu.edu Dan Karron | | . . . . . . . . . . . . . . New York University Medical Center | | 560 First Avenue \ \ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> <your-number-here> | | (212) 340 5210 \**\__________________________________________ | +-----------------------------------------------------------------------------+