Revision: 6839 http://playerstage.svn.sourceforge.net/playerstage/?rev=6839&view=rev Author: alexcb Date: 2008-07-10 15:32:48 -0700 (Thu, 10 Jul 2008)
Log Message: ----------- optimized version of normalize Modified Paths: -------------- code/stage/trunk/libstage/stage.hh Modified: code/stage/trunk/libstage/stage.hh =================================================================== --- code/stage/trunk/libstage/stage.hh 2008-07-10 22:28:34 UTC (rev 6838) +++ code/stage/trunk/libstage/stage.hh 2008-07-10 22:32:48 UTC (rev 6839) @@ -170,7 +170,14 @@ /** Normalize an angle to within +/_ M_PI */ - inline double normalize( double a ){ return( atan2(sin(a), cos(a)));} + inline double normalize( double a ) + { + //optimized version of return( atan2(sin(a), cos(a))); + while( a < -M_PI ) a += 2.0 * M_PI; + while( a > M_PI ) a -= 2.0 * M_PI; + return a; + } + /** take binary sign of a, either -1, or 1 if >= 0 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit