# Path: spyce/vector.py
# class Vec3(list):
#     def norm(u):
#         return math.sqrt(u.dot(u))
# 
#     def dot(u, v):
#         """Dot product"""
#         u1, u2, u3 = u
#         v1, v2, v3 = v
#         return math.fsum([u1*v1, u2*v2, u3*v3])
# 
#     def cross(u, v):
#         """Cross product"""
#         u1, u2, u3 = u
#         v1, v2, v3 = v
#         return Vec3([
#             u2*v3 - u3*v2,
#             u3*v1 - u1*v3,
#             u1*v2 - u2*v1,
#         ])
# 
#     def angle(u, v):
#         """Angle formed by two vectors"""
#         r = u.dot(v)/u.norm()/v.norm()
#         r = max(-1, min(1, r))
#         return math.acos(r)
# 
#     def oriented_angle(u, v, normal=None):
#         """Angle formed by two vectors"""
#         if normal is None:
#             normal = Vec3([0, 0, 1])
#         geometric_angle = u.angle(v)
#         if normal.dot(u.cross(v)) < 0:
#             return -geometric_angle
#         else:
#             return geometric_angle
# 
#     def __mul__(u, s):
#         x, y, z = u
#         return Vec3([x*s, y*s, z*s])
# 
#     def __div__(u, s):
#         x, y, z = u
#         return Vec3([x/s, y/s, z/s])
# 
#     def __add__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x+a, y+b, z+c])
# 
#     def __iadd__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x+a, y+b, z+c])
# 
#     def __sub__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x-a, y-b, z-c])
# 
#     def __isub__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x-a, y-b, z-c])
# 
#     def __neg__(u):
#         x, y, z = u
#         return Vec3([-x, -y, -z])
# 
#     def __abs__(u):
#         """Maximum metric (see Chebyshev distance)"""
#         return max(abs(x) for x in u)


import re
import math
import spyce.physics
from spyce.vector import Vec3
        # solar day
        if self.orbit is not None:
            sidereal_day = self.rotational_period
            sidereal_year = self.orbit.period
            solar_year = sidereal_year - sidereal_day
            if solar_year == 0:
                self.solar_day = math.inf
            else:
                self.solar_day = sidereal_day * sidereal_year/solar_year
        else:
            self.solar_day = 0

        # surface velocity
        if self.rotational_period == 0:
            self.surface_velocity = math.inf
        else:
            R = self.radius
            self.surface_velocity = 2*math.pi * R / self.rotational_period

    def __repr__(self):
        """Appear as <Name> in a Python interpreter"""
        return "<%s>" % (self.name)

    def __str__(self):
        """Cast to string using the name"""
        return self.name

    def global_position_at_time(self, time):
        """Global position of the celestial body within the stellar system"""
        if self.orbit is None:

# Path: spyce/vector.py
# class Vec3(list):
#     def norm(u):
#         return math.sqrt(u.dot(u))
# 
#     def dot(u, v):
#         """Dot product"""
#         u1, u2, u3 = u
#         v1, v2, v3 = v
#         return math.fsum([u1*v1, u2*v2, u3*v3])
# 
#     def cross(u, v):
#         """Cross product"""
#         u1, u2, u3 = u
#         v1, v2, v3 = v
#         return Vec3([
#             u2*v3 - u3*v2,
#             u3*v1 - u1*v3,
#             u1*v2 - u2*v1,
#         ])
# 
#     def angle(u, v):
#         """Angle formed by two vectors"""
#         r = u.dot(v)/u.norm()/v.norm()
#         r = max(-1, min(1, r))
#         return math.acos(r)
# 
#     def oriented_angle(u, v, normal=None):
#         """Angle formed by two vectors"""
#         if normal is None:
#             normal = Vec3([0, 0, 1])
#         geometric_angle = u.angle(v)
#         if normal.dot(u.cross(v)) < 0:
#             return -geometric_angle
#         else:
#             return geometric_angle
# 
#     def __mul__(u, s):
#         x, y, z = u
#         return Vec3([x*s, y*s, z*s])
# 
#     def __div__(u, s):
#         x, y, z = u
#         return Vec3([x/s, y/s, z/s])
# 
#     def __add__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x+a, y+b, z+c])
# 
#     def __iadd__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x+a, y+b, z+c])
# 
#     def __sub__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x-a, y-b, z-c])
# 
#     def __isub__(u, v):
#         x, y, z = u
#         a, b, c = v
#         return Vec3([x-a, y-b, z-c])
# 
#     def __neg__(u):
#         x, y, z = u
#         return Vec3([-x, -y, -z])
# 
#     def __abs__(u):
#         """Maximum metric (see Chebyshev distance)"""
#         return max(abs(x) for x in u)


# Path: spyce/body.py
import re
import math
import spyce.physics
from spyce.vector import Vec3

        # solar day
        if self.orbit is not None:
            sidereal_day = self.rotational_period
            sidereal_year = self.orbit.period
            solar_year = sidereal_year - sidereal_day
            if solar_year == 0:
                self.solar_day = math.inf
            else:
                self.solar_day = sidereal_day * sidereal_year/solar_year
        else:
            self.solar_day = 0

        # surface velocity
        if self.rotational_period == 0:
            self.surface_velocity = math.inf
        else:
            R = self.radius
            self.surface_velocity = 2*math.pi * R / self.rotational_period

    def __repr__(self):
        """Appear as <Name> in a Python interpreter"""
        return "<%s>" % (self.name)

    def __str__(self):
        """Cast to string using the name"""
        return self.name

    def global_position_at_time(self, time):
        """Global position of the celestial body within the stellar system"""
        if self.orbit is None:

            return Vec3([0, 0, 0])