|
From: Eric M. <ema...@um...> - 2003-09-23 15:58:20
|
I'd be happy with either one. I personally prefer the second one since it doesn't require the user to create a temporary variable prior to using the routine. Matrix44f lookat_mat = LookAt(gmtl::GetColumn(3,mat),gmtl::GetColumn(1,mat)); as opposed to: Vec3f a,b; gmtl::GetColumn(3,mat,a); gmtl::GetColumn(1,mat,b); Matrix44f lookat_mat = LookAt(a,b); Thanks for looking into this! E. At 10:39 09/23/2003 -0500, Allen Bierbaum wrote: >Ben Scott wrote: >>While it could be considered an unneeded function because you can achieve >>the same functionality on your own, I have often wanted the ability to get >>a column from a matrix as vector - especially when getting the forward >>vector for entities or doing billboarding. It's a relatively simple >>function that will bloat the API but not the user's code unless they use >>it. I figure that GMTL is hard enough for most people to grok because of >>the templates that anything we can do to help them use it and like it is >>good. >>I guess if Allen agrees with you and doesn't want it in the library I'll >>concede and just send Eric the patch rather than commit it. >>cheers, >>-Ben > >Sounds like a good idea to me. I would think a GetColumn and a GetRow >method would be helpful. > >As far as where to put it, we could make it a gmtl method. Something like: > >gmtl::getColumn(unsigned col, Matrix& mat, Vec& vec) > >and/or > >Vec gmtl::getColumn(unsigned col, Matrix& mat) > >What do you guys think? > >-Allen > >> >>> >>>I'm not sure it was an ambiguity, rather it was an effort not to bloat the >>>code with unneeded functions. >>> >>>for example, you can easily write your own GetColumn using the element >>>accessor operator ( mat[row][col] ). >>> >>>I see it as unneeded, but I'll defer the descision to allen or ben since I >>>don't feel too strongly about it. >>> >>>kevin >>> >>> >>>On Mon, 22 Sep 2003, Eric Maslowski wrote: >>> >>> >>>>Ben said he was going to take a look into adding GetColumn() routine to >>>>the >>>>library to simplify this ambiguity. Thanks for the response. >>>> >>>>cheers >>>> >>>>E. >>>> >>>>At 15:13 09/22/2003 -0500, you wrote: >>>> >>>> >>>>>mats are column ordered, so that helps. you should be able to index >>>> >>>>one >>>> >>>>>element and dereference it to get the column. >>>>> >>>>>I think (float*)&mat.mData[0] would be the first column, which if you >>>> >>>>init >>>> >>>>>a Vec with it: >>>>> >>>>>gmtl::Vec4f col; >>>>>col.set( (float*)&mat.mData[0] ); >>>>> >>>>> >>>>>second column (example): >>>>> >>>>> col.set( (float*)&mat(0,1) ); >>>>> >>>>> >>>>>4th column (translation component): >>>>> >>>>> col.set( (float*)&mat[0][3] ); >>>>> >>>>> >>>>> >>>>>-kevin >>>>> >>>>> >>>>> >>>>>On Mon, 22 Sep 2003, Eric Maslowski wrote: >>>>> >>>>> >>>>>>How this is the right list: What is the recommended method for >>>>grabbing an >>>> >>>>>>entire column? >>>>>> >>>>>>Can't seem to find a general GetColumn() routine in the Matrix >>>>definition. >>>> >>>>>>I can't seem to even grab the components and throw them in a vector >>>>when >>>> >>>>>>the Matrix44f is a pointer. >>>>>> >>>>>>Matrix44f* mat = entity->GetTransform(); // GetTransform() returns >>>>> >>>>>Matrix44f* >>>>> >>>>>>Vec3f out_vec(mat[2][0],mat[2][1],mat[2][2]); >>>>>> >>>>>>yields: >>>>>> >>>>>>error C2664: 'gmtl::Vec<DATA_TYPE,SIZE>::Vec(const DATA_TYPE &,const >>>>>>DATA_TYPE &,const DATA_TYPE &)' : cannot convert parameter 1 from >>>>>>'gmtl::Matrix<DATA_TYPE,ROWS,COLS>::RowAccessor *' to 'const float >>>>&' >>>> >>>>>>Any help would be greatly appreciated. >>>>>> >>>>>>cheers >>>>>> >>>>>>E. >>>>>> >>>>>> >>>>>> >>>>>>------------------------------------------------------- >>>>>>This sf.net email is sponsored by:ThinkGeek >>>>>>Welcome to geek heaven. >>>>>>http://thinkgeek.com/sf >>>>>>_______________________________________________ >>>>>>ggt-devel mailing list >>>>>>ggt...@li... >>>>>>https://lists.sourceforge.net/lists/listinfo/ggt-devel >>>>> >>>>>-- >>>>>*--*---*---*----*-----*------*------*-----*----*---*---*--* >>>>>Kevin Meinert /_/ >>>>>home - http://www.vrsource.org/~kevin \ / >>>>>music - http://www.subatomicglue.com \/ __ \/ >>>>> \__ >>>>> \_\ >>>> >>>-- >>>*--*---*---*----*-----*------*------*-----*----*---*---*--* >>>Kevin Meinert /_/ >>>home - http://www.vrsource.org/~kevin \ / >>>music - http://www.subatomicglue.com \/ __ \/ >>> \__ >>> \_\ >>> >> >> >>------------------------------------------------------- >>This sf.net email is sponsored by:ThinkGeek >>Welcome to geek heaven. >>http://thinkgeek.com/sf >>_______________________________________________ >>ggt-devel mailing list >>ggt...@li... >>https://lists.sourceforge.net/lists/listinfo/ggt-devel > > > >-- >-- Allen Bierbaum al...@vr... -- >-- VR Juggler Team www.vrjuggler.org -- >-- Virtual Reality Applications Center www.vrac.iastate.edu -- > > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >ggt-devel mailing list >ggt...@li... >https://lists.sourceforge.net/lists/listinfo/ggt-devel |