| 28 | | struct timeval time; |
|---|
| 29 | | gettimeofday(&time,NULL); |
|---|
| 30 | | |
|---|
| 31 | | unsigned pointCount = 1000; |
|---|
| 32 | | RawPoint *points = malloc(sizeof(RawPoint)*pointCount); |
|---|
| 33 | | RawFrame frame = {points, pointCount}; |
|---|
| 34 | | |
|---|
| 35 | | float t = (time.tv_sec + time.tv_usec/1000000)/10000*position; |
|---|
| 36 | | |
|---|
| 37 | | unsigned i; |
|---|
| 38 | | for(i = 0; i < pointCount; i++) |
|---|
| 39 | | { |
|---|
| 40 | | float t_p = (i/(float)pointCount)*2*3.14159*5+t; |
|---|
| 41 | | |
|---|
| 42 | | points[i].x = cos(freq_x*t_p)*32767; |
|---|
| 43 | | points[i].y = sin(freq_y*t_p)*32767; |
|---|
| 44 | | |
|---|
| 45 | | points[i].r = 0xFF*i/pointCount; |
|---|
| 46 | | points[i].g = 0xFF*i/pointCount; |
|---|
| 47 | | points[i].b = 0xFF*i/pointCount; |
|---|
| 48 | | |
|---|
| 49 | | points[i].r = 0xFF; |
|---|
| 50 | | points[i].g = 0xFF; |
|---|
| 51 | | points[i].b = 0xFF; |
|---|
| 52 | | } |
|---|
| 53 | | |
|---|
| 54 | | return frame; |
|---|
| | 28 | struct timeval time; |
|---|
| | 29 | gettimeofday(&time,NULL); |
|---|
| | 30 | |
|---|
| | 31 | unsigned pointCount = 1000; |
|---|
| | 32 | RawPoint *points = malloc(sizeof(RawPoint)*pointCount); |
|---|
| | 33 | RawFrame frame = {points, pointCount}; |
|---|
| | 34 | |
|---|
| | 35 | float t = (time.tv_sec + time.tv_usec/1000000)/10000*position; |
|---|
| | 36 | |
|---|
| | 37 | unsigned i; |
|---|
| | 38 | for(i = 0; i < pointCount; i++) |
|---|
| | 39 | { |
|---|
| | 40 | float t_p = (i/(float)pointCount)*2*3.14159*5+t; |
|---|
| | 41 | |
|---|
| | 42 | points[i].x = cos(freq_x*t_p)*32767; |
|---|
| | 43 | points[i].y = sin(freq_y*t_p)*32767; |
|---|
| | 44 | |
|---|
| | 45 | points[i].r = 0xFF*i/pointCount; |
|---|
| | 46 | points[i].g = 0xFF*i/pointCount; |
|---|
| | 47 | points[i].b = 0xFF*i/pointCount; |
|---|
| | 48 | |
|---|
| | 49 | points[i].r = 0xFF; |
|---|
| | 50 | points[i].g = 0xFF; |
|---|
| | 51 | points[i].b = 0xFF; |
|---|
| | 52 | } |
|---|
| | 53 | |
|---|
| | 54 | return frame; |
|---|