我也來po我的三角波function好了.....
----------------------------------------------------------------
#include <math.h>
float wavefunc(float th) {
float r = fmod( th+M_PI_2 , M_PI*2 );
if(r<M_PI)
return r/M_PI_2-1.0;
else
return 3.0-r/M_PI_2;
}
--------------------------------------------------------------
希望有幫助.
--
And God said, "Let there be hope," and there was hope.
And God saw that it was good.
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: 140.112.30.18