Exemplo n.º 1
0
    def generate(self, config):
        C = config

        if C.length < 1 or C.width < 1:
            print 'returning empty layout'
            return

        roads, junctions, spaces = make_roads(C.length, C.width,
                                            C.road_width, self.picker.pick((3,5)),
                                            20, self.picker)

        if not spaces:
            print 'no spaces'
            return
        for origin, (slength, swidth), rotation in spaces:
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))
            
            self.subgen('rural_plot', origin, slength,swidth,
                        [C.height_range])

        for road in roads:
            origin, (road_length, road_width), rotation = road
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))
            self.subgen('road', origin,
                    road_length, road_width)
Exemplo n.º 2
0
    def generate(self, config):
        C = config

        roads, junctions, spaces = make_roads(C.length, C.width,
                                        C.road_width, C.num_roads,
                                        C.min_gap_btw_roads, self.picker)

        road_width = C.road_width * 0.8 if C.road_width > 2 else C.road_width
        
        for origin, (slength, swidth), rotation in spaces:
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))

            self.subgen('sector', origin, slength, swidth, C.num_roads,
                        road_width, C.min_gap_btw_roads, [C.height_range])


        for road in roads:
            origin, (road_length, road_width), rotation = road
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))

            self.subgen('road', origin, road_length, road_width)

        for jn in junctions:
            origin, (jn_length, jn_width), rotation = jn
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))

            self.subgen('junction', origin, jn_length, jn_width)

        if not spaces:
            self.subgen('rural_plot', (0, 0, 0), C.length, C.width,
                        [C.height_range])
Exemplo n.º 3
0
    def generate(self, config):
        C = config
        if C.level == 7:
            road_width = 6
            sky_origin, layouts = self.skyapt_plan(C.length, C.width,
                                                   road_width, 'sky')
            
        elif C.level == 7:
            road_width = 8          
            apt, layouts = self.skyapt_plan(C.length, C.width,
                                            road_width, 'apt')
                
        else:
            road_width = 10
            

            if C.level == 1:
                plot_gap = 4
                height_width_ratio = 8.
                road_width = 5
                build_height = self.picker.pick((100,300))
                plot_width = build_height/height_width_ratio
                if plot_width < 10:
                    plot_width = 10
                plot_length = (plot_width,plot_width*3)
                height_range = (100,300)

            elif C.level == 2:
                plot_gap = 10
                height_width_ratio = 8.
                road_width = 8
                build_height = self.picker.pick((50,70))
                plot_width = build_height/height_width_ratio
                if plot_width < 10:
                    plot_width = 10
                plot_length = (plot_width,plot_width*3)
                height_range = (40, 100)

            elif C.level == 3:
                plot_gap = 10
                height_width_ratio = 4.
                road_width = 8
                build_height = self.picker.pick((3,15))
                plot_width = build_height/height_width_ratio
                if plot_width < 10:
                    plot_width = 10
                plot_length = (plot_width,plot_width*3)
                height_range = (3,15)

            else:
                plot_gap = 12
                height_width_ratio = 2.
                road_width = 8
                build_height = self.picker.pick((3,15))
                plot_width = build_height/height_width_ratio
                if plot_width < 15:
                    plot_width = 15
                plot_length = (plot_width,plot_width*4)
                height_range = (3,15)

            roads, junctions, spaces = make_roads(C.length, C.width,
                                            road_width, self.picker.pick((3,5)),
                                            C.min_gap_btw_roads, self.picker)

            for origin, (slength, swidth), rotation in spaces:
                x,y = origin
                origin = ((x, y, 0), (rotation, (0, 0, 1)))

                self.subgen('cellayout', origin, C.level, slength,
                            swidth, [plot_length], plot_width, road_width,
                            [height_range], plot_gap)

            for road in roads:
                origin, (road_length, road_width), rotation = road
                x,y = origin
                origin = ((x, y, 0), (rotation, (0, 0, 1)))

                self.subgen('road', origin,
                        road_length, road_width)
Exemplo n.º 4
0
    def generate(self, config):
        C = config

        levels = [1, 2, 3, 4]
        
        level = self.picker.pick(levels)

        if level == 1:
            plot_gap = 4
            height_width_ratio = 8.
            road_width = 5
            min_gap_btw_roads = 8
            build_height = self.picker.pick((100,300))
            plot_width = build_height/height_width_ratio
            if plot_width < 10:
                plot_width = 10
            plot_length = (plot_width,plot_width*3)
            height_range = [(.1, 0), (.3, (3,15)), (.2, (15, 50)),
                            (.2, (50, 100)), (.2, (100,200))]

        elif level == 2:
            plot_gap = 10
            height_width_ratio = 8.
            road_width = 8
            min_gap_btw_roads = 10
            build_height = self.picker.pick((50,70))
            plot_width = build_height/height_width_ratio
            if plot_width < 10:
                plot_width = 10
            plot_length = (plot_width,plot_width*3)
            height_range = [(.1, 0), (.3, (3,15)), (.4, (15, 50)),
                            (.2, (50, 100)), (0.0, (100,200))]

        elif level == 3:
            plot_gap = 10
            height_width_ratio = 4.
            road_width = 8
            min_gap_btw_roads = 10
            build_height = self.picker.pick((3,15))
            plot_width = build_height/height_width_ratio
            if plot_width < 10:
                plot_width = 10
            plot_length = (plot_width,plot_width*3)
            height_range = [(.1, 0), (.3, (3,15)), (.5, (15, 50)),
                            (.1, (50, 100)), (0.0, (100,200))]

        else:
            plot_gap = 12
            height_width_ratio = 2.
            road_width = 8
            min_gap_btw_roads = 20
            build_height = self.picker.pick((3,15))
            plot_width = build_height/height_width_ratio
            if plot_width < 15:
                plot_width = 15
            plot_length = (plot_width,plot_width*4)
            height_range = [(.1, 0), (.6, (3,15)), (.25, (15, 50)),
                            (.05, (50, 100)), (.0, (100,200))]

        roads, junctions, spaces = make_roads(C.length, C.width,
                                        road_width, 2,
                                        min_gap_btw_roads, self.picker)

        for origin, (slength, swidth), rotation in spaces:
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))
            
            self.subgen('sector', origin,
                        slength, swidth, 2, road_width, min_gap_btw_roads,
                        [height_range])

        for road in roads:
            origin, (road_length, road_width), rotation = road
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))

            self.subgen('road', origin, road_length, road_width)

        for jn in junctions:
            origin, (jn_length, jn_width), rotation = jn
            x,y = origin
            origin = ((x, y, 0), (rotation, (0, 0, 1)))

            self.subgen('junction', origin, jn_length, jn_width)