1 |
bearsoft |
1.1 |
#include "../../String/String.h"
|
2 |
|
|
#include "../../String/StringInput.h"
|
3 |
|
|
#include "../../System/System.h"
|
4 |
|
|
#include "../../Spline/Spline.h"
|
5 |
|
|
#include "SplineTest.h"
|
6 |
|
|
#include "../../System/SystemDefine.h"
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
SplineTest::SplineTest(){}
|
10 |
|
|
SplineTest::~SplineTest(){}
|
11 |
|
|
|
12 |
|
|
void SplineTest::run()
|
13 |
|
|
{
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
StringInput *stringInput = new StringInput();
|
17 |
|
|
|
18 |
|
|
stringInput->readFile("data/motion.txt");
|
19 |
|
|
|
20 |
|
|
stringInput->dontDefragMemory(1000); // select this if you want to have intern word buffer == less malloc, free
|
21 |
|
|
|
22 |
|
|
float *fbuffer=null;
|
23 |
|
|
|
24 |
|
|
int howMany=9;
|
25 |
|
|
|
26 |
|
|
while(stringInput->getScanWordStatus())
|
27 |
|
|
{
|
28 |
|
|
fbuffer=stringInput->findWordReturnFloats("ObjectMotion",2,howMany);
|
29 |
|
|
|
30 |
|
|
if ( fbuffer != null )
|
31 |
|
|
{
|
32 |
|
|
/* int howManySplines=(int)fbuffer[0];
|
33 |
|
|
System::println(howMany);
|
34 |
|
|
|
35 |
|
|
for ( int r=0; r<howMany ; r++ )
|
36 |
|
|
{
|
37 |
|
|
System::println(fbuffer[r+1]);
|
38 |
|
|
}
|
39 |
|
|
*/
|
40 |
|
|
}
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
Spline *spline = new Spline(3);
|
44 |
|
|
|
45 |
|
|
if ( fbuffer != null )
|
46 |
|
|
{
|
47 |
|
|
spline->read(fbuffer);
|
48 |
|
|
|
49 |
|
|
for ( int t=0; t<11 ; t++ )
|
50 |
|
|
{
|
51 |
|
|
spline->update();
|
52 |
|
|
float *motionSpline=spline->getSplineChannel(0);
|
53 |
|
|
System::println(motionSpline[0]);
|
54 |
|
|
spline->increaseTime(1.0f);
|
55 |
|
|
}
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
delete spline;
|
60 |
|
|
|
61 |
|
|
stringInput->resetScanWord();
|
62 |
|
|
|
63 |
|
|
delete stringInput;
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
} |