라디안을 디그리로 바꾸어서 계산.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<windows.h>
#include<math.h>
#define 읽기 "C:\\first_mfc.txt"
#define RTD 57.29577951f
//#define DTR 1.017453293f
void main(void){
FILE *rp = fopen(읽기, "rt");
int data; // Radius
double x, y, theta = 0;
while(1){
fscanf(rp, "%d", &data);
x = data * cos( theta / RTD );
y = data * sin( theta / RTD );
printf("%lf\n", x);
printf("%lf\n\n", y);
if( theta * 2 >= 360) theta = 0;
theta += 0.5;
if(feof(rp)) break;
}
fclose(rp);
}
'OpenSTUDY > AVC' 카테고리의 다른 글
2D Laser Scanner (0) | 2011.11.05 |
---|---|
Laser Scanner test 5 (0) | 2011.10.30 |
Laser Scanner test 3 (0) | 2011.10.30 |
Laser Scanner test 2 (0) | 2011.10.30 |
Laser Scanner test 1 (0) | 2011.10.30 |