def plot(self, ax): for fx in range(self.shell.facecount): sf = self.shell.faces[fx] if sf is None: continue sfvs = self.shell.mask(0, None, None, sf) sfps = [self.geom.points.ps[v.px] for v in sfvs] dtl.plot_polygon(sfps, ax) return ax
def plot(self,ax): for fx in range(self.shell.facecount): sf = self.shell.faces[fx] if sf is None:continue sfvs = self.shell.mask(0,None,None,sf) sfps = [self.geom.points.ps[v.px] for v in sfvs] dtl.plot_polygon(sfps,ax) return ax
def plot(self,ax = None): if ax is None:ax = dtl.plot_axes() self.plot_rgraph(ax) self.plot_rgraph(ax) dtl.plot_polygon(self.boundary,ax) r = self.radius() ax.set_xlim([-r,r]) ax.set_ylim([-r,r]) ax.set_zlim([-r,r]) return ax
def plot(self, ax=None): if ax is None: ax = dtl.plot_axes() self.plot_rgraph(ax) self.plot_rgraph(ax) dtl.plot_polygon(self.boundary, ax) r = self.radius() ax.set_xlim([-r, r]) ax.set_ylim([-r, r]) ax.set_zlim([-r, r]) return ax
def plot(self,ax = None): if ax is None: l = self.radius() ax = dtl.plot_axes(x = l) ax = dtl.plot_points(self.points.ps,ax) for edx in range(len(self.edges)): e = self.edges[edx] if e is None:continue dtl.plot_edges(self.points.get_points(*e),ax) for smp in self.simplices:dtl.plot_polygon(list(smp),ax) for gst in self.ghostbnds:dtl.plot_edges(gst,ax,lw = 5.0) return ax
def teststage(**kwargs): mod = dmo.model() #mod = tridome(mod) mod = house(mod) ax = dtl.plot_axes() for gmesh in mod.gfxmeshes: for f in gmesh.faces: ps = mod.gvps(gmesh,f) ax = dtl.plot_polygon(ps,ax) plt.show() print('build2 cube now') build2(mod,**kwargs)
def teststage(**kwargs): mod = dmo.model() #mod = tridome(mod) mod = house(mod) ax = dtl.plot_axes() for gmesh in mod.gfxmeshes: for f in gmesh.faces: ps = mod.gvps(gmesh, f) ax = dtl.plot_polygon(ps, ax) plt.show() print('build2 cube now') build2(mod, **kwargs)
def break_polygon(py,p2s,subop = 'union'): breakers = [x for x in range(len(p2s))] broken = [dpr.copy_polygon(py)] pieces = [] while broken: piece = broken.pop(0) eb1,ibs1 = piece ebn1 = dpr.polygon_normal(eb1) brokeone = False for x in breakers: breaker = p2s[x] eb2,ibs2 = breaker ebn2 = dpr.polygon_normal(eb2) pj1 = dpv.project_coords(list(eb1),ebn1) pj2 = dpv.project_coords(list(eb2),ebn1) if dpr.isnear(pj2.x,pj2.y): if not dpr.isnear(pj1.x,pj2.x): print('disjoint polygons!') else: if subop == 'union': pu = dtl.polygon_union(piece,breaker) elif subop == 'intersection': pu = dtl.polygon_intersection(piece,breaker) elif subop == 'difference': pu = dtl.polygon_difference(piece,breaker) else:print('unknown subop!',subop) print('known subop!',subop) print('coplanar polygons!',pu) if not pu is None: ax = dtl.plot_axes() #dtl.plot_polygon_full(piece,ax) #dtl.plot_polygon_full(breaker,ax) dtl.plot_polygon(list(pu[0]),ax,lw = 5.0) dtl.plot_polygon(list(pu[1][0]),ax,lw = 1.0) plt.show() #broken.append(pu) pieces.append(pu) print("breaker will continue to intersect this guy...") brokeone = True break else: print('skew polygons') plintersect = dtl.planes_intersection(ebn1,eb1[0],ebn2,eb2[0]) if not plintersect is None: pli1,pli2 = plintersect intins = subop == 'difference' #intins = dpr.inconcave_xy(dpv.midpoint(pli1,pli2),eb2) #print('inis',subop,intins) breakersect = dtl.line_intersects_polygon_at( pli1,pli2,breaker,intins) if not breakersect is None: if not len(breakersect) == 2: print('breakersect is confusing!!') ax = dtl.plot_axes() dtl.plot_polygon_full(breaker,ax) dtl.plot_line(pli1,pli2,25,ax,lw = 4.0) for x in range(len(breakersect)): dtl.plot_point(breakersect[x],ax) plt.show() pdb.set_trace() b1,b2 = breakersect lsp = dtl.segment_split_polygon(b1,b2,piece) if not lsp is None: '''# print('lsssspppp',len(lsp)) ax = dtl.plot_axes() dtl.plot_line(b1,b2,25,ax,lw = 8.0) for ls in lsp: ax = dtl.plot_polygon_full(ls,ax,lw = 1.0) ax = dtl.plot_polygon_full(breaker,ax,lw = 3.0) plt.show() '''# broken.extend(lsp) brokeone = True #pdb.set_trace() break if not brokeone: pieces.append(piece) print('nice piece',len(pieces)) '''# if len(pieces) > 1: print('broke some shit??') ax = dtl.plot_axes() for p in pieces:dtl.plot_polygon_full(p,ax) plt.show() '''# return pieces
def plot(self, ax=None): ax = dgr.graph.plot(self, ax) dtl.plot_polygon(list(self.boundary), ax) return ax
def plot(self,ax = None): ax = dgr.graph.plot(self,ax) dtl.plot_polygon(list(self.boundary),ax) return ax
def plot_boundary(self,layer,ax = None): if ax is None:ax = dtl.plot_axes() bnd = [b.copy().translate_z(20*layer) for b in self.boundary] dtl.plot_polygon(bnd,ax) return ax
def plot_boundary(self, layer, ax=None): if ax is None: ax = dtl.plot_axes() bnd = [b.copy().translate_z(20 * layer) for b in self.boundary] dtl.plot_polygon(bnd, ax) return ax