From: Allen B. <al...@vr...> - 2003-04-17 03:27:35
|
Ben Scott wrote: > He means the prenormalization length. > > I agree with Kevin's comments. :) I agreed with Kevin's comments, but then I thought some more and now I am not sure. I do understand why we return the pre normalized length out the backend. Doing this can help in some algorithms. (I think dist from point to plane may be able to use this, but I don't remember). But thinking about it why can't the user just do this: float len = lengthSqr(vec); if (not isEqual(len, 1.0, epsilon)) len = Math::sqr(len); vec /= len; This can be easily written in any algorithm that wants to take advantage of the performance gain. I am not insisting on doing it this way or anything, but it seems that making the API more complex for something that "might" be useful but can easily be done by the user really doesn't fit with our ideas. (Also when you take into account that the method where we return the float from normalize() actually introduces another temporary for the return value it isn't even as optimal as the hand coded one above). Thats what I am thinking right now at least... give me another couple minutes and I will have completely changed my mind and think we should just use templates, python, or some other crazy crap for all of it. :) -Allen > > cheers, > -ben > > Justin Hare wrote: > >>> normalizeAndGetLength( vec ); // reads well, and shows the special opt >>> normalize( vec ); // standard method, ret vec out back >> >> >> >> Wouldn't the length of the vector after normalization always be the same? >> Or do you mean to return the pre-normalization length? >> >> ----------------------------------------- >> Justin Hare <ja...@vr...> >> Virtual Reality Applications Center >> Iowa State University, Howe Hall >> http://www.vrac.iastate.edu/~jahare >> ----------------------------------------- >> >> >> >> >> ------------------------------------------------------- >> 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 > > > > > > ------------------------------------------------------- > 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... -- PhD Candidate txtmsg - 515...@us... -- VR Juggler Team www.vrjuggler.org -- Virtual Reality Applications Center www.vrac.iastate.edu |