RE: [Algorithms] transforming vectors...
Brought to you by:
vexxed72
From: Willem H. de B. <Wi...@mu...> - 2003-03-31 13:07:05
|
Jim, Your matrix >4 0 0 >0 3 0 >0 0 2 Let's call it A. Now take a column vector X with components (1, 1, 1), and left-multiply it by A: AX = X' X' will have components (4,3,1). So not only is the magnitude of X' different from X, but so is its direction. Willem > -----Original Message----- > From: Jim Offerman [mailto:j.o...@cr...] > Sent: 31 March 2003 13:48 > To: gda...@li... > Subject: Re: [Algorithms] transforming vectors... > > > Hi Willem, > > >(snip) > >So I assume that when you say > >"3d vector" you mean, a 4d vector with a 4th component which is > >set to 1. > > > You're absolutely right... I should have mentioned I was > talking about > homogenous vectors ;-). > > Which is actually why I brought it up... I was getting a bit tired of > all the problems that popped up because the 3d vectors <x,y,z> in my > engine were implicitely treated as 4d vectors <x,y,z,1> (as I'm sure > many engine out there do), so I decided to make things > explicit and have > a Vector3 and Point3 class. > The former is treated as a true 3d vector (or, if you will, a > 4d vector > <x,y,z,0>) and the latter is treated as a homoegenous 4d vector. > > Poof... away went all my troubles. > > I just wanted to check I made the right call on the inverse-transpose > thing... > > >That's not necessarily true. Only if a transformation scales > uniformly > >in all directions (x, y, and z), does the direction of a > vector remain > >unchanged. > > > I was under the impression that this also holds true for a > non-uniform scale, given that the inverse(-transpose) of the > following scaling matrix: > > 4 0 0 > 0 3 0 > 0 0 2 > > is: > > 1/4 0 0 > 0 1/3 0 > 0 0 1/2 > > So no matter which matrix you use to transform the vector the > resulting direction is the same, as |<4,3,2>| == |<1/4,1/3,1/2>|. > > Of course, this is just a simple case... it will probably go > horribly wrong if you have a complex transformation that > combines several rotations, non-uniforms scales and translations. > > But then I already mentioned that I didn't allow any scales > in my engine ;). > > Jim Offerman > Crevace Games > www.crevace.com > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > |