コード例 #1
0
 def test_scale(self):
     sky = stars.StarrySky(Point(1, 0, 0), Point(0, 1, 0), [])
     sky.resize(Point(100, 100))
     s0 = stars.Star(Point(0, 0, 0), 'A', 1, 'and', None)
     sky.scale(s0)
     self.assertAlmostEqual(s0.x, 50)
     self.assertAlmostEqual(s0.y, 50)
コード例 #2
0
 def test_brightness_radius(self):
     s0 = stars.Star(Point(1, 0, 0), 'A', 1, 'and', None)
     s1 = stars.Star(Point(1, 0, 0), 'A', 3, 'and', None)
     s2 = stars.Star(Point(1, 0, 0), 'A', 3, 'and', None)
     sky = stars.StarrySky(Point(1, 0, 0), Point(0, 1, 0), [s0, s1, s2])
     st = sky.get_stars()
     self.assertFalse(st[0].r == st[1].r)
コード例 #3
0
 def test_brightness(self):
     s0 = stars.Star(Point(1, 0, 0), 'A', 1, 'and', None)
     s1 = stars.Star(Point(1, 0, 0), 'A', 3, 'and', None)
     s2 = stars.Star(Point(1, 0, 0), 'A', 3, 'and', None)
     sky = stars.StarrySky(Point(1, 0, 0), Point(0, 1, 0), [s0, s1, s2])
     st = sky.get_stars()
     self.assertTrue(st[0].m == 1)
コード例 #4
0
 def test_rotate_camera(self):
     sky = stars.StarrySky(Point(1, 0, 0), Point(0, 1, 0), [])
     sky.rotate_camera(0.1, 0.1)
     self.assertAlmostEqual(sky.top % sky.direction, 0)
     self.assertAlmostEqual(sky.top.length(), 1)
     self.assertAlmostEqual(sky.direction.length(), 1)
コード例 #5
0
 def test_zoom(self):
     sky = stars.StarrySky(Point(1, 0, 0), Point(0, 1, 0), [])
     sky.zoom(6000)
     self.assertAlmostEqual(sky.r, 0.992867539)
コード例 #6
0
 def test_is_not_bright(self):
     sky = stars.StarrySky(Point(1, 0, 0), Point(0, 1, 0), [])
     s = stars.Star(Point(0, 0), 'A', 5, 'and', None)
     self.assertFalse(sky.is_bright(s))
コード例 #7
0
 def test_inint_sky(self):
     sky = stars.StarrySky(Point(1, 0, 0), Point(0, 1, 0), [])
     self.assertAlmostEqual(sky.top % sky.direction, 0)