コード例 #1
0
ファイル: orbits.py プロジェクト: kellpossible/KivyOrbiter
    def fromOrbitalElements(a, b, e, i, long_asc, arg_per, M, true_lon,
                            arg_lat, lon_per, p, mu):
        """
        a:         semi major axis (km)
        b:         semi minor axis (km)
        e:     eccentricity (unitless)
        i:         inclination (radians)
        long_asc: Right ascention of the ascending node (radians)
        arg_per:   argument of perigee (radians)
        M:         mean anomaly (radians)
        true_lon:  True Longtitude (radians)
        arg_lat:   argument of latitude (radians)
        long_per:  Longtitude of periapse (radians)
        p: semilatus rectum (km)
        mu:  gravitational constant
        """

        hval = b * sqrt(mu / a)
        h_vec1 = Vector3.Z().rotate(Rotation.aroundY(i))
        h_vec = h_vec1.rotate(Rotation.aroundZ(long_asc - pi / 2.0))
        x = Vector3.X()
        rot_long_asc = Rotation.aroundZ(long_asc)
        n_dir = x.rotate(rot_long_asc).norm()
        n_vec = Vector3.Z().cross(h_vec)

        KeplerOrbit2(a, b, e, i, long_asc, arg_per, M, true_lon, arg_lat,
                     lon_per, p, mu, n_vec, h_vec)
コード例 #2
0
    def calc_pos_from_E(self, E):
        #todo: can optimise this a lot
        r = self.calc_r_from_E(E)
        v = self.calc_true_anomaly(E)
        angle_sum = self.arg_per + v

        x = Vector3.X()
        n_dir = x.rotate(Rotation.aroundZ(self.long_asc))
        h_dir = self.h_vec.norm()
        r_dir = n_dir.rotate(Rotation.aroundVector(h_dir, v))
        r_vec = r_dir.fmul(self.calc_r_from_E(E))
        r_vec = r_vec.rotate(Rotation.aroundVector(h_dir, self.arg_per))
        return r_vec
コード例 #3
0
ファイル: orbits.py プロジェクト: kellpossible/KivyOrbiter
    def calc_pos_from_E(self, E):
        #todo: can optimise this a lot
        r = self.calc_r_from_E(E)
        v = self.calc_true_anomaly(E)
        angle_sum = self.arg_per + v

        x = Vector3.X()
        n_dir = x.rotate(Rotation.aroundZ(self.long_asc))
        h_dir = self.h_vec.norm()
        r_dir = n_dir.rotate(Rotation.aroundVector(h_dir, v))
        r_vec = r_dir.fmul(self.calc_r_from_E(E))
        r_vec = r_vec.rotate(Rotation.aroundVector(h_dir, self.arg_per))
        return r_vec
コード例 #4
0
    def fromOrbitalElements(a, b, e, i, long_asc, arg_per, M, true_lon, arg_lat, lon_per, p, mu):
        """
        a:         semi major axis (km)
        b:         semi minor axis (km)
        e:     eccentricity (unitless)
        i:         inclination (radians)
        long_asc: Right ascention of the ascending node (radians)
        arg_per:   argument of perigee (radians)
        M:         mean anomaly (radians)
        true_lon:  True Longtitude (radians)
        arg_lat:   argument of latitude (radians)
        long_per:  Longtitude of periapse (radians)
        p: semilatus rectum (km)
        mu:  gravitational constant
        """

        hval = b*sqrt(mu/a)
        h_vec1 = Vector3.Z().rotate(Rotation.aroundY(i))
        h_vec = h_vec1.rotate(Rotation.aroundZ(long_asc - pi/2.0))
        x = Vector3.X()
        rot_long_asc = Rotation.aroundZ(long_asc)
        n_dir = x.rotate(rot_long_asc).norm()
        n_vec = Vector3.Z().cross(h_vec)

        KeplerOrbit2(
                a,
                b,
                e,
                i,
                long_asc,
                arg_per,
                M,
                true_lon,
                arg_lat,
                lon_per,
                p,
                mu,
                n_vec,
                h_vec)
コード例 #5
0
 def set_acw_angle(self, acw_angle):
     acw_rot = Rotation.aroundZ(acw_angle)
     self.acw_vec = Vector3.Y().rotate(acw_rot)
     self.acw_angle = acw_angle
コード例 #6
0
 def set_cw_angle(self, cw_angle):
     cw_rot = Rotation.aroundZ(cw_angle)
     self.cw_vec = Vector3.Y().rotate(cw_rot)
     self.cw_angle = cw_angle
コード例 #7
0
 def getDirectionVec(self):
     rot = Rotation.aroundZ(self.angle)
     return Vector3.Y().rotate(rot)
コード例 #8
0
 def fromAngle(start_point, angle, length, color=sf.Color.WHITE):
     start_point_vec = Vector3(start_point.x, start_point.y, 0)
     rot = Rotation.aroundZ(angle)
     line_vec = Vector3.Y().rotate(rot).fmul(length)
     end_point_vec = start_point_vec.add(line_vec)
     return Line(start_point_vec, end_point_vec, color)
コード例 #9
0
 def set_acw_angle(self, acw_angle):
     acw_rot = Rotation.aroundZ(acw_angle)
     self.acw_vec = Vector3.Y().rotate(acw_rot)
     self.acw_angle = acw_angle
コード例 #10
0
 def set_cw_angle(self, cw_angle):
     cw_rot = Rotation.aroundZ(cw_angle)
     self.cw_vec = Vector3.Y().rotate(cw_rot)
     self.cw_angle = cw_angle
コード例 #11
0
 def getDirectionVec(self):
     rot = Rotation.aroundZ(self.angle)
     return Vector3.Y().rotate(rot)
コード例 #12
0
 def fromAngle(start_point, angle, length, color=sf.Color.WHITE):
     start_point_vec = Vector3(start_point.x, start_point.y, 0)
     rot = Rotation.aroundZ(angle)
     line_vec = Vector3.Y().rotate(rot).fmul(length)
     end_point_vec = start_point_vec.add(line_vec)
     return Line(start_point_vec, end_point_vec, color)