Esempio n. 1
0
    def __init__(self):
        sp.Scene.__init__(self)

        self.frame = sp.Beam(size=(2, 2, 0.05),
                             pivot=(0, 1, 0),
                             color=(0.1, 0.1, 0.1))
        self.plate = sp.Cylinder(size=(0.6, 0.6, 0.1), center=(0, 0, 0.05))
        self.buzzer = sp.Cylinder(size=(0.2, 0.2, 0.2), center=(0, 0, 0.05))

        self.aDisplay = sp.Beam(size=(1, 2.2, 0.05),
                                center=(-2, 0, 2),
                                pivot=(0, 1, 0),
                                color=(0, 0.03, 0))
        self.digit = sp.Beam(size=(0.9, 0.45, 0.05),
                             center=(0, 0, 0.05),
                             color=(0, 0.05, 0))
        self.segment = sp.Beam(size=(0.30, 0.07, 0.05),
                               center=(0, 0, 0.05),
                               color=(0, 1, 0))
        self.dot = sp.Beam(size=(0.07, 0.07, 0.05),
                           center=(0, 0, 0.1),
                           color=(0, 1, 0))

        self.segments = ((0, 2, 3, 4, 5, 6), (5, 6), (0, 1, 2, 4, 5), (0, 1, 2,
                                                                       5, 6),
                         (1, 3, 5, 6), (0, 1, 2, 3, 6), (0, 1, 2, 3, 4, 6),
                         (0, 5, 6), (0, 1, 2, 3, 4, 5, 6), (0, 1, 2, 3, 5, 6))
Esempio n. 2
0
 def __init__(self, **arguments):
     self.suspension = sp.Cylinder(size=(0.01, 0.01, 0.001),
                                   axis=(1, 0, 0),
                                   angle=90,
                                   pivot=(0, 0, 1),
                                   **arguments)
     self.rim = sp.Beam(size=(0.08, 0.06, 0.02),
                        pivot=(0, 1, 0),
                        color=(0, 0, 0))
     self.tire = sp.Cylinder(size=(pm.wheelDiameter, pm.wheelDiameter,
                                   0.04),
                             axis=(1, 0, 0),
                             angle=90,
                             color=(1, 1, 0))
     self.line = Line()
Esempio n. 3
0
    def __init__ (self):
        sp.Scene.__init__ (self)
        
        self.camera = sp.Camera ()
        
        self.earth = sp.Ellipsoid (size = 3 * (cm.earthDiam,), center = (0, 0, 0), color = (0, 0, 0.9))
        self.moon = sp.Ellipsoid (size = 3 * (cm.moonDiam,), center = (0, 0, cm.earthMoonDist), color = (0.6, 0.6, 0.6))

        self.body = sp.Cylinder (size = (0.3, 0.3, 1), center = (0, 0, 0.85 + 0.4), pivot = (0, 0, 1), color = (1, 1, 0.2))
        self.nose = sp.Cone (size = (0.3, 0.3, 0.5), center = (0, 0, 0.75), color = (1, 1, 0.2))
        self.bracket = sp.Cylinder (size = (0.1, 0.1, 0.1), center = (0, 0, -0.55), color = (1, 1, 0.2))
        self.gimbal = sp.Ellipsoid (size = 3 * (0.12,), center = (0, 0, -0.05), pivot = (1, 0, 0), color = (1, 1, 0.2))
        self.thruster = sp.Cone (size = (0.2, 0.2, 0.3), pivot = (0, -1, 0), center = (0, 0, -0.09), joint = (0, 0, 0.09), color = (1, 1, 0.2))   # See thruster_rotation.jpg for pivot
                                                                                                                                               # Center at -(0.3/2 - 0.12/2)
        self.flame = sp.Cone (size = (0.1, 0.1, 1), center = (0, 0, -0.65), joint = (0, 0, 0.5), axis = (0, 1, 0), angle = 180, color = (1, 0.7, 0))
        self.tankRed = sp.Ellipsoid (size = 3 * (0.1,), center = (0.16, 0, 0), color = (1, 0, 0))
        self.tankGreen = sp.Ellipsoid (size = 3 * (0.1,), center = (-0.16, 0, 0), color = (0, 1, 0))
        self.tankYellow = sp.Ellipsoid (size = 3 * (0.1,), center = (0, 0.16, 0), color = (1, 1, 0))
        self.tankBlue = sp.Ellipsoid (size = 3 * (0.1,), center = (0, -0.16, 0), color = (0, 0, 1))
Esempio n. 4
0
 def __init__ (self):
     sp.Scene.__init__ (self)
     
     self.crossing = sp.Beam (size = (3, 3, 0.1), pivot = (0, 1, 0), color = (0.1, 0.1, 0.1))
     self.sidewalk = sp.Beam (size = (1, 1, 0.1), center = (-1, -1, 0.1), joint = (1, 1, 0), color = (0, 0.3, 0)) 
     self.pole = sp.Cylinder (size = (0.05, 0.05, 1), center = (0, 0.45, 0.45), color = (1, 1, 1))
     
     self.redLamp = TrafficLamp (red)
     self.yellowLamp = TrafficLamp (yellow)
     self.greenLamp = TrafficLamp (green)
     self.streetLamp = StreetLamp ()     
Esempio n. 5
0
    def __init__(self):
        sp.Scene.__init__(self)
        self.base = sp.Cylinder(size=(0.3, 0.3, 0.4),
                                center=(0, 0, 0.2),
                                pivot=(0, 0, 1),
                                color=(1, 1, 0.2))
        self.torso = sp.Beam(size=(0.4, 0.4, 0.6),
                             center=(0, 0, 0.5),
                             pivot=(0, 0, 1),
                             color=(0.5, 0.5, 0.5))

        armColor = (0.7, 0.7, 0.7)
        self.upperArm = sp.Beam(size=(1, 0.2, 0.2),
                                center=(0.4, -0.3, 0.1),
                                joint=(-0.4, 0, 0),
                                pivot=(0, 1, 0),
                                color=armColor)
        self.foreArm = sp.Beam(size=(0.7, 0.15, 0.15),
                               center=(0.65, 0.175, 0),
                               joint=(-0.25, 0, 0),
                               pivot=(0, 1, 0),
                               color=armColor)
        self.wrist = sp.Beam(size=(0.3, 0.1, 0.1),
                             center=(0.40, -0.125, 0),
                             joint=(-0.05, 0, 0),
                             pivot=(0, 1, 0),
                             color=armColor)

        handColor = (1, 0.01, 0.01)
        handSideSize = (0.1, 0.1, 0.1)
        self.handCenter = sp.Beam(size=(0.1, 0.09, 0.09),
                                  center=(0.15, 0, 0),
                                  pivot=(1, 0, 0),
                                  color=handColor)
        self.handSide0 = sp.Beam(size=handSideSize,
                                 center=(0, -0.075, -0.075),
                                 color=handColor)
        self.handSide1 = sp.Beam(size=handSideSize,
                                 center=(0, 0.075, -0.075),
                                 color=handColor)
        self.handSide2 = sp.Beam(size=handSideSize,
                                 center=(0, 0.075, 0.075),
                                 color=handColor)
        self.handSide3 = sp.Beam(size=handSideSize,
                                 center=(0, -0.075, 0.075),
                                 color=handColor)

        fingerColor = (0.01, 1, 0.01)
        fingerSize = (0.3, 0.05, 0.05)
        fingerJoint = (-0.125, 0, 0)
        self.finger0 = sp.Beam(size=fingerSize,
                               center=(0.15, 0, -0.1),
                               joint=fingerJoint,
                               pivot=(0, -1, 0),
                               color=fingerColor)
        self.finger1 = sp.Beam(size=fingerSize,
                               center=(0.15, 0, 0.1),
                               joint=fingerJoint,
                               pivot=(0, 1, 0),
                               color=fingerColor)
        self.finger2 = sp.Beam(size=fingerSize,
                               center=(0.15, -0.1, 0),
                               joint=fingerJoint,
                               pivot=(0, 0, 1),
                               color=fingerColor)
        self.finger3 = sp.Beam(size=fingerSize,
                               center=(0.15, 0.1, 0),
                               joint=fingerJoint,
                               pivot=(0, 0, -1),
                               color=fingerColor)