Last active
April 5, 2016 17:00
-
-
Save r-lyeh-archived/1c9f04cf6d8ff0a7b4889e64d81d5d40 to your computer and use it in GitHub Desktop.
Revisions
-
r-lyeh revised this gist
Apr 5, 2016 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,11 @@ int main( int argc, const char **argv ) { float excess = fmodf( distance, cycle ); // P% playrate -> cycle + excess // ?% playrate -> cycle // ?% playrate = P% * (cycle) / (cycle+excess) float playrate = 1.00f * (cycle) / (cycle+excess); playrate = playrate > 0 ? 1.f / playrate : 0; playrate = playrate > 1.5 ? playrate - 1 : playrate; -
r-lyeh renamed this gist
Apr 5, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
r-lyeh created this gist
Apr 5, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> int main( int argc, const char **argv ) { if( argc >= 3 ) { float cycle = atof(argv[1]); float distance = atof(argv[2]); float excess = fmodf( distance, cycle ); // P% playrate -> distance // ?% playrate -> distance - excess // ?% playrate = P% * ( distance - excess ) / (distance) float playrate = 1.00f * (distance - excess) / distance; playrate = playrate > 0 ? 1.f / playrate : 0; playrate = playrate > 1.5 ? playrate - 1 : playrate; printf("walk-cycle=%f estimated-distance=%f estimated-excess=%f play-rate=%f\n", cycle, distance, excess, playrate); } }