コード例 #1
0
def parse_line(line, name):
    alpha = convert_hours_to_angle(line[4:14].replace(' ', '0'))
    delta = convert_str_to_angle(line[16:24].replace(' ', '0'))
    if line[15] == '-':
        delta = -delta
    delta = 90 - delta
    color = line[49]
    let = line[103:106]
    m = float(line[41:46].replace(' ', '0'))
    return Star(spherical_to_decart(alpha, delta), color, m, name, GREEK[let])
コード例 #2
0
    def change_direction(self, theta, phi):
        theta = parse.convert_str_to_angle(theta)
        phi = parse.convert_str_to_angle(phi)
        theta = 90 - theta
        p = geometry.spherical_to_decart(phi, theta)

        w = self.top * self.direction

        angle = self.top.in_basis(w, self.top).get_angle_2d(
            self.direction.ort().with_len(1).in_basis(w, self.top))

        self._direction, self._top = p.with_len(1), p.ort().with_len(1)

        self._top = self._top.rotate(angle, self._direction)

        self.direction = self.direction
        self.cache = None
コード例 #3
0
 def test_spherical_to_decart_equathor_simple(self):
     p = geometry.spherical_to_decart(270, 90)
     self.assertAlmostEqual(p.x, 0)
     self.assertAlmostEqual(p.y, -1)
     self.assertAlmostEqual(p.z, 0)
コード例 #4
0
 def test_spherical_to_decart_equathor_other(self):
     p = geometry.spherical_to_decart(90, 90)
     self.assertAlmostEqual(p.x, 0)
     self.assertAlmostEqual(p.y, 1)
     self.assertAlmostEqual(p.z, 0)
コード例 #5
0
 def test_spherical_to_decart_equathor_west(self):
     p = geometry.spherical_to_decart(180, 90)
     self.assertAlmostEqual(p.x, -1)
     self.assertAlmostEqual(p.y, 0)
     self.assertAlmostEqual(p.z, 0)
コード例 #6
0
 def test_spherical_to_decart_south_poles(self):
     p = geometry.spherical_to_decart(0, 180)
     self.assertAlmostEqual(p.x, 0)
     self.assertAlmostEqual(p.y, 0)
     self.assertAlmostEqual(p.z, -1)