|
From: James W. W. <ja...@wr...> - 2004-07-22 17:26:25
|
Dair Grant <da...@re...> wrote: >Roger Holmes wrote: > >>James' change of Q3Vector3D_Length to Q3FastVector3D_Length before >>comparing with 1.0 (with a tolerance) made me wonder why we need to do >>the square root. Why not call Q3FastVector2D_LengthSquared instead? > >That's normally a good trick to use (compare squares rather than actual >lengths), but this code is only hit in a debug build anyway - so it's >probably clearer when you're stepping through to just get the actual >length. While it's true that performance is not top priority in a debug build, I'd prefer that the debug build not be unnecessarily slow. I don't think it would be particularly unclear to write lengthSq = Q3FastVector3D_LengthSquared( &theNormal ); if (fabs( lengthSq - 1.0f ) > 2*kQ3RealZero) ... -- James W. Walker, ScriptPerfection Enterprises, Inc. <http://www.write-brain.com/> |