diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-29 06:11:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-29 06:11:40 +0400 |
commit | 5549904171bd052b2b355e77b3582fd1e4b0a320 (patch) | |
tree | a38c4d30bfa126e671c80243a6695ea765b0a278 /source/gameengine/GameLogic | |
parent | dd106b5c7a129e00bebe121c4da8cb90a16d48cb (diff) |
style cleanup
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r-- | source/gameengine/GameLogic/SCA_RandomActuator.cpp | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp index 9a54c76ed4e..2d51a45fe55 100644 --- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp +++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp @@ -48,13 +48,13 @@ /* ------------------------------------------------------------------------- */ SCA_RandomActuator::SCA_RandomActuator(SCA_IObject *gameobj, - long seed, - SCA_RandomActuator::KX_RANDOMACT_MODE mode, - float para1, - float para2, - const STR_String &propName) - : SCA_IActuator(gameobj, KX_ACT_RANDOM), - m_propname(propName), + long seed, + SCA_RandomActuator::KX_RANDOMACT_MODE mode, + float para1, + float para2, + const STR_String &propName) + : SCA_IActuator(gameobj, KX_ACT_RANDOM), + m_propname(propName), m_parameter1(para1), m_parameter2(para2), m_distribution(mode) @@ -196,33 +196,30 @@ bool SCA_RandomActuator::Update() */ tmpval = new CFloatValue(m_parameter1); - } else { - /* - - 070301 - nzc - Now, with seed != 0, we will most assuredly get some - sensible values. The termination condition states two - things: - 1. s >= 0 is not allowed: to prevent the distro from - getting a bias towards high values. This is a small - correction, really, and might also be left out. - 2. s == 0 is not allowed: to prevent a division by zero - when renormalising the drawn value to the desired - distribution shape. As a side effect, the distro will - never yield the exact mean. - I am not sure whether this is consistent, since the error - cause by #2 is of the same magnitude as the one - prevented by #1. The error introduced into the SD will be - improved, though. By how much? Hard to say... If you like - the maths, feel free to analyse. Be aware that this is - one of the really old standard algorithms. I think the - original came in Fortran, was translated to Pascal, and - then someone came up with the C code. My guess it that - this will be quite sufficient here. - + } + else { + /* 070301 - nzc + * Now, with seed != 0, we will most assuredly get some + * sensible values. The termination condition states two + * things: + * 1. s >= 0 is not allowed: to prevent the distro from + * getting a bias towards high values. This is a small + * correction, really, and might also be left out. + * 2. s == 0 is not allowed: to prevent a division by zero + * when renormalising the drawn value to the desired + * distribution shape. As a side effect, the distro will + * never yield the exact mean. + * I am not sure whether this is consistent, since the error + * cause by #2 is of the same magnitude as the one + * prevented by #1. The error introduced into the SD will be + * improved, though. By how much? Hard to say... If you like + * the maths, feel free to analyse. Be aware that this is + * one of the really old standard algorithms. I think the + * original came in Fortran, was translated to Pascal, and + * then someone came up with the C code. My guess it that + * this will be quite sufficient here. */ - do - { + do { x = 2.0 * m_base->DrawFloat() - 1.0; y = 2.0 * m_base->DrawFloat() - 1.0; s = x*x + y*y; |