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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -