|
すみません。修正版です。
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define PIX 64
#define M_PI 3.141592
main(){
int x,y,x1,y1,i,j;
int f[PIX][PIX];/*入力画像*/
int g[PIX][PIX];/*出力画像(極座標)*/
double theta,line;
char koroske[70]; /*ファイルオープン用*/
FILE *fp;
/* ファイルオープン(画像) */
sprintf(koroske,"c:\\koro\\nit1k.dat");
if((fp = fopen (koroske,"rt")) == NULL ){
printf("\n Cannot open file : %s\n",koroske);
exit(1);
}
for( i = 0; i < PIX; i++ ){
for( j = 0; j < PIX; j++ ){
fscanf(fp,"%d",&f[i][j]);
}}
fclose(fp);
/*初期化*/
for( i = 0; i < PIX; i++ ){
for( j = 0; j < PIX; j++ ){
f[i][j] = g[i][j] = 0;
}}
for (theta = 0; theta <= 2 * M_PI; theta += 2 * M_PI / 360) {
x = cos(theta) * (1 + cos(theta));
y = sin(theta) * (1 + cos(theta));
x1 = cos(theta + 2 * M_PI / 360) * (1 + cos(theta + 2 * M_PI));
y1 = sin(theta + 2 * M_PI / 360) * (1 + cos(theta + 2 * M_PI));
line(x + 32, y + 32, x1 + 32, y1 + 32);
}
|