Revision: 6348
http://playerstage.svn.sourceforge.net/playerstage/?rev=6348&view=rev
Author: gerkey
Date: 2008-04-16 19:53:17 -0700 (Wed, 16 Apr 2008)
Log Message:
-----------
tweaked gaussian sampler
Modified Paths:
--------------
code/player/trunk/server/drivers/localization/amcl/pf/pf_pdf.c
Modified: code/player/trunk/server/drivers/localization/amcl/pf/pf_pdf.c
===================================================================
--- code/player/trunk/server/drivers/localization/amcl/pf/pf_pdf.c
2008-04-17 01:41:17 UTC (rev 6347)
+++ code/player/trunk/server/drivers/localization/amcl/pf/pf_pdf.c
2008-04-17 02:53:17 UTC (rev 6348)
@@ -112,12 +112,14 @@
// http://www.taygeta.com/random/gaussian.html
double pf_ran_gaussian(double sigma)
{
- double x1, x2, w;
+ double x1, x2, w, r;
do
{
- x1 = 2.0 * drand48() - 1.0;
- x2 = 2.0 * drand48() - 1.0;
+ do { r = drand48(); } while (r==0.0);
+ x1 = 2.0 * r - 1.0;
+ do { r = drand48(); } while (r==0.0);
+ x2 = 2.0 * r - 1.0;
w = x1*x1 + x2*x2;
} while(w > 1.0 || w==0.0);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit