algorithm - c++ harmonic value from time increment -
algorithm - c++ harmonic value from time increment -
i have counter in milliseconds increases during normal programme execution. wish mathematically convert counter harmonic value:
float getharmonictime(int currenttime, int periodinmilliseconds) { // cool algorithm here }
this function homecoming floating point value between -1 , 1 on course of study of given period so:
-1...-0.5...0...0.5...1...0.5...0...-0.5...-1
how algorithmically efficiently in c/c++?
thanks!
the formula you're looking sin( 2 * m_pi * currenttime / period )
.
c++ algorithm math
Comments
Post a Comment