Re: Дык известное дело

Author: Lepsik [202 views] 2013-01-29 12:53:53
In response to: Дык известное дело by Штирлиц, 2013-01-29 11:48:09

я так делаю


    inline void SetValue( const float& value, unsigned __int8 xShift = 0, unsigned __int8 yShift = 0 )
    { 
        if( 0 < counter )
        {
            data.value = ( value + counter * data.value ) / ( counter + 1 ); 
            offx = static_cast<unsigned __int8>(( int(xShift) + counter * int(offx) ) / ( counter + 1 ));
            offy = static_cast<unsigned __int8>(( int(yShift) + counter * int(offy) ) / ( counter + 1 ));
            counter++;
        }else
        {
            data.value = value;
            offx = xShift;
            offy = yShift;
            counter = 1;
        }
    }

Reply
|
Reply to sender (private) |
Synchronize | Thread