Beispiel #1
0
    def generate(self):
        while True:
            start = uniform(1, 199)

            if not prts_only:
                p = Person(interval=interval)
                p.behaviors = [Seek(), Separation()]
                p.position = vec3(0.0, start)
                platform_position = start * 54 / 199 - 27
                p.destination = vec3(28, 100 + platform_position)
                p.manager = self.rail_station.person_at_platform
                activate(p, p.move(), 0.0)

            p = Person(interval=interval)
            p.behaviors = [Seek(), Separation()]
            p.position = vec3(100.0, start)
            platform_position = start * 8 / 199
            if start < 100:
                p.destination = self.destination1.copy()
                p.manager = self.station1.person_at_station
                p.manager_args = []
            else:
                p.destination = self.destination2.copy()
                p.manager = self.station2.person_at_station
                p.manager_args = []
            activate(p, p.move(), 0.0)

            yield hold, self, 7
Beispiel #2
0
 def person(self, railcar, yy, railcar_waypoints):
     columns = self.columns
     compactness = self.compactness
     for ii in range(0, columns):
         xx = self.rail_x + (ii - (float(columns) - 1.0) / 2.0) * (Person.average_radius * 2.0 * compactness)
         p = Person(interval=interval)
         p.behaviors = [Containment(), Separation(), FollowWaypoints(), InterpenetrationConstraint()]
         p.steering_mind = queue_steering_mind
         p.position = vec3(xx, yy)
         p.waypoints = railcar_waypoints[0:]
         if self.mode == 'straight':
             if p.waypoints[0].y - self.waypoint_high.y > 3:
                 p.waypoints.append(self.waypoint_high)
             if self.waypoint_low.y - p.waypoints[0].y > 3:
                 p.waypoints.append(self.waypoint_low)
         elif self.mode == 'doorway':
             if p.waypoints[0].y > self.platform_center_y:
                 p.waypoints.append(self.waypoint_high)
             if p.waypoints[0].y <= self.platform_center_y:
                 p.waypoints.append(self.waypoint_low)
             p.waypoints.append(vec3(p.waypoints[-1]))
             p.waypoints[-1].x -= 7.0
         elif self.mode == 'stair':
             p.waypoints.append(self.waypoint_low)
             p.waypoints.append(vec3(self.waypoint_low))
             p.waypoints[-1].x -= self.doorway_width * 0.75
             p.waypoints.append(self.waypoint_prt_door)
             p.waypoints.append(vec3(self.waypoint_prt_door))
             p.waypoints[-1].x -= 1.0
         p.manager = self.prt_station.person_at_station
         railcar.departing.append(p)
Beispiel #3
0
    def generate(self):
        """
        creates a Person at the same time and same relative place on each
        of the PRT and LRT lines.
        """
        prt_platform_length = self.p1_y2 - self.p1_y1
        rail_platform_length = self.r_y2 - self.r_y1
        people = 0
        # http://findarticles.com/p/articles/mi_m1215/is_9_204/ai_108788436
        event_max = 5000
        while people < event_max:
            people += 1
            if (people % 100) == 0:
                print "people: ", people

            start = uniform(0, 100)

            if start < 33.33:
                p = Person(interval=interval)
                p.behaviors = [Seek(), Separation()]
                p.manager_args = []
                if start < 16.66:
                    p_start = self.p1_y1 + start * 6 * prt_platform_length / 100
                    p.position = vec3(self.p1_x, p_start)
                    platform_position = (p_start - self.p1_y1) * 0.7
                    p.destination = vec3(28., self.p1_y1 + 4 + platform_position)
                    p.manager = self.prt_station1.person_at_station
                else:
                    p_start = self.p2_y1 + (start - 16.66) * 6 * prt_platform_length / 100
                    p.position = vec3(self.p2_x, p_start)
                    platform_position = (p_start - self.p2_y1) * 0.7
                    p.destination = vec3(28., self.p2_y1 + 4 + platform_position)
                    p.manager = self.prt_station2.person_at_station
                activate(p, p.move(), 0.0)

            p = Person(interval=interval)
            p.behaviors = [Seek(), Separation()]
            p.position = vec3(self.r_x, self.r_y1 + 12 + start * 0.6 * rail_platform_length / 100)
            platform_position = start * (self.r_y2 - self.r_y1) / 100
            p.destination = vec3(78., self.r_y1 + platform_position)
            p.manager = self.rail_station.person_at_platform
            p.manager_args = []
            activate(p, p.move(), 0.0)

            yield hold, self, 0.25

        yield passivate, self
Beispiel #4
0
    def generate(self):
        while True:
            start = uniform(5, 40)

            p = Person(interval=interval)
            p.behaviors = [Seek(), Separation()]
            p.position = vec3(100.0, start)
            platform_position = start * 8 / 199
            p.destination = self.destination1.copy()
            p.manager = self.station1.person_at_station
            p.manager_args = []
            activate(p, p.move(), 0.0)

            yield hold, self, 3.5