Пример #1
0
    def init_regions(self):
        self.connections = [DPoint(0, 0), DPoint(self.dr.abs(), 0)]
        self.angle_connections = [0, 0]
        alpha = atan2(self.dr.y, self.dr.x)
        self.angle_connections = [alpha, alpha]
        alpha_trans = DCplxTrans(1, alpha * 180 / pi, False, 0, 0)

        m_poly = DSimplePolygon([
            DPoint(0, -self.Z0.width / 2),
            DPoint(self.dr.abs(), -self.Z1.width / 2),
            DPoint(self.dr.abs(), self.Z1.width / 2),
            DPoint(0, self.Z0.width / 2)
        ])
        e_poly1 = DSimplePolygon([
            DPoint(0, -self.Z0.b / 2),
            DPoint(self.dr.abs(), -self.Z1.b / 2),
            DPoint(self.dr.abs(), -self.Z1.width / 2),
            DPoint(0, -self.Z0.width / 2)
        ])
        e_poly2 = DSimplePolygon([
            DPoint(0, self.Z0.b / 2),
            DPoint(self.dr.abs(), self.Z1.b / 2),
            DPoint(self.dr.abs(), self.Z1.width / 2),
            DPoint(0, self.Z0.width / 2)
        ])

        m_poly.transform(alpha_trans)
        e_poly1.transform(alpha_trans)
        e_poly2.transform(alpha_trans)

        self.metal_region.insert(SimplePolygon.from_dpoly(m_poly))
        self.empty_region.insert(SimplePolygon.from_dpoly(e_poly1))
        self.empty_region.insert(SimplePolygon.from_dpoly(e_poly2))
Пример #2
0
    def init_regions(self):
        self.metal_regions["bridges_1"] = Region(
        )  # region with ground contacts
        self.empty_regions["bridges_1"] = Region()  # remains empty

        self.metal_regions["bridges_2"] = Region()  # remains empty
        self.empty_regions["bridges_2"] = Region(
        )  # region with erased bridge area

        center = DPoint(0, 0)
        self.connections = [center]
        self.angle_connections = [0]

        # init metal region of ground touching layer
        top_gnd_center = center + DPoint(
            0, self.gnd2gnd_dy / 2 + self.gnd_touch_dy / 2)
        p1 = top_gnd_center + DPoint(-self.gnd_touch_dx / 2,
                                     -self.gnd_touch_dy / 2)
        p2 = p1 + DVector(self.gnd_touch_dx, self.gnd_touch_dy)
        top_gnd_touch_box = pya.DBox(p1, p2)
        self.metal_regions["bridges_1"].insert(
            pya.Box().from_dbox(top_gnd_touch_box))

        bot_gnd_center = center + DPoint(
            0, -(self.gnd2gnd_dy / 2 + self.gnd_touch_dy / 2))
        p1 = bot_gnd_center + DPoint(-self.gnd_touch_dx / 2,
                                     -self.gnd_touch_dy / 2)
        p2 = p1 + DVector(self.gnd_touch_dx, self.gnd_touch_dy)
        bot_gnd_touch_box = pya.DBox(p1, p2)
        self.metal_regions["bridges_1"].insert(
            pya.Box().from_dbox(bot_gnd_touch_box))

        # init empty region for second layout layer
        # points start from left-bottom corner and goes in clockwise direction
        p1 = bot_gnd_touch_box.p1 + DPoint(-self.surround_gap,
                                           -self.surround_gap)
        p2 = p1 + DPoint(
            0, self.surround_gap + self.gnd_touch_dy + self.transition_len -
            self.surround_gap)
        # top left corner + `surrounding_gap` + `transition_length`
        p3 = bot_gnd_touch_box.p1 + DPoint(0, bot_gnd_touch_box.height()) + \
             DPoint(0, self.transition_len)
        bl_pts_list = [p1, p2, p3]  # bl stands for bottom-left
        ''' exploiting symmetry of reflection at x and y axes. '''
        # reflecting at x-axis
        tl_pts_list = list(map(lambda x: DTrans.M0 * x,
                               bl_pts_list))  # tl stands for top-left
        # preserving order
        tl_pts_list = reversed(
            list(tl_pts_list))  # preserving clockwise points order
        # converting iterator to list
        l_pts_list = list(itertools.chain(bl_pts_list,
                                          tl_pts_list))  # l stands for left

        # reflecting all points at y-axis
        r_pts_list = list(map(lambda x: DTrans.M90 * x, l_pts_list))
        r_pts_list = list(
            reversed(r_pts_list))  # preserving clockwise points order

        # gathering points
        pts_list = l_pts_list + r_pts_list  # concatenating proper ordered lists

        empty_polygon = DSimplePolygon(pts_list)
        self.empty_regions["bridges_2"].insert(
            SimplePolygon.from_dpoly(empty_polygon))