예제 #1
0
def ebuxy(b1, b2, epsilon=0.1, debug=False, holes=False):
    b1segs, b2segs = bsegbxy(b1, b2), bsegbxy(b2, b1)
    bo = lambda s1, s2, b: s1.mid(s2).inbxy(b)

    def inn(p):
        pn = vec3(0, 0, 1).crs(p[0].tov(p[1])).nrm().uscl(2 * epsilon)
        pm = p[0].mid(p[1])
        ep = pm.cp().trn(pn)
        if not ep.inbxy(b1) and not ep.inbxy(b2): return False
        ep = pm.cp().trn(pn.flp())
        if not ep.inbxy(b1) and not ep.inbxy(b2): return False
        return True

    b1inb2 = [p for p in b1segs if bo(p[0], p[1], b2)]
    b2inb1 = [p for p in b2segs if bo(p[0], p[1], b1)]
    b1only = [p for p in b1segs if not p in b1inb2 and not inn(p)]
    b2only = [p for p in b2segs if not p in b2inb1 and not inn(p)]
    dfs = sloops(b1only + b2only, epsilon)

    if debug:
        ax = dtl.plot_axes_xy(200)
        ax = dtl.plot_polygon_xy(b2, ax, lw=2, col='m')
        for edge in b1segs:
            ax = dtl.plot_edges_xy(edge, ax, lw=5, col='b')
        for edge in b1only:
            ax = dtl.plot_edges_xy(edge, ax, lw=8, col='b')
        for edge in b1inb2:
            ax = dtl.plot_edges_xy(edge, ax, lw=3, col='g')
        #for edge in b2only:
        #    ax = dtl.plot_edges_xy(edge,ax,lw = 5,col = 'g')
        plt.show()

    if len(dfs) > 1:
        edfs = 0
        for jdfs, lp in enumerate(dfs):
            if binbxy(dfs[edfs], lp, ie=0):
                edfs = jdfs
        if holes:
            print('genus of ebuxy changed!')
            return [(dfs.pop(edfs), dfs)]
        else:
            print('discarding holes resulting from ebuxy!')
            return [dfs[edfs]]
        '''
        print('promisedland?')
        ax = dtl.plot_axes_xy(200)
        ax = dtl.plot_polygon_xy(dfs[edfs],ax,lw = 7,col = 'r')
        ax = dtl.plot_polygon_xy(dfs[0],ax,lw = 5,col = 'b')
        ax = dtl.plot_polygon_xy(dfs[1],ax,lw = 3,col = 'g')
        #ax = dtl.plot_polygon_xy(b1,ax,ls = '-.',lw = 5,col = 'k')
        #ax = dtl.plot_polygon_xy(b2,ax,ls = '--',lw = 5,col = 'k')
        plt.show()
        '''
    if holes: return [(dfs[0], [])]
    else: return dfs
예제 #2
0
 def pl(s1,s2,s3,s4):
     ax = dtl.plot_axes_xy(10)
     ax = dtl.plot_edges_xy([s1,s2],ax,lw = 2,col = 'b')
     ax = dtl.plot_edges_xy([s3,s4],ax,lw = 2,col = 'g')
     ip = pym.sintsxyp(s1,s2,s3,s4)
     if type(ip) == type(()):
         ax = dtl.plot_point_xy(ip[0],ax,mk = 'o',col = 'r')
         ax = dtl.plot_point_xy(ip[1],ax,mk = 's',col = 'r')
     elif not ip is None:
         ax = dtl.plot_point_xy(ip,ax,mk = 'o',col = 'r')
     plt.show()
예제 #3
0
 def pl(s1, s2, s3, s4):
     ax = dtl.plot_axes_xy(10)
     ax = dtl.plot_edges_xy([s1, s2], ax, lw=2, col='b')
     ax = dtl.plot_edges_xy([s3, s4], ax, lw=2, col='g')
     ip = pym.sintsxyp(s1, s2, s3, s4)
     if type(ip) == type(()):
         ax = dtl.plot_point_xy(ip[0], ax, mk='o', col='r')
         ax = dtl.plot_point_xy(ip[1], ax, mk='s', col='r')
     elif not ip is None:
         ax = dtl.plot_point_xy(ip, ax, mk='o', col='r')
     plt.show()
예제 #4
0
def ebuxy(b1,b2,epsilon = 0.1,debug = False,holes = False):
    b1segs,b2segs = bsegbxy(b1,b2),bsegbxy(b2,b1)
    bo = lambda s1,s2,b : s1.mid(s2).inbxy(b)
    def inn(p):
        pn = vec3(0,0,1).crs(p[0].tov(p[1])).nrm().uscl(2*epsilon)
        pm = p[0].mid(p[1])
        ep = pm.cp().trn(pn)
        if not ep.inbxy(b1) and not ep.inbxy(b2):return False
        ep = pm.cp().trn(pn.flp())
        if not ep.inbxy(b1) and not ep.inbxy(b2):return False
        return True
    b1inb2 = [p for p in b1segs if bo(p[0],p[1],b2)]
    b2inb1 = [p for p in b2segs if bo(p[0],p[1],b1)]
    b1only = [p for p in b1segs if not p in b1inb2 and not inn(p)]
    b2only = [p for p in b2segs if not p in b2inb1 and not inn(p)]
    dfs = sloops(b1only+b2only,epsilon)

    if debug:
        ax = dtl.plot_axes_xy(200)
        ax = dtl.plot_polygon_xy(b2,ax,lw = 2,col = 'm')
        for edge in b1segs:
            ax = dtl.plot_edges_xy(edge,ax,lw = 5,col = 'b')
        for edge in b1only:
            ax = dtl.plot_edges_xy(edge,ax,lw = 8,col = 'b')
        for edge in b1inb2:
            ax = dtl.plot_edges_xy(edge,ax,lw = 3,col = 'g')
        #for edge in b2only:
        #    ax = dtl.plot_edges_xy(edge,ax,lw = 5,col = 'g')
        plt.show()

    if len(dfs) > 1:
        edfs = 0
        for jdfs,lp in enumerate(dfs):
            if binbxy(dfs[edfs],lp,ie = 0):
                edfs = jdfs
        if holes:
            print('genus of ebuxy changed!')
            return [(dfs.pop(edfs),dfs)]
        else:
            print('discarding holes resulting from ebuxy!')
            return [dfs[edfs]]
        '''
        print('promisedland?')
        ax = dtl.plot_axes_xy(200)
        ax = dtl.plot_polygon_xy(dfs[edfs],ax,lw = 7,col = 'r')
        ax = dtl.plot_polygon_xy(dfs[0],ax,lw = 5,col = 'b')
        ax = dtl.plot_polygon_xy(dfs[1],ax,lw = 3,col = 'g')
        #ax = dtl.plot_polygon_xy(b1,ax,ls = '-.',lw = 5,col = 'k')
        #ax = dtl.plot_polygon_xy(b2,ax,ls = '--',lw = 5,col = 'k')
        plt.show()
        '''
    if holes:return [(dfs[0],[])]
    else:return dfs
예제 #5
0
 def plotxy(self, ax=None):
     scale = vec3(1, 0, 0).prjps(self.footprint)
     scale = scale[1] - scale[0]
     if ax is None: ax = dtl.plot_axes_xy(scale)
     for vx in range(self.vcnt):
         v = self.vs[vx]
         if v is None: continue
         vb = v[1]['fp']
         vrtls = '-' if 'developed' in v[1]['type'] else '--'
         #vrtls = '--' if 'natural' in v[1]['type'] else '-'
         ax = dtl.plot_polygon_xy(pym.contract(vb, 0.01 * scale),
                                  ax,
                                  lw=2,
                                  ls=vrtls,
                                  col=None)
         vbc = vec3(0, 0, 0).com(vb)
         rs = str(vx) + ',' + str(v[1]['edges']) + ',\n' + str(v[1]['type'])
         ax = dtl.plot_point_xy_annotate(vbc, ax, rs)
         for ve in v[1]['edges']:
             if self.vs[ve] is None: continue
             ovbc = vec3(0, 0, 0).com(self.vs[ve][1]['fp'])
             ax = dtl.plot_edges_xy((vbc, ovbc), ax, lw=3, col='c')
         for ep in v[1]['exits']:
             ax = dtl.plot_point_xy(ep, ax, mk='s', col='r')
     ax = dtl.plot_polygon_xy(self.footprint, ax, lw=1, col='g')
     return ax
예제 #6
0
 def plotxy(self, fp=None, ax=None):
     if ax is None: ax = dtl.plot_axes_xy(50)
     for rmv in self.vs:
         if rmv is None: continue
         if rmv[2]['level'] > 0: continue
         bcol = 'b' if rmv[2]['shaft'] else None
         rconbs = 0.5 if pym.bccw(rmv[2]['bound']) else -0.5
         rconb = pym.contract(rmv[2]['bound'], rconbs)
         ax = dtl.plot_polygon_xy(rconb, ax, lw=4, col=bcol)
         rc = vec3(0, 0, 0).com(rmv[2]['bound'])
         rs = str(rmv[0]) + ',' + str(rmv[1])
         ax = dtl.plot_point_xy(rc, dtl.plot_point_xy_annotate(rc, ax, rs))
         if rmv[1]:
             for re in rmv[1]:
                 if self.vs[re] is None: continue
                 rt = (rc, vec3(0, 0, 0).com(self.vs[re][2]['bound']))
                 ax = dtl.plot_edges_xy(rt, ax, col='g')
         for exit in rmv[2]['exits']:
             if exit is True:
                 exitp = rc
                 ax = dtl.plot_point_xy(
                     exitp, dtl.plot_point_xy_annotate(exitp, ax, 'exit'))
             else:
                 ax = dtl.plot_point_xy(
                     exit, dtl.plot_point_xy_annotate(exit, ax, 'exit'))
     if not fp is None:
         ax = dtl.plot_polygon_xy(fp, ax, lw=2, col='r')
     return ax
예제 #7
0
 def plotxy(self,fp = None,ax = None):
     if ax is None:ax = dtl.plot_axes_xy(50)
     for rmv in self.vs:
         if rmv is None:continue
         if rmv[2]['level'] > 0:continue
         bcol = 'b' if rmv[2]['shaft'] else None
         rconbs = 0.5 if pym.bccw(rmv[2]['bound']) else -0.5
         rconb = pym.contract(rmv[2]['bound'],rconbs)
         ax = dtl.plot_polygon_xy(rconb,ax,lw = 4,col = bcol)
         rc = vec3(0,0,0).com(rmv[2]['bound'])
         rs = str(rmv[0])+','+str(rmv[1])
         ax = dtl.plot_point_xy(rc,dtl.plot_point_xy_annotate(rc,ax,rs))
         if rmv[1]:
             for re in rmv[1]:
                 if self.vs[re] is None:continue
                 rt = (rc,vec3(0,0,0).com(self.vs[re][2]['bound']))
                 ax = dtl.plot_edges_xy(rt,ax,col = 'g')
         for exit in rmv[2]['exits']:
             if exit is True:
                 exitp = rc
                 ax = dtl.plot_point_xy(exitp,
                     dtl.plot_point_xy_annotate(exitp,ax,'exit'))
             else:
                 ax = dtl.plot_point_xy(exit,
                     dtl.plot_point_xy_annotate(exit,ax,'exit'))
     if not fp is None:
         ax = dtl.plot_polygon_xy(fp,ax,lw = 2,col = 'r')
     return ax
예제 #8
0
 def pl(bs):
     ax = dtl.plot_axes_xy(10)
     ax = dtl.plot_polygon_xy(b, ax, col='g', lw=2)
     ax = dtl.plot_edges_xy((s1, s2), ax, col='r', lw=1)
     for bpy in bs:
         bpy = pym.contract(bpy, 0.1)
         ax = dtl.plot_polygon_xy(bpy, ax, col='b', lw=4)
     plt.show()
예제 #9
0
 def pl(b1, b2, br):
     ax = dtl.plot_axes_xy()
     ax = dtl.plot_polygon_xy(b1, ax, col='b', lw=5.0)
     ax = dtl.plot_polygon_xy(b2, ax, col='g', lw=5.0)
     for be in br:
         ax = dtl.plot_edges_xy(be, ax, mk='s', col='r', lw=2.0)
     #ax = dtl.plot_polygon_xy(br,ax,mk = 's',col = 'r',lw = 2.0)
     plt.show()
예제 #10
0
 def pl(b1,b2,br):
     ax = dtl.plot_axes_xy()
     ax = dtl.plot_polygon_xy(b1,ax,col = 'b',lw = 5.0)
     ax = dtl.plot_polygon_xy(b2,ax,col = 'g',lw = 5.0)
     for be in br:
         ax = dtl.plot_edges_xy(be,ax,mk = 's',col = 'r',lw = 2.0)
     #ax = dtl.plot_polygon_xy(br,ax,mk = 's',col = 'r',lw = 2.0)
     plt.show()
예제 #11
0
 def pl(bs):
     ax = dtl.plot_axes_xy(10)
     ax = dtl.plot_polygon_xy(b,ax,col = 'g',lw = 2)
     ax = dtl.plot_edges_xy((s1,s2),ax,col = 'r',lw = 1)
     for bpy in bs:
         bpy = pym.contract(bpy,0.1)
         ax = dtl.plot_polygon_xy(bpy,ax,col = 'b',lw = 4)
     plt.show()
예제 #12
0
    def layfootprints(r, t, e):
        eseam, seams, loops = pym.pgtopy(r, 5, e, findeseam=True)
        ebnd = seams[eseam]
        eloop = loops[eseam]
        k = 0
        easement = None
        for j in range(len(ebnd)):
            road = r.es[r.elook[(eloop[k - 1], eloop[k])]]
            edge = (ebnd[j - 1], ebnd[j])
            tang = edge[0].tov(edge[1])
            norm = tang.crs(vec3(0, 0, 1)).nrm()
            p1 = edge[0].cp().trn(tang.cp().uscl(0.0))
            p2 = edge[0].cp().trn(tang.cp().uscl(1.0))
            p3 = p2.cp().trn(norm.uscl(10))
            p4 = p1.cp().trn(norm)
            newfp = [p1, p2, p3, p4]
            newfp = pym.contract(newfp, 2)
            newfp = pym.ebdxy(newfp, ebnd)[0]
            newfp = (newfp, [])
            preasement = easement
            if easement is None: easement = newfp
            else: easement = pym.epuxy(easement, newfp)[0]
            if not eloop[k] == eloop[k - 2]: k += 1

            if False and j > 85:
                print('walk', j, len(eloop), len(ebnd))
                ax = dtl.plot_axes_xy(300)
                ax = dtl.plot_polygon_xy(ebnd, ax, lw=3, col='b')
                ax = dtl.plot_points_xy(ebnd, ax, number=True)
                ax = dtl.plot_edges_xy(edge, ax, lw=7, col='r')
                ax = dtl.plot_polygon_full_xy(easement, ax, lw=5, col='g')
                if preasement:
                    ax = dtl.plot_polygon_full_xy(preasement,
                                                  ax,
                                                  lw=3,
                                                  col='m')
                plt.show()

        #easement = pym.bsuxy(easement,e)
        fps = ([easement], [[] for l in range(len(loops) - 1)])
        # generate a set of footprints connected to road
        # footprint must not overlap interiors with ebnd
        ax = dtl.plot_axes_xy(300)
        ax = dtl.plot_polygon_xy(ebnd, ax, lw=3, col='b')
        for fp in fps[0]:
            ax = dtl.plot_polygon_full_xy(fp, ax, lw=3, col='g')
        plt.show()

        return fps
예제 #13
0
    def plotxy(self,ax = None,scale = 250):
        if ax is None:ax = dtl.plot_axes_xy(scale)
        ax = pgr.planargraph.plotxy(self,ax)
        ekeys = []
        for vx in range(self.vcnt):
            v = self.vs[vx]
            if v is None:continue
            vb = v[1]['b']
            vrtls = '-'
            if 't' in v[1]:vrtls = '--' if 'developed' in v[1]['t'] else '-'
            conr = 1 if pym.bccw(vb[0]) else -1
            ax = dtl.plot_polygon_xy(pym.contract(vb[0],conr),
                ax,lw = 2,ls = vrtls,col = 'b')
            for ib in vb[1]:
                conr = 1 if pym.bccw(ib) else -1
                ax = dtl.plot_polygon_xy(pym.contract(ib,conr),ax,lw = 2,col = 'r')
            vbc = vec3(0,0,0).com(vb[0])
            rs = str(vx)+','+str(self.orings[vx])#+',\n'+str(v[1]['type'])
            ax = dtl.plot_point_xy_annotate(vbc,ax,rs)
            for ve in self.orings[vx]:
                ov = self.vs[ve]
                if ov is None:continue

                if not (vx,ve) in ekeys and not (ve,vx) in ekeys:
                    ekeys.append((vx,ve))
                    aws = pym.badjbxy(vb[0],ov[1]['b'][0],0)
                    for awx in range(len(aws)):
                        vwx,owx = aws[awx]
                        ex,ekws = self.es[self.elook[ekeys[-1]]]
                        door = vb[0][vwx-1].lerp(vb[0][vwx],ekws['p'])
                        ax = dtl.plot_point_xy(door,ax,col = 'r')

                ovbc = vec3(0,0,0).com(self.vs[ve][1]['b'][0])
                ax = dtl.plot_edges_xy((vbc,ovbc),ax,lw = 3,col = 'c')

            #for ep in v[1]['exits']:
            #    ax = dtl.plot_point_xy(ep,ax,mk = 's',col = 'r')

        return ax
예제 #14
0
 def plotxy(self,ax = None,l = 10,s = 1.0,number = True,**kws):
     if ax is None:ax = dtl.plot_axes_xy(l,**kws)
     for j in range(self.vcnt):
         i = self.vs[j]
         if i is None:continue
         ip = i[1]['p']
         if number:
             jstr = str(j)+str([v for v in self.rings[j]])
             jstrccw = str([self.ccw(j,v) for v in self.rings[j]])
             jstrcw = str([self.cw(j,v) for v in self.rings[j]])
             jstr += '\n'+jstrccw+'\n'+jstrcw
             ax = dtl.plot_point_xy_annotate(ip,ax,jstr)
         ax = dtl.plot_point_xy(ip,ax,col = 'r')
     for k in self.rings:
         vr = self.rings[k]
         for ov in vr:
             if vr[ov] is None:continue
             re = (self.vs[k][1]['p'].cp(),self.vs[ov][1]['p'].cp())
             rn = vec3(0,0,1).crs(re[0].tov(re[1])).nrm().uscl(s)
             re = (re[0].trn(rn),re[1].trn(rn))
             ax = dtl.plot_edges_xy(re,ax,lw = 2,col = 'g')
     return ax
예제 #15
0
 def plotxy(self, ax=None, l=10, s=1.0, number=True, **kws):
     if ax is None: ax = dtl.plot_axes_xy(l, **kws)
     for j in range(self.vcnt):
         i = self.vs[j]
         if i is None: continue
         ip = i[1]['p']
         if number:
             jstr = str(j) + str([v for v in self.rings[j]])
             jstrccw = str([self.ccw(j, v) for v in self.rings[j]])
             jstrcw = str([self.cw(j, v) for v in self.rings[j]])
             jstr += '\n' + jstrccw + '\n' + jstrcw
             ax = dtl.plot_point_xy_annotate(ip, ax, jstr)
         ax = dtl.plot_point_xy(ip, ax, col='r')
     for k in self.rings:
         vr = self.rings[k]
         for ov in vr:
             if vr[ov] is None: continue
             re = (self.vs[k][1]['p'].cp(), self.vs[ov][1]['p'].cp())
             rn = vec3(0, 0, 1).crs(re[0].tov(re[1])).nrm().uscl(s)
             re = (re[0].trn(rn), re[1].trn(rn))
             ax = dtl.plot_edges_xy(re, ax, lw=2, col='g')
     return ax
예제 #16
0
 def plotxy(self,ax = None):
     scale = vec3(1,0,0).prjps(self.footprint)
     scale = scale[1]-scale[0]
     if ax is None:ax = dtl.plot_axes_xy(scale)
     for vx in range(self.vcnt):
         v = self.vs[vx]
         if v is None:continue
         vb = v[1]['fp']
         vrtls = '-' if 'developed' in v[1]['type'] else '--'
         #vrtls = '--' if 'natural' in v[1]['type'] else '-'
         ax = dtl.plot_polygon_xy(
             pym.contract(vb,0.01*scale),ax,lw = 2,ls = vrtls,col = None)
         vbc = vec3(0,0,0).com(vb)
         rs = str(vx)+','+str(v[1]['edges'])+',\n'+str(v[1]['type'])
         ax = dtl.plot_point_xy_annotate(vbc,ax,rs)
         for ve in v[1]['edges']:
             if self.vs[ve] is None:continue
             ovbc = vec3(0,0,0).com(self.vs[ve][1]['fp'])
             ax = dtl.plot_edges_xy((vbc,ovbc),ax,lw = 3,col = 'c')
         for ep in v[1]['exits']:
             ax = dtl.plot_point_xy(ep,ax,mk = 's',col = 'r')
     ax = dtl.plot_polygon_xy(self.footprint,ax,lw = 1,col = 'g')
     return ax
예제 #17
0
def pinchb(b,epsilon = 5):
    pde = lambda p,e1,e2 : abs()
    new = lambda s1,s2 : not ((s1,s2) in unfin or (s1,s2) in unfin)
    unfin = [(b[x-1],b[x]) for x in range(len(b))]
    fin = []
    while unfin:
        u1,u2 = unfin.pop(0)
        clear = True
        for e1,e2 in unfin:
            e1u12d = e1.dexy(u1,u2,0)
            e2u12d = e2.dexy(u1,u2,0)
            if False and e1u12d > -1 and e1u12d < epsilon:

                ax = dtl.plot_axes_xy(200)
                ax = dtl.plot_polygon_xy(b,ax,lw = 2,ls = '--',col = 'k')
                ax = dtl.plot_edges_xy((u1,u2),ax,lw = 3,col = 'b')
                ax = dtl.plot_edges_xy((e1,e2),ax,lw = 3,col = 'g')
                plt.show()

                pdb.set_trace()
            elif False and e2u12d > -1 and e2u12d < epsilon:

                ax = dtl.plot_axes_xy(200)
                ax = dtl.plot_polygon_xy(b,ax,lw = 2,ls = '--',col = 'k')
                ax = dtl.plot_edges_xy((u1,u2),ax,lw = 3,col = 'b')
                ax = dtl.plot_edges_xy((e1,e2),ax,lw = 3,col = 'g')
                plt.show()

                pdb.set_trace()
            elif e1.onsxy(u1,u2,0):
                if new(u1,e1):unfin.append((u1,e1))
                if new(e1,u2):unfin.append((e1,u2))
                clear = False
                break
            elif e2.onsxy(u1,u2,0):
                if new(u1,e2):unfin.append((u1,e2))
                if new(e2,u2):unfin.append((e2,u2))
                clear = False
                break
            elif sintsxy(u1,u2,e1,e2,ie = False,ieb = False):
                '''#
                ax = dtl.plot_axes_xy(200)
                for u in unfin:
                    ax = dtl.plot_edges_xy(u,ax,col = 'r',lw = 8)
                for f in fin:
                    ax = dtl.plot_edges_xy(f,ax,col = 'g',lw = 7)
                ax = dtl.plot_edges_xy((u1,u2),ax,col = 'c',lw = 5)
                ax = dtl.plot_edges_xy((e1,e2),ax,col = 'b',lw = 2)
                plt.show()
                '''#
                if sintsxy(u1,u2,e1,e2,ie = False,ieb = False,col = False):
                    ip = sintsxyp(u1,u2,e1,e2)
                    if new(u1,ip):unfin.append((u1,ip))
                    if new(ip,u2):unfin.append((ip,u2))
                    clear = False
                    break
                else:
                    if new(u1,u2):unfin.append((u1,u2))
                    clear = False
        if clear:
            fin.append((u1,u2))

    uloops = sloops(fin,epsilon)
    if len(uloops) > 1:
        #las = [bareaxy(ol) for ol in uloops]
        las = [bareaxy(ol,True) for ol in uloops]
        ulas = [(u,a) for u,a in zip(uloops,las) if a > 10]
        if ulas:
            uloops,las = zip(*ulas)
            uloops,las = list(uloops),list(las)
            uloops.insert(0,uloops.pop(las.index(max(las))))
    print('PINCHB ACCOMPLISHED')
    return uloops
예제 #18
0
 def pl(s1, s2, b):
     ax = dtl.plot_axes_xy()
     ax = dtl.plot_polygon_xy(b, ax, lw=2.0, col='g')
     ax = dtl.plot_edges_xy([s1, s2], ax, lw=4.0, col='b')
     plt.show()
예제 #19
0
 def test_sintbxyp(self):
     u1, u2 = (vec3(77.000000, 33.001942,
                    0.000000), vec3(63.000000, 33.000004, 0.000000))
     b = [
         vec3(75.000000, 35.000011, 0.000000),
         vec3(76.999992, 35.000011, 0.000000),
         vec3(76.999992, 32.999996, 0.000000),
         vec3(67.000000, 33.000000, 0.000000),
         vec3(66.999992, 22.999996, 0.000000),
         vec3(33.000000, 23.000004, 0.000000),
         vec3(33.000000, 33.001392, 0.000000),
         vec3(23.001953, 33.000004, 0.000000),
         vec3(23.001545, 61.998047, 0.000000),
         vec3(23.001442, 63.001602, 0.000000),
         vec3(18.000002, 63.001541, 0.000000),
         vec3(16.999865, 63.001438, 0.000000),
         vec3(17.000000, 62.000000, 0.000000),
         vec3(17.000000, 58.000000, 0.000000),
         vec3(17.000000, 42.000000, 0.000000),
         vec3(17.000000, 38.000000, 0.000000),
         vec3(17.000000, 18.000000, 0.000000),
         vec3(5.000000, 18.000000, 0.000000),
         vec3(5.000000, 20.000000, 0.000000),
         vec3(5.000000, 38.000000, 0.000000),
         vec3(5.000000, 40.000000, 0.000000),
         vec3(5.000000, 42.000000, 0.000000),
         vec3(5.000000, 58.000000, 0.000000),
         vec3(5.000000, 60.000000, 0.000000),
         vec3(5.000000, 62.000000, 0.000000),
         vec3(5.000000, 63.000206, 0.000000),
         vec3(5.000000, 75.000000, 0.000000),
         vec3(16.998253, 75.000000, 0.000000),
         vec3(17.999998, 75.000000, 0.000000),
         vec3(19.999998, 75.000000, 0.000000),
         vec3(22.000002, 75.000000, 0.000000),
         vec3(23.000202, 75.000000, 0.000000),
         vec3(34.999996, 75.000000, 0.000000),
         vec3(34.999996, 63.001747, 0.000000),
         vec3(34.999996, 61.999722, 0.000000),
         vec3(34.999996, 60.000000, 0.000000),
         vec3(34.999996, 58.000000, 0.000000),
         vec3(35.000000, 36.999996, 0.000000),
         vec3(35.000000, 35.000004, 0.000000),
         vec3(36.999866, 35.000000, 0.000000),
         vec3(63.000004, 35.000004, 0.000000),
         vec3(64.999992, 35.000004, 0.000000),
         vec3(64.999992, 37.000004, 0.000000),
         vec3(64.999992, 43.001785, 0.000000),
         vec3(64.999992, 45.000004, 0.000000),
         vec3(62.999996, 45.000004, 0.000000),
         vec3(56.999790, 45.000004, 0.000000),
         vec3(44.999996, 45.000000, 0.000000),
         vec3(44.999996, 56.998211, 0.000000),
         vec3(44.999996, 58.000000, 0.000000),
         vec3(44.999996, 60.000000, 0.000000),
         vec3(44.999996, 62.000000, 0.000000),
         vec3(45.000000, 63.000206, 0.000000),
         vec3(45.000000, 75.000000, 0.000000),
         vec3(57.000000, 75.000000, 0.000000),
         vec3(57.999996, 75.000000, 0.000000),
         vec3(59.999992, 75.000000, 0.000000),
         vec3(62.000004, 75.000000, 0.000000),
         vec3(63.000195, 75.000000, 0.000000),
         vec3(74.999985, 75.000000, 0.000000),
         vec3(74.999985, 63.001747, 0.000000),
         vec3(74.999985, 60.000004, 0.000000),
         vec3(74.999985, 57.999996, 0.000000),
         vec3(63.001968, 58.000004, 0.000000),
         vec3(63.001446, 63.000515, 0.000000),
         vec3(58.000008, 63.000000, 0.000000),
         vec3(56.998913, 63.001442, 0.000000),
         vec3(56.998459, 58.000004, 0.000000),
         vec3(56.998562, 56.999187, 0.000000),
         vec3(67.000008, 57.000004, 0.000000),
         vec3(67.000000, 47.000000, 0.000000),
         vec3(74.999992, 47.000004, 0.000000),
     ]
     ips = pym.sintbxyp(u1, u2, b, ieb=False)
     ax = dtl.plot_axes_xy(100)
     ax = dtl.plot_polygon_xy(b, ax, lw=2, col='g')
     ax = dtl.plot_points_xy((u1, u2), ax, cs=['b'] * 2)
     ax = dtl.plot_edges_xy((u1, u2), ax, col='b')
     ax = dtl.plot_points_xy(ips, ax, cs=['r'] * len(ips))
     print('IPS', ips)
     plt.show()
     pdb.set_trace()
예제 #20
0
def pinchb(b, epsilon=5):
    pde = lambda p, e1, e2: abs()
    new = lambda s1, s2: not ((s1, s2) in unfin or (s1, s2) in unfin)
    unfin = [(b[x - 1], b[x]) for x in range(len(b))]
    fin = []
    while unfin:
        u1, u2 = unfin.pop(0)
        clear = True
        for e1, e2 in unfin:
            e1u12d = e1.dexy(u1, u2, 0)
            e2u12d = e2.dexy(u1, u2, 0)
            if False and e1u12d > -1 and e1u12d < epsilon:

                ax = dtl.plot_axes_xy(200)
                ax = dtl.plot_polygon_xy(b, ax, lw=2, ls='--', col='k')
                ax = dtl.plot_edges_xy((u1, u2), ax, lw=3, col='b')
                ax = dtl.plot_edges_xy((e1, e2), ax, lw=3, col='g')
                plt.show()

                pdb.set_trace()
            elif False and e2u12d > -1 and e2u12d < epsilon:

                ax = dtl.plot_axes_xy(200)
                ax = dtl.plot_polygon_xy(b, ax, lw=2, ls='--', col='k')
                ax = dtl.plot_edges_xy((u1, u2), ax, lw=3, col='b')
                ax = dtl.plot_edges_xy((e1, e2), ax, lw=3, col='g')
                plt.show()

                pdb.set_trace()
            elif e1.onsxy(u1, u2, 0):
                if new(u1, e1): unfin.append((u1, e1))
                if new(e1, u2): unfin.append((e1, u2))
                clear = False
                break
            elif e2.onsxy(u1, u2, 0):
                if new(u1, e2): unfin.append((u1, e2))
                if new(e2, u2): unfin.append((e2, u2))
                clear = False
                break
            elif sintsxy(u1, u2, e1, e2, ie=False, ieb=False):
                '''#
                ax = dtl.plot_axes_xy(200)
                for u in unfin:
                    ax = dtl.plot_edges_xy(u,ax,col = 'r',lw = 8)
                for f in fin:
                    ax = dtl.plot_edges_xy(f,ax,col = 'g',lw = 7)
                ax = dtl.plot_edges_xy((u1,u2),ax,col = 'c',lw = 5)
                ax = dtl.plot_edges_xy((e1,e2),ax,col = 'b',lw = 2)
                plt.show()
                '''#
                if sintsxy(u1, u2, e1, e2, ie=False, ieb=False, col=False):
                    ip = sintsxyp(u1, u2, e1, e2)
                    if new(u1, ip): unfin.append((u1, ip))
                    if new(ip, u2): unfin.append((ip, u2))
                    clear = False
                    break
                else:
                    if new(u1, u2): unfin.append((u1, u2))
                    clear = False
        if clear:
            fin.append((u1, u2))

    uloops = sloops(fin, epsilon)
    if len(uloops) > 1:
        #las = [bareaxy(ol) for ol in uloops]
        las = [bareaxy(ol, True) for ol in uloops]
        ulas = [(u, a) for u, a in zip(uloops, las) if a > 10]
        if ulas:
            uloops, las = zip(*ulas)
            uloops, las = list(uloops), list(las)
            uloops.insert(0, uloops.pop(las.index(max(las))))
    print('PINCHB ACCOMPLISHED')
    return uloops
예제 #21
0
 def pl(s1,s2,b):
     ax = dtl.plot_axes_xy()
     ax = dtl.plot_polygon_xy(b,ax,lw = 2.0,col = 'g')
     ax = dtl.plot_edges_xy([s1,s2],ax,lw = 4.0,col = 'b')
     plt.show()
예제 #22
0
 def test_sintbxyp(self):
     u1,u2 = (vec3(77.000000,33.001942,0.000000) , vec3(63.000000,33.000004,0.000000))
     b = [
         vec3(75.000000,35.000011,0.000000) ,
         vec3(76.999992,35.000011,0.000000) ,
         vec3(76.999992,32.999996,0.000000) ,
         vec3(67.000000,33.000000,0.000000) ,
         vec3(66.999992,22.999996,0.000000) ,
         vec3(33.000000,23.000004,0.000000) ,
         vec3(33.000000,33.001392,0.000000) ,
         vec3(23.001953,33.000004,0.000000) ,
         vec3(23.001545,61.998047,0.000000) ,
         vec3(23.001442,63.001602,0.000000) ,
         vec3(18.000002,63.001541,0.000000) ,
         vec3(16.999865,63.001438,0.000000) ,
         vec3(17.000000,62.000000,0.000000) ,
         vec3(17.000000,58.000000,0.000000) ,
         vec3(17.000000,42.000000,0.000000) ,
         vec3(17.000000,38.000000,0.000000) ,
         vec3(17.000000,18.000000,0.000000) ,
         vec3(5.000000,18.000000,0.000000) ,
         vec3(5.000000,20.000000,0.000000) ,
         vec3(5.000000,38.000000,0.000000) ,
         vec3(5.000000,40.000000,0.000000) ,
         vec3(5.000000,42.000000,0.000000) ,
         vec3(5.000000,58.000000,0.000000) ,
         vec3(5.000000,60.000000,0.000000) ,
         vec3(5.000000,62.000000,0.000000) ,
         vec3(5.000000,63.000206,0.000000) ,
         vec3(5.000000,75.000000,0.000000) ,
         vec3(16.998253,75.000000,0.000000) ,
         vec3(17.999998,75.000000,0.000000) ,
         vec3(19.999998,75.000000,0.000000) ,
         vec3(22.000002,75.000000,0.000000) ,
         vec3(23.000202,75.000000,0.000000) ,
         vec3(34.999996,75.000000,0.000000) ,
         vec3(34.999996,63.001747,0.000000) ,
         vec3(34.999996,61.999722,0.000000) ,
         vec3(34.999996,60.000000,0.000000) ,
         vec3(34.999996,58.000000,0.000000) ,
         vec3(35.000000,36.999996,0.000000) ,
         vec3(35.000000,35.000004,0.000000) ,
         vec3(36.999866,35.000000,0.000000) ,
         vec3(63.000004,35.000004,0.000000) ,
         vec3(64.999992,35.000004,0.000000) ,
         vec3(64.999992,37.000004,0.000000) ,
         vec3(64.999992,43.001785,0.000000) ,
         vec3(64.999992,45.000004,0.000000) ,
         vec3(62.999996,45.000004,0.000000) ,
         vec3(56.999790,45.000004,0.000000) ,
         vec3(44.999996,45.000000,0.000000) ,
         vec3(44.999996,56.998211,0.000000) ,
         vec3(44.999996,58.000000,0.000000) ,
         vec3(44.999996,60.000000,0.000000) ,
         vec3(44.999996,62.000000,0.000000) ,
         vec3(45.000000,63.000206,0.000000) ,
         vec3(45.000000,75.000000,0.000000) ,
         vec3(57.000000,75.000000,0.000000) ,
         vec3(57.999996,75.000000,0.000000) ,
         vec3(59.999992,75.000000,0.000000) ,
         vec3(62.000004,75.000000,0.000000) ,
         vec3(63.000195,75.000000,0.000000) ,
         vec3(74.999985,75.000000,0.000000) ,
         vec3(74.999985,63.001747,0.000000) ,
         vec3(74.999985,60.000004,0.000000) ,
         vec3(74.999985,57.999996,0.000000) ,
         vec3(63.001968,58.000004,0.000000) ,
         vec3(63.001446,63.000515,0.000000) ,
         vec3(58.000008,63.000000,0.000000) ,
         vec3(56.998913,63.001442,0.000000) ,
         vec3(56.998459,58.000004,0.000000) ,
         vec3(56.998562,56.999187,0.000000) ,
         vec3(67.000008,57.000004,0.000000) ,
         vec3(67.000000,47.000000,0.000000) ,
         vec3(74.999992,47.000004,0.000000) ,
             ]
     ips = pym.sintbxyp(u1,u2,b,ieb = False)
     ax = dtl.plot_axes_xy(100)
     ax = dtl.plot_polygon_xy(b,ax,lw = 2,col = 'g')
     ax = dtl.plot_points_xy((u1,u2),ax,cs = ['b']*2)
     ax = dtl.plot_edges_xy((u1,u2),ax,col = 'b')
     ax = dtl.plot_points_xy(ips,ax,cs = ['r']*len(ips))
     print('IPS',ips)
     plt.show()
     pdb.set_trace()
예제 #23
0
 def show_xy(self,tris,bnds):
     ax = dtl.plot_axes_xy()
     for t in tris:dtl.plot_polygon_xy(t,ax,True,lw = 2,col = 'g')
     for b in bnds:dtl.plot_edges_xy(b,ax,True,lw = 5,col = 'b')
     if self.doshow:plt.show()