質問編集履歴
1
分かり易いよう修正した。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
OpenGLで太陽系の惑星軌道を描くプログラムを作成中です。
|
|
2
|
-
太陽
|
|
2
|
+
太陽を中心に公転する2つの惑星を描くことができました。
|
|
3
|
-
|
|
3
|
+
惑星はそれぞれ公転周期が異なるものですが、
|
|
4
|
-
この
|
|
4
|
+
これらの2つの惑星の公転の速度を変えるにはどうすればよいのでしょうか?
|
|
5
5
|
|
|
6
6
|
```
|
|
7
7
|
/* p4-MovingPlanet.c
|
|
@@ -30,11 +30,13 @@
|
|
|
30
30
|
glTranslated(3.0, 0.0, 0.0);
|
|
31
31
|
glRotated((double)day, 0.0, 1.0, 0.0);
|
|
32
32
|
glutSolidSphere(0.2, 10, 8); // planet
|
|
33
|
-
glTranslated(1.0, 0.0, 0.0);
|
|
34
|
-
glRotated((double)day, 0.0, 0.1, 0.0);
|
|
35
|
-
glutSolidSphere(0.2, 10, 8); // planet2
|
|
36
|
-
|
|
37
33
|
glPopMatrix();
|
|
34
|
+
glPushMatrix();
|
|
35
|
+
glRotated((double)year, 0.0, 1.0, 0.0);
|
|
36
|
+
glTranslated(2.0, 0.0, 0.0);
|
|
37
|
+
glRotated((double)day, 0.0, 1.0, 0.0);
|
|
38
|
+
glutSolidSphere(0.1, 10, 8);
|
|
39
|
+
glPopMatrix();
|
|
38
40
|
glutSwapBuffers();
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -76,4 +78,5 @@
|
|
|
76
78
|
glutMainLoop();
|
|
77
79
|
return 0;
|
|
78
80
|
}
|
|
81
|
+
|
|
79
82
|
```
|