質問編集履歴

3

2018/05/16 21:46

投稿

tomato1027
tomato1027

スコア32

test CHANGED
File without changes
test CHANGED
@@ -3,8 +3,6 @@
3
3
 
4
4
 
5
5
  C言語でN*Nの画像を回転させるプログラムを書いています。
6
-
7
- 関数内で1次元配列を用いて行っています。
8
6
 
9
7
 
10
8
 
@@ -32,31 +30,19 @@
32
30
 
33
31
  ```ここに言語名を入力
34
32
 
35
- void rotate(* f, * g, theta){ //*入力画像f,出力画像g,回転角theta*//
36
-
37
-
38
-
39
- double dsin = sin(theta);
40
-
41
- double dcos = cos(theta);
42
-
43
33
  for(int i = 0 ; i < N ; i++){
44
34
 
45
35
  for(int j = 0 ; j < N ; j++){
46
36
 
47
- int srcX = (int)((i - N/2) * dcos - (j - N/2) * dsin -0.5)+N/2;
37
+ int srcX = ((i - N/2) * dcos - (j - N/2) * dsin -0.5)+N/2;
48
38
 
49
- int srcY = (int)((i - N/2) * dsin + (j - N/2) * dcos -0.5)+N/2;
39
+ int srcY = ((i - N/2) * dsin + (j - N/2) * dcos -0.5)+N/2;
50
40
 
51
41
 
52
42
 
53
- if(srcX<0||srcX>N-1||srcY<0||srcY>N-1){ //*回転後の座標が範囲外となったときの処理*//
43
+
54
44
 
55
- }
56
-
57
- else
58
-
59
- g[srcX*N+srcY]=f[i*N+j]; //*回転後の座標に回転前の座標の要素を代入*//
45
+ g[srcX*N+srcY]=f[i*N+j];
60
46
 
61
47
  }
62
48
 

2

2018/05/16 21:46

投稿

tomato1027
tomato1027

スコア32

test CHANGED
@@ -1 +1 @@
1
- C言語 画像の回転における穴を無くしたい
1
+ 画像の穴を無くしたい
test CHANGED
File without changes

1

タイトルの編集

2018/05/16 11:27

投稿

tomato1027
tomato1027

スコア32

test CHANGED
@@ -1 +1 @@
1
- 画像の回転における穴を無くしたい
1
+ C言語 画像の回転における穴を無くしたい
test CHANGED
File without changes