예제 #1
0
파일: road.py 프로젝트: ctogle/dilapidator
    def _geo(self):
        self.lnstocenter = self._lanestocenter()
        #m = dtm.meshme(pts,None,None,None,[],tris)
        m = dmo.model()

        lpt1, lpt2 = self._geo_pair(0)
        m._consume(dcu.cube().translate(lpt1).translate_z(0.5))
        m._consume(dcu.cube().translate(lpt2).translate_z(0.5))

        lrow = [lpt1]
        rrow = [lpt2]

        for pdx in range(1, len(self.road.vertices)):
            pt1, pt2 = self._geo_pair(pdx)

            m._quad(pt1, pt2, lpt2, lpt1)

            lpt1, lpt2 = pt1, pt2
            lrow.append(lpt1)
            rrow.append(lpt2)

            m._consume(dcu.cube().translate(pt1).translate_z(0.5))
            m._consume(dcu.cube().translate(pt2).translate_z(0.5))
        self.leftrow = lrow
        self.rightrow = rrow
        return m
예제 #2
0
파일: shaft.py 프로젝트: ctogle/dilapidator
    def generate_uturn(self,level):
        l,w,fh,wh,ch = self._params(level)

        p1h = fh;p1l = l;p1w = 3.0
        p1x = 0.0;p1y = (p1w - w)/2.0;p1z = 0
        pform1 = dcu.cube().translate_z(0.5)
        pform1.scale(dpv.vector(p1l,p1w,p1h))
        pform1.translate(dpv.vector(p1x,p1y,p1z))
        pform1._project_uv_flat()

        p2h = ch;p2l = l;p2w = 3.0
        p2x = 0.0;p2y = (p2w - w)/2.0;p2z = wh - ch
        pform2 = dcu.cube().translate_z(0.5)
        pform2.scale(dpv.vector(p2l,p2w,p2h))
        pform2.translate(dpv.vector(p2x,p2y,p2z))
        pform2._project_uv_flat()

        gap = l/4.0
        s = int(wh)
        rw = 2.0*gap
        rl = w - 2.0*p1w
        diff = wh/2.0
        rwoffx = l/2.0 - rw/2.0
        rwoffy = rl/2.0
        sheight = diff/s

        p3h = 2.0*sheight;p3l = l;p3w = 3.0
        p3x = 0.0;p3y = (w - p3w)/2.0;p3z = diff
        #p3x = 0.0;p3y = (w - p3w)/2.0;p3z = diff-sheight
        # this next line is suspect
        pform3 = dcu.cube().translate_z(0.25)  
        pform3.scale(dpv.vector(p3l,p3w,p3h))
        pform3.translate(dpv.vector(p3x,p3y,p3z))
        pform3._project_uv_flat()

        extra = dcu.cube().translate_z(0.5)
        extra.scale(dpv.vector(gap,rl,wh))
        extra.translate(dpv.vector(0,0,0))
        extra._project_uv_flat()

        sopts1 = {'steps':s,'l':rl,'w':rw,'h':diff}
        sopts2 = {'steps':s,'l':rl,'w':rw,'h':diff}
        lside = ds.stairs(**sopts1)
        rside = ds.stairs(**sopts2)
        lside.rotate_z(dpr.PI).translate_y(rl).translate_z(diff)
        #lside.translate_x(-rwoffx).translate_y(-rwoffy).translate_z(fh-sheight)
        #rside.translate_x( rwoffx).translate_y(-rwoffy).translate_z(fh-sheight)
        lside.translate_x(-rwoffx).translate_y(-rwoffy).translate_z(fh)
        rside.translate_x( rwoffx).translate_y(-rwoffy).translate_z(fh)
        lside._project_uv_flat()
        rside._project_uv_flat()
        if level == self.stories - 1:final = dmo.combine([pform1,extra])
        else:final = dmo.combine([pform1,pform2,pform3,lside,rside,extra])
        return self._node_wrap(final)
예제 #3
0
 def _geo(self):
     w,ww,bh = self.w,self.wall.w,self.wall.h-self.h-self.z
     bottom = dcu.cube().translate_z(0.5)
     bottom.scale_x(w).scale_y(ww).scale_z(bh)
     bottom.rotate(dpq.q_from_uu(dpv.x(),self.wall.tangent))
     bottom._project_uv_flat()
     th = self.wall.h-self.h-bh
     top = dcu.cube().translate_z(0.5)
     top.scale_x(w).scale_y(ww).scale_z(th)
     top.translate_z(bh+self.h)
     top.rotate(dpq.q_from_uu(dpv.x(),self.wall.tangent))
     top._project_uv_flat()
     self._consume(bottom)._consume(top)
예제 #4
0
파일: house.py 프로젝트: ctogle/dilapidator
 def generate_stoop(self, worn=0):
     s = self.stoop
     cub = dcu.cube()
     cub.scale_x(s[0]).scale_y(s[1]).scale_z(s[2])
     cub.translate_y(-(10 + 1.5)).translate_z(-s[2] / 2.0)
     stoopnode = self._node_wrap(cub)
     stoopnode = self._node_consume(self._node_wrap(cub))
     self._nodes_to_graph(stoopnode)
예제 #5
0
파일: door.py 프로젝트: ctogle/dilapidator
 def _geo(self):
     w, ww, th = self.w, self.wall.w, self.wall.h - self.h - self.z
     top = dcu.cube().translate_z(0.5)
     top.scale_x(w).scale_y(ww).scale_z(th)
     top.translate_z(self.z + self.h)
     top.rotate(dpq.q_from_uu(dpv.x(), self.wall.tangent))
     top._project_uv_flat()
     self._consume(top)
예제 #6
0
파일: door.py 프로젝트: ctogle/dilapidator
 def _geo(self):
     w,ww,th = self.w,self.wall.w,self.wall.h-self.h-self.z
     top = dcu.cube().translate_z(0.5)
     top.scale_x(w).scale_y(ww).scale_z(th)
     top.translate_z(self.z+self.h)
     top.rotate(dpq.q_from_uu(dpv.x(),self.wall.tangent))
     top._project_uv_flat()
     self._consume(top)
예제 #7
0
파일: tmesh.py 프로젝트: ctogle/dilapidator
 def skeleton(self):
     s = dmo.model()
     for v in self.vs:
         m = dcu.cube().scale(dpv.one().scale_u(0.1)).translate(v.p)
         s._consume(m)
     for e in self.es:
         cq = dpq.q_from_uu(dpv.zhat,
             dpv.v1_v2(self.vs[e[0]].p,self.vs[e[1]].p))
         c = dcy.cylinder().translate_z(0.5)
         c.scale_x(0.05).scale_y(0.05).rotate(cq)
         c.translate(self.vs[e[0]].p)
         s._consume(c)
     return s
예제 #8
0
    def generate(self,seed,igraph,worn = 0):
        self._nodes_to_graph(self._node_wrap(
            dcu.cube().scale_u(10).translate_z(5).translate(seed)))
        self.tpts = [seed]
        self.hpts = []
        self.rpts = dpr.point_ring(100*worn,6)
        dpv.translate_coords(self.rpts,seed)

        rsys = gif.infrastructure(igraph).generate(seed,self.rpts,worn)
        self._consume(rsys)
        self.tpts.extend(rsys._terrain_points())
        self.hpts.extend(rsys._hole_points())

        '''#
        bbs = []
        for rd in rsys.roads:
            lotspace = rd._lotspace(bbs)
            dlot = dlt.lot(lotspace[0],lotspace[1]).generate(worn)
            lsppos,lsprot = lotspace[2],lotspace[3]
            dlot._transform(lsppos,lsprot,dpv.one())
            self._consume(dlot)
        '''#
        return self
예제 #9
0
파일: road.py 프로젝트: ctogle/dilapidator
 def _geo(self):
     m = dcu.cube().translate_z(0.5).scale_x(20).scale_y(20).translate(
         self.p)
     self._consume(m)
예제 #10
0
def cube(l = 1.0):
    cu = dcu.cube()
    cu.scale_u(l)
    return cu
예제 #11
0
def cube(l=1.0):
    cu = dcu.cube()
    cu.scale_u(l)
    return cu
예제 #12
0
    def generate_uturn(self, level):
        l, w, fh, wh, ch = self._params(level)

        p1h = fh
        p1l = l
        p1w = 3.0
        p1x = 0.0
        p1y = (p1w - w) / 2.0
        p1z = 0
        pform1 = dcu.cube().translate_z(0.5)
        pform1.scale(dpv.vector(p1l, p1w, p1h))
        pform1.translate(dpv.vector(p1x, p1y, p1z))
        pform1._project_uv_flat()

        p2h = ch
        p2l = l
        p2w = 3.0
        p2x = 0.0
        p2y = (p2w - w) / 2.0
        p2z = wh - ch
        pform2 = dcu.cube().translate_z(0.5)
        pform2.scale(dpv.vector(p2l, p2w, p2h))
        pform2.translate(dpv.vector(p2x, p2y, p2z))
        pform2._project_uv_flat()

        gap = l / 4.0
        s = int(wh)
        rw = 2.0 * gap
        rl = w - 2.0 * p1w
        diff = wh / 2.0
        rwoffx = l / 2.0 - rw / 2.0
        rwoffy = rl / 2.0
        sheight = diff / s

        p3h = 2.0 * sheight
        p3l = l
        p3w = 3.0
        p3x = 0.0
        p3y = (w - p3w) / 2.0
        p3z = diff
        #p3x = 0.0;p3y = (w - p3w)/2.0;p3z = diff-sheight
        # this next line is suspect
        pform3 = dcu.cube().translate_z(0.25)
        pform3.scale(dpv.vector(p3l, p3w, p3h))
        pform3.translate(dpv.vector(p3x, p3y, p3z))
        pform3._project_uv_flat()

        extra = dcu.cube().translate_z(0.5)
        extra.scale(dpv.vector(gap, rl, wh))
        extra.translate(dpv.vector(0, 0, 0))
        extra._project_uv_flat()

        sopts1 = {'steps': s, 'l': rl, 'w': rw, 'h': diff}
        sopts2 = {'steps': s, 'l': rl, 'w': rw, 'h': diff}
        lside = ds.stairs(**sopts1)
        rside = ds.stairs(**sopts2)
        lside.rotate_z(dpr.PI).translate_y(rl).translate_z(diff)
        #lside.translate_x(-rwoffx).translate_y(-rwoffy).translate_z(fh-sheight)
        #rside.translate_x( rwoffx).translate_y(-rwoffy).translate_z(fh-sheight)
        lside.translate_x(-rwoffx).translate_y(-rwoffy).translate_z(fh)
        rside.translate_x(rwoffx).translate_y(-rwoffy).translate_z(fh)
        lside._project_uv_flat()
        rside._project_uv_flat()
        if level == self.stories - 1: final = dmo.combine([pform1, extra])
        else:
            final = dmo.combine([pform1, pform2, pform3, lside, rside, extra])
        return self._node_wrap(final)