Ejemplo n.º 1
0
 def plot(self, ax=None):
     scale = vec3(1, 0, 0).prjps(self.footprint)
     scale = scale[1] - scale[0]
     if ax is None: ax = dtl.plot_axes(scale)
     for vx in range(self.vcnt):
         v = self.vs[vx]
         if v is None: continue
         vb = v[1]['fp']
         vrtls = '--' if 'natural' in v[1]['type'] else '-'
         ax = dtl.plot_polygon(pym.contract(vb, 0.01 * scale),
                               ax,
                               lw=2,
                               ls=vrtls,
                               col=None)
         vbc = vec3(0, 0, 0).com(vb)
         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((vbc, ovbc), ax, lw=3, col='c')
         for ep in v[1]['exits']:
             ax = dtl.plot_point(ep, ax, mk='s', col='r')
     top = [p.cp().ztrn(self.height) for p in self.footprint]
     ax = dtl.plot_polygon(self.footprint, ax, lw=1, col='g')
     ax = dtl.plot_polygon(top, ax, lw=1, col='b')
     return ax
Ejemplo n.º 2
0
def realize(i, p, d, axiom, rules, **params):
    ax = dtl.plot_axes(10)
    for piece in lsy.lgen(p, d, axiom, rules, i, **params):
        if isinstance(piece, tuple):
            ax = dtl.plot_edges(piece, ax, lw=2, col='k')
        elif isinstance(piece, vec3):
            ax = dtl.plot_point(piece, ax)
    plt.show()
Ejemplo n.º 3
0
def realize(i,p,d,axiom,rules,**params):
    ax = dtl.plot_axes(10)
    for piece in lsy.lgen(p,d,axiom,rules,i,**params):
        if isinstance(piece,tuple):
            ax = dtl.plot_edges(piece,ax,lw = 2,col = 'k')
        elif isinstance(piece,vec3):
            ax = dtl.plot_point(piece,ax)
    plt.show()
Ejemplo n.º 4
0
 def plot(self, fp=None, ax=None):
     if ax is None: ax = dtl.plot_axes(50)
     for rmv in self.vs:
         if rmv is None: continue
         ax = dtl.plot_polygon(rmv[2]['bound'], ax, lw=4)
         rc = vec3(0, 0, 0).com(rmv[2]['bound'])
         rs = str(rmv[0]) + ',' + str(rmv[1])
         ax = dtl.plot_point(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(rt, ax, col='g')
         for exit in rmv[2]['exits']:
             if exit is True:
                 exitp = rc
                 ax = dtl.plot_point(
                     exitp, dtl.plot_point_xy_annotate(exitp, ax, 'exit'))
             else:
                 ax = dtl.plot_point(
                     exit, dtl.plot_point_xy_annotate(exit, ax, 'exit'))
     if not fp is None:
         ax = dtl.plot_polygon(fp, ax, lw=2, col='r')
     return ax
Ejemplo n.º 5
0
 def plot(self,fp = None,ax = None):
     if ax is None:ax = dtl.plot_axes(50)
     for rmv in self.vs:
         if rmv is None:continue
         ax = dtl.plot_polygon(rmv[2]['bound'],ax,lw = 4)
         rc = vec3(0,0,0).com(rmv[2]['bound'])
         rs = str(rmv[0])+','+str(rmv[1])
         ax = dtl.plot_point(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(rt,ax,col = 'g')
         for exit in rmv[2]['exits']:
             if exit is True:
                 exitp = rc
                 ax = dtl.plot_point(exitp,
                     dtl.plot_point_xy_annotate(exitp,ax,'exit'))
             else:
                 ax = dtl.plot_point(exit,
                     dtl.plot_point_xy_annotate(exit,ax,'exit'))
     if not fp is None:
         ax = dtl.plot_polygon(fp,ax,lw = 2,col = 'r')
     return ax
Ejemplo n.º 6
0
 def plot(self,ax = None,l = 10,**kws):
     if ax is None:ax = dtl.plot_axes(l)
     for j in range(self.vcnt):
         i = self.vs[j]
         if i is None:continue
         ip = i[1]['p']
         ax = dtl.plot_point(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()
             re = (re[0].trn(rn),re[1].trn(rn))
             ax = dtl.plot_edges(re,ax,lw = 2,col = 'g')
     return ax
Ejemplo n.º 7
0
 def plot(self, ax=None, l=10, **kws):
     if ax is None: ax = dtl.plot_axes(l)
     for j in range(self.vcnt):
         i = self.vs[j]
         if i is None: continue
         ip = i[1]['p']
         ax = dtl.plot_point(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()
             re = (re[0].trn(rn), re[1].trn(rn))
             ax = dtl.plot_edges(re, ax, lw=2, col='g')
     return ax
Ejemplo n.º 8
0
 def plot(self,ax = None):
     scale = vec3(1,0,0).prjps(self.footprint)
     scale = scale[1]-scale[0]
     if ax is None:ax = dtl.plot_axes(scale)
     for vx in range(self.vcnt):
         v = self.vs[vx]
         if v is None:continue
         vb = v[1]['fp']
         vrtls = '--' if 'natural' in v[1]['type'] else '-'
         ax = dtl.plot_polygon(
             pym.contract(vb,0.01*scale),ax,lw = 2,ls = vrtls,col = None)
         vbc = vec3(0,0,0).com(vb)
         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((vbc,ovbc),ax,lw = 3,col = 'c')
         for ep in v[1]['exits']:
             ax = dtl.plot_point(ep,ax,mk = 's',col = 'r')
     top = [p.cp().ztrn(self.height) for p in self.footprint]
     ax = dtl.plot_polygon(self.footprint,ax,lw = 1,col = 'g')
     ax = dtl.plot_polygon(top,ax,lw = 1,col = 'b')
     return ax
Ejemplo n.º 9
0
 def pl():
     ax = rg.plot()
     ax = dtl.plot_polygon(fp, ax, col='b')
     ax = dtl.plot_point(ex, ax, col='r')
     plt.show()
Ejemplo n.º 10
0
 def pl():
     ax = rg.plot()
     ax = dtl.plot_polygon(fp,ax,col = 'b')
     ax = dtl.plot_point(ex,ax,col = 'r')
     plt.show()