示例#1
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
示例#2
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
示例#3
0
 def pl(rg, u, v, t):
     ax = rg.plotxy(s=0.02, number=True)
     plt.show()
     ax = rg.plotxy(s=0.02, number=False)
     #ax = dtl.plot_axes_xy(10)
     up = rg.vs[u][1]['p']
     vp = rg.vs[v][1]['p']
     tp = rg.vs[t][1]['p']
     ax = dtl.plot_point_xy_annotate(up, ax, 'u   |')
     ax = dtl.plot_point_xy(up, ax, col='r')
     ax = dtl.plot_point_xy_annotate(vp, ax, 'v   |')
     ax = dtl.plot_point_xy(vp, ax, col='r')
     ax = dtl.plot_point_xy_annotate(tp, ax, 't   |')
     ax = dtl.plot_point_xy(tp, ax, col='r')
     uor = rg.orings[u]
     for uox in range(len(uor)):
         if uox == v: continue
         up = rg.vs[uor[uox]][1]['p']
         ax = dtl.plot_point_xy_annotate(up, ax, str(uor[uox]))
         ax = dtl.plot_point_xy(up, ax, col='b')
     vor = rg.orings[v]
     for vox in range(len(vor)):
         if vox == u: continue
         vp = rg.vs[vor[vox]][1]['p']
         ax = dtl.plot_point_xy_annotate(vp, ax, str(vor[vox]))
         ax = dtl.plot_point_xy(vp, ax, col='b')
     plt.show()
示例#4
0
 def pl(rg,u,v,t):
     ax = rg.plotxy(s = 0.02,number = True)
     plt.show()
     ax = rg.plotxy(s = 0.02,number = False)
     #ax = dtl.plot_axes_xy(10)
     up = rg.vs[u][1]['p']
     vp = rg.vs[v][1]['p']
     tp = rg.vs[t][1]['p']
     ax = dtl.plot_point_xy_annotate(up,ax,'u   |')
     ax = dtl.plot_point_xy(up,ax,col = 'r')
     ax = dtl.plot_point_xy_annotate(vp,ax,'v   |')
     ax = dtl.plot_point_xy(vp,ax,col = 'r')
     ax = dtl.plot_point_xy_annotate(tp,ax,'t   |')
     ax = dtl.plot_point_xy(tp,ax,col = 'r')
     uor = rg.orings[u]
     for uox in range(len(uor)):
         if uox == v:continue
         up = rg.vs[uor[uox]][1]['p']
         ax = dtl.plot_point_xy_annotate(up,ax,str(uor[uox]))
         ax = dtl.plot_point_xy(up,ax,col = 'b')
     vor = rg.orings[v]
     for vox in range(len(vor)):
         if vox == u:continue
         vp = rg.vs[vor[vox]][1]['p']
         ax = dtl.plot_point_xy_annotate(vp,ax,str(vor[vox]))
         ax = dtl.plot_point_xy(vp,ax,col = 'b')
     plt.show()
示例#5
0
 def pl(s11,s12,s21,s22):
     ax = dtl.plot_axes_xy(1.5)
     ax = dtl.plot_point_xy(s11,dtl.plot_point_xy_annotate(s11,ax,'s11'),col = 'b')
     ax = dtl.plot_point_xy(s12,dtl.plot_point_xy_annotate(s12,ax,'s12'),col = 'b')
     ax = dtl.plot_point_xy(s21,dtl.plot_point_xy_annotate(s21,ax,'s21'),col = 'g')
     ax = dtl.plot_point_xy(s22,dtl.plot_point_xy_annotate(s22,ax,'s22'),col = 'g')
     ax = dtl.plot_vector_xy(s11,s11.tov(s21),ax,lw = 5.0,col = 'r')
     ax = dtl.plot_vector_xy(s11,s11.tov(s12),ax,lw = 2.0,col = 'b')
     ax = dtl.plot_vector_xy(s21,s21.tov(s22),ax,lw = 2.0,col = 'g')
     plt.show()
示例#6
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()
示例#7
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()
示例#8
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
示例#9
0
 def pl(s11, s12, s21, s22):
     ax = dtl.plot_axes_xy(1.5)
     ax = dtl.plot_point_xy(s11,
                            dtl.plot_point_xy_annotate(s11, ax, 's11'),
                            col='b')
     ax = dtl.plot_point_xy(s12,
                            dtl.plot_point_xy_annotate(s12, ax, 's12'),
                            col='b')
     ax = dtl.plot_point_xy(s21,
                            dtl.plot_point_xy_annotate(s21, ax, 's21'),
                            col='g')
     ax = dtl.plot_point_xy(s22,
                            dtl.plot_point_xy_annotate(s22, ax, 's22'),
                            col='g')
     ax = dtl.plot_vector_xy(s11, s11.tov(s21), ax, lw=5.0, col='r')
     ax = dtl.plot_vector_xy(s11, s11.tov(s12), ax, lw=2.0, col='b')
     ax = dtl.plot_vector_xy(s21, s21.tov(s22), ax, lw=2.0, col='g')
     plt.show()
示例#10
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
示例#11
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
示例#12
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
示例#13
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