[Stk] BlitSquare bug?

Steven Yi stevenyi at gmail.com
Tue Mar 3 07:11:41 PST 2015


Hi All,

I was translating the STK code for BlitSquare to another language and
I have a question about the code.  As far as I can tell, the code in
BlitSquare.h for the tick method looks to have a bug.  I noticed this:

  StkFloat temp = lastBlitOutput_;
  ...
  lastBlitOutput_ += temp;

  // Now apply DC blocker.
  lastFrame_[0] = lastBlitOutput_ - dcbState_ + 0.999 * lastFrame_[0];
  dcbState_ = lastBlitOutput_;

The value of dcbState_ and temp are both set to the lastBlitOutput_.
The calculation adds temp, but then subtracts dbcState_, which
effectively makes the line calculating last_frame_[0] :

  lastFrame_[0] = lastBlitOutput_ + 0.999 * lastFrame_[0];

if one takes out the "lastBlitOutput_ += temp" line.

In my translated code, I've plotted both the direct translation as
well as a version removing the use of temp and dcbState_ and I got the
same results.

Could someone confirm my analysis about this code?

Thanks!
steven



More information about the Stk mailing list