Beispiel #1
0
 def pts(S):
     shape = deepcopy(S.G['pts'])
     C = aff.Center(shape)
     shape = aff.Translate(shape, -C[0], -C[1], -C[2])
     shape = aff.Rotate(shape, S.P.q)
     shape = aff.Translate(shape, S.P.x[0], S.P.x[1], S.P.x[2])
     return shape
Beispiel #2
0
def WaterBottleScene(G,Gs,t,q,s):
     f_ = open(BIGDATA+"WaterBottle.obj",'r')
     txt = f_.read()
     f_.close()
     G_small = ext.OBJ2Graph(txt)
     pts = G_small['pts']
     C = aff.Center(pts)
     pts = aff.Translate(pts,-C[0],-C[1],-C[2],align=False)
     G_small['pts'] = pts

     # Add special textbook to scene
     pts2 = G_sp['pts']
     C2 = aff.Center(pts2)
     pts2 = aff.Translate(pts2,-C2[0],-C2[1],-C2[2],align=False)
     degrees = 90+30
     axis = [0,0,1]
     q_sp = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
     pts2 = aff.Rotate(pts2,q_sp,align=False)
     t2 = [180.,180.,rec_sp.d/2.]
     pts2 = aff.Translate(pts2,t2[0],t2[1],t2[2],align=False)
     G_sp['pts'] = pts2
     
     G_small = GraphUnionS(G_small,G_sp)

     pts = G_small['pts']
     C = aff.Center(pts)
     pts = aff.Translate(pts,-C[0],-C[1],-C[2],align=False)
     pts = aff.Rotate(pts,q,align=False)
     pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
     pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
     G_small['pts'] = pts
     Gs = Append(Gs,G_small)
     G = GraphUnionS(G,G_small)
     return G,Gs
Beispiel #3
0
def TrefoilKnot():
     from math import cos,sin,pi
     
     pts = [[0,0,0],[10,0,0],[10,10,0],[0,10,0]]
     doc1 = g.Cn(len(pts))
     doc1['pts'] = pts
     
     t = 0
     dt = .04
     path = []
     while t <= 2*pi + dt:
          # https://en.wikipedia.org/wiki/Trefoil_knot
          x = sin(t) + 2*sin(2*t)
          y = cos(t) - 2*cos(2*t)
          z = -sin(3*t)
          pt = [x,y,z]
          path.append(pt)
          t = t + dt

     C = aff.Center(path)
     degrees = 30
     axis = [0,0,1]
     q = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
     s = [20,20,20] # the same scale as previous for caps
     t = [20,0,0]
     pts = aff.Translate(path,-C[0],-C[1],-C[2],align=False)
     pts = aff.Rotate(pts,q,align=False)
     pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
     pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
     path = pts
     #path = [[0,0,0],[10,1,0],[20,4,0],[30,9,0]]
     H = Extrusion(doc1,path)
     return H
Beispiel #4
0
def Wire(r, ppath, t, q, s, m=10, n=40):
    H = Wire0(r, ppath, m=m, n=n)
    pts = H['pts']
    C = aff.Center(pts)
    pts = aff.Translate(pts, -C[0], -C[1], -C[2], align=False)
    pts = aff.Rotate(pts, q, align=False)
    pts = aff.Scale(pts, s[0], s[1], s[2], align=False)
    pts = aff.Translate(pts, t[0], t[1], t[2], align=False)
    H['pts'] = pts
    return H
Beispiel #5
0
def Torus(r1,r2,t,q,s,m=10,n=40):
    H = Torus0(r1,r2,m=m,n=n)
    pts = H['pts']
    C = aff.Center(pts)
    pts = aff.Translate(pts,-C[0],-C[1],-C[2],align=False)
    pts = aff.Rotate(pts,q,align=False)
    pts = aff.Scale(pts,s[0],s[1],s[2],align=False)
    pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
    H['pts'] = pts
    return H
Beispiel #6
0
def Helix(r, a, b, t, q, s, m=10, n=40, N=1):
    H = Helix0(r, a, b, m=m, n=n, N=N)
    pts = H['pts']
    C = aff.Center(pts)
    pts = aff.Translate(pts, -C[0], -C[1], -C[2], align=False)
    pts = aff.Rotate(pts, q, align=False)
    pts = aff.Scale(pts, s[0], s[1], s[2], align=False)
    pts = aff.Translate(pts, t[0], t[1], t[2], align=False)
    H['pts'] = pts
    return H
Beispiel #7
0
def ElevationMap(im, w, h, d, t, q, s, m=10):
    H = ElevationMap0(im, w, h, d, m=m)
    pts = H['pts']
    C = aff.Center(pts)
    pts = aff.Translate(pts, -C[0], -C[1], -C[2], align=False)
    pts = aff.Rotate(pts, q, align=False)
    pts = aff.Scale(pts, s[0], s[1], s[2], align=False)
    pts = aff.Translate(pts, t[0], t[1], t[2], align=False)
    H['pts'] = pts
    return H
Beispiel #8
0
def RevolveCurve(curve, t, q, s, n=20, bcap=True, ecap=True):
    # Assume curve has symmetry y-axis
    x0 = curve[0][0]
    x_min = min([pt[0] - x0 for pt in curve])
    x_max = max([pt[0] - x0 for pt in curve])
    y_min = min([pt[1] for pt in curve])
    y_max = max([pt[1] for pt in curve])
    poly_wb = deepcopy(curve)

    pts = [[0, pt[1], 0] for pt in poly_wb]
    y_min = min([pt[1] for pt in poly_wb])
    y_max = max([pt[1] for pt in poly_wb])
    doc = g.Cn(n)
    cx, cy, cz = [0, 0, 0]
    r0 = 1.
    doc1 = CreateCircleGeometry(doc, cx, cy, cz, r0)

    spath = []
    path = []
    pti = poly_wb[0]
    xi, yi = pti
    yi_last = yi

    dx = x_max - x_min
    dy = y_max - y_min
    epsilon = 1e-4
    if abs(dx) > epsilon:
        aspect = 1. * dy / dx
    else:
        aspect = 1. * dx / dy

    for i in range(len(poly_wb)):
        pti = poly_wb[i]
        xi, yi = pti
        r = abs(xi - x0)
        dy = yi - yi_last
        epsilon = .1
        if abs(dy) > epsilon:
            spath.append(r)
            path.append([yi, 0, 0])
        yi_last = yi

    degrees = 90
    axis = [0, 1, 0]
    q0 = aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
    q = q * q0
    C = aff.Center(path)
    pts = aff.Translate(path, -C[0], -C[1], -C[2], align=False)
    pts = aff.Rotate(pts, q, align=False)
    pts = aff.Scale(pts, s[0], s[1], s[2], align=False)
    pts = aff.Translate(pts, t[0], t[1], t[2], align=False)
    path = pts
    #path = [[0,0,0],[10,1,0],[20,4,0],[30,9,0]]
    H = ext.Extrusion0(doc1, path, spath, bcap, ecap)
    return H
Beispiel #9
0
 def Leg(t,q,s):
     height = w*(3./5.)
     r1 = 8.
     r2 = 12.
     H = TableLeg(height,r1,r2,n=10,m=10)
     pts = H['pts']
     C = aff.Center(pts)
     pts = aff.Translate(pts,-C[0],-C[1],-C[2],align=False)
     pts = aff.Rotate(pts,q,align=False)
     pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
     pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
     H['pts'] = pts
     return H
Beispiel #10
0
def BodyGraph(G, Gs, Gseg, t, q, s):
    H = {}
    H['V'] = []
    H['E'] = []
    H['F'] = []
    H['N'] = []
    H['pts'] = []
    degrees = 90
    axis = [0, 1, 0]
    q0 = aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
    A = Gseg['pts'][0]
    Hf = ext.CubeObj(300, 5, 300, A, q0, s)
    H = ext.GraphUnionS(H, Hf)
    for e in Gseg['E']:
        u, v = e
        A, B = [Gseg['pts'][w] for w in e]
        v1 = np.array(B) - np.array(A)
        v1n = np.linalg.norm(v1)
        epsilon = 1e-5
        if abs(v1n) < epsilon:
            continue
        v1 = v1 / np.linalg.norm(v1)
        axis1 = [1, 0, 0]
        axis2 = list(v1)
        q1 = ext.AimAxis(axis1, axis2)
        q1 = q1 * q0

        r = 10
        h = d(A, B)
        t0 = list(np.array(A) + h / 2. * v1)
        s0 = [1, 1, 1]
        He = bs.Cylinder(r, h, t0, q1, s0, n=10, m=10)
        H = ext.GraphUnionS(H, He)
        Hf = bs.Sphere(40, A, q1, s0, n=10, m=10)
        H = ext.GraphUnionS(H, Hf)
    #Hf = bs.Cone(60,150,B,q1,s0,n=10,m=10)
    #H = ext.GraphUnionS(H,Hf)
    degrees = 0  # 180
    axis = [0, 0, 1]
    q2 = aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
    q = q * q2
    pts = H['pts']
    C = Gseg['pts'][0]
    pts = aff.Translate(pts, -C[0], -C[1], -C[2])
    pts = aff.Rotate(pts, q)
    pts = aff.Scale(pts, s[0], s[1], s[2])
    pts = aff.Translate(pts, t[0], t[1], t[2])
    H['pts'] = pts
    return H
Beispiel #11
0
def CoffeeCup(n=30):
    H = CoffeeCup0(n)
    pts = H['pts']
    scale = .15
    s = [scale,scale,scale] # the same scale as previous for caps
    t = [0,0,0]
    degrees = 0
    axis = [0,1,0]
    q = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
    C = aff.Center(pts)
    pts = aff.Translate(pts,-C[0],-C[1],-C[2],align=False)
    pts = aff.Rotate(pts,q,align=False)
    pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
    pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
    H['pts'] = pts
    return H
def WaterBottle():
    global poly_wb
    pts = [[0, pt[1], 0] for pt in poly_wb]
    y_min = min([pt[1] for pt in poly_wb])
    y_max = max([pt[1] for pt in poly_wb])
    n = 10
    doc = g.Cn(n)
    cx, cy, cz = [0, 0, 0]
    r = 1.
    doc1 = CreateCircleGeometry(doc, cx, cy, cz, r)

    spath = []
    path = []
    pti = poly_wb[0]
    xi, yi = pti
    yi_last = yi
    sy = 33. / (y_max - y_min)
    for i in range(len(poly_wb)):
        pti = poly_wb[i]
        xi, yi = pti
        r = abs(xi - x0)
        dy = yi - yi_last
        epsilon = .1
        if abs(dy) > epsilon:
            spath.append(r)
            path.append([yi * sy, 0, 0])
        yi_last = yi

    C = aff.Center(path)
    degrees = 90
    axis = [0, 1, 0]
    q = aff.HH.rotation_quaternion(degrees, axis[0], axis[1], axis[2])
    s = [20, 20, 20]  # the same scale as previous for caps
    t = [20, 0, 0]
    pts = aff.Translate(path, -C[0], -C[1], -C[2], align=False)
    pts = aff.Rotate(pts, q, align=False)
    pts = aff.Scale(pts, s[0], s[1], s[2], align=False)
    pts = aff.Translate(pts, t[0], t[1], t[2], align=False)
    path = pts
    #path = [[0,0,0],[10,1,0],[20,4,0],[30,9,0]]
    H = ext.Extrusion0(doc1, path, spath)
    return H
Beispiel #13
0
def CubeObj(w,h,d, t,q,s):
    G = Cube(w,h,d)
    pts = deepcopy(G['pts'])
    C = aff.Center(pts)
    #pts = aff.Translate(pts,-C[0],-C[1],-C[2])
    pts = aff.Rotate(pts,q,align=True)
    pts = aff.Scale(pts, s[0],s[1],s[2],align=True)
    pts = aff.Translate(pts,t[0],t[1],t[2],align=True)
    G['pts'] = pts
    #print "C=",C
    return G   
Beispiel #14
0
G['N'] = []
G['pts'] = []
Gs = []

# trefoil knot
H0 = ext.TrefoilKnot()
degrees = 0
axis = [0,1,0]
q = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
scale = 1.
s = [scale,scale,scale] # the same scale as previous for caps
t = [-80,0,50.]
pts = H0['pts']
q = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
C = aff.Center(pts)
pts = aff.Translate(pts,-C[0],-C[1],-C[2],align=False)
pts = aff.Rotate(pts,q,align=False)
pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
H0['pts'] = pts
Gs = ext.Append(Gs,H0)
G = ext.GraphUnionS(G,H0)

# square table
H1 = SquareTable1()
Gs = ext.Append(Gs,H1)
G = ext.GraphUnionS(G,H1)

# N1 x N2 water bottles
N1 = 1
N2 = 1
Beispiel #15
0
def Extrusion0(G,path, spath, bcap=True,ecap=True,closed=False):
    m = len(G['V'])
    n = len(path)
    k = n
    assert(n>=3)
    H = ExtrudeGraph(G,k)
    C = aff.Center(G['pts'])
    C = np.array(C)
    pts = []
    F = []
    N = []
    G0 = deepcopy(G)
    G0['F'] = [G['V'][:3]]
    N0 = FaceNormal(G0,0)
    nn = n-1
    if closed:
         nn = n
    for i in range(n-1):
        A = np.array(path[i])
        B = np.array(path[(i+1)%n])
        vB = B - A
        axis1 = N0
        axis2 = list(vB)
        q_k = AimAxis(axis1,axis2)
        s_k = [spath[i],spath[i],spath[i]]
        t_k = list(A)
        pts_k = deepcopy(G['pts'])
        C_k = aff.Center(pts_k)
        pts_k = aff.Translate(pts_k,-C_k[0],-C_k[1],-C_k[2],align=False)
        pts_k = aff.Rotate(pts_k,q_k,align=False)
        pts_k = aff.Scale(pts_k, s_k[0],s_k[1],s_k[2],align=False)
        pts_k = aff.Translate(pts_k,t_k[0],t_k[1],t_k[2],align=False)
        pts = pts + pts_k
    pts_k = deepcopy(G['pts'])
    C_k = aff.Center(pts_k)
    # use last q_k
    s_k = [1,1,1]
    # use last B
    t_k = list(B)
    pts_k = aff.Translate(pts_k,-C_k[0],-C_k[1],-C_k[2],align=False)
    pts_k = aff.Rotate(pts_k,q_k,align=False)
    pts_k = aff.Scale(pts_k, s_k[0],s_k[1],s_k[2],align=False)
    pts_k = aff.Translate(pts_k,t_k[0],t_k[1],t_k[2],align=False)
    pts = pts + pts_k
    for i in range(n-1):
         for e in G['E']:
              u1,v1 = map(lambda u: u + m*i,e)
              u2,v2 = map(lambda u: u + m*(i+1),e)
              f = [u1,u2,v2,v1]
              f1 = [u1,u2,v1]
              f2 = [v1,u2,v2]
              for fi in [f1,f2]:
                   G_f = ExtrudeGraph(G,2)
                   f2i = map(lambda u: u - m*i, fi)
                   G_f['F'] = [deepcopy(f2i)]
                   G_f['pts'] = deepcopy(pts[i*m:(i+2)*m])
                   N_fi = FaceNormal(G_f,0)
                   F.append(fi)
                   N.append(N_fi)
    # add caps onto ends
    flag_a = bcap # begin cap
    flag_b = ecap # end cap
    if flag_a and use_tripy:
         pts_0 = pts[:m]
         C_k = aff.Center(pts_0)
         axis1 = N0
         axis2 = list(vB)
         q_k = AimAxis(axis1,axis2)
         s_k = [1,1,1] # the same scale as previous for caps
         pts_k = aff.Translate(pts_0,-C_k[0],-C_k[1],-C_k[2],align=False)
         pts_k = aff.Rotate(pts_k,q_k,align=False)
         pts_k = aff.Scale(pts_k, s_k[0],s_k[1],s_k[2],align=False)
         pts_k = aff.Translate(pts_k,C_k[0],C_k[1],C_k[2],align=False)
         z_k = pts_k[0][2]
         pts_k = map(lambda pt: pt[:2], pts_k)
         tris = Triangulate(pts_k)
         for tri in tris:
              f = map(lambda u: u + 0*m, tri)
              F.append(f)
              A,B,C = map(lambda u: pts_k[u], tri)
              Nk = FaceNormalABC(A,B,C)
              N.append(Nk) # some normal N0
              a,b,c = f
              e1 = [a,b]
              e2 = [b,c]
              e3 = [c,a]
              if e1 not in H['E']:
                   H['E'].append(e1)
              if e2 not in H['E']:
                   H['E'].append(e2)
              if e3 not in H['E']:
                   H['E'].append(e3)
    if flag_b and use_tripy:
         pts_0 = pts[-m:]
         C_k = aff.Center(pts_0)
         s_k = [1,1,1] # the same scale as previous for caps
         t_k = list(B)
         pts_k = aff.Translate(pts_0,-C_k[0],-C_k[1],-C_k[2],align=False)
         pts_k = aff.Scale(pts_k, s_k[0],s_k[1],s_k[2],align=False)
         pts_k = aff.Translate(pts_k,C_k[0],C_k[1],C_k[2],align=False)
         z_k = pts_k[0][2]
         pts_k = map(lambda pt: pt[:2], pts_k)
         tris = Triangulate(pts_k)
         for tri in tris:
              f = map(lambda u: u + (n-1)*m, tri)
              F.append(f)
              A,B,C = map(lambda u: pts_k[u], tri)
              Nk = FaceNormalABC(A,B,C)
              N.append(Nk) # some normal N0
              a,b,c = f
              e1 = [a,b]
              e2 = [b,c]
              e3 = [c,a]
              if e1 not in H['E']:
                   H['E'].append(e1)
              if e2 not in H['E']:
                   H['E'].append(e2)
              if e3 not in H['E']:
                   H['E'].append(e3)

    H['pts'] = pts
    H['F'] = F
    H['N'] = N
    return H
Beispiel #16
0
def TableLeg(height,radius1,radius2,n=10,m=10):
    h = height
    r1 = radius1
    r2 = radius2
    curve = []
    x0 = 0
    for i in range(1,m-1):
        r = mapto.MapTo(0,r1,m-1,r2,i)
        xi = r
        yi = mapto.MapTo(0,0,m-1,h,i)
        pt = [xi,yi]
        curve.append(pt)
    yi = mapto.MapTo(0,0,m-1,h,.1)
    curve = [[0,yi]]+curve+[[0,height]]

    # Assume curve has symmetry y-axis
    x0 = curve[0][0]
    x_min = min(map(lambda pt: pt[0]-x0,curve))
    x_max = max(map(lambda pt: pt[0]-x0,curve))
    y_min = min(map(lambda pt: pt[1],curve))
    y_max = max(map(lambda pt: pt[1],curve))
    poly_wb = deepcopy(curve)

    pts = map(lambda pt: [0,pt[1],0], poly_wb)
    y_min = min(map(lambda pt: pt[1],poly_wb))
    y_max = max(map(lambda pt: pt[1],poly_wb))
    doc = g.Cn(n)
    cx,cy,cz = [0,0,0]
    r0 = 1.
    doc1 = rc.CreateCircleGeometry(doc,cx,cy,cz,r0)

    spath = []
    path = []
    pti = poly_wb[0]
    xi,yi = pti
    yi_last = yi
    
    dx = x_max-x_min
    dy = y_max-y_min
    epsilon = 1e-4
    if abs(dx) > epsilon:
        aspect = 1.*dy/dx
    else:
        aspect = 1.*dx/dy

    for i in range(len(poly_wb)):
        pti = poly_wb[i]
        xi,yi = pti
        r = abs(xi - x0)
        dy = yi-yi_last
        epsilon = .1
        if abs(dy) > epsilon:
            spath.append(r)
            path.append([yi,0,0])
        yi_last = yi

    degrees = 90+180
    axis = [0,1,0]
    q0 = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
    q = q0
    t = [0,0,-height*.4]
    s = [1,1,1]
    C = aff.Center(path)
    pts = aff.Translate(path,-C[0],-C[1],-C[2],align=False)
    pts = aff.Rotate(pts,q,align=False)
    pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
    pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
    path = pts
    #path = [[0,0,0],[10,1,0],[20,4,0],[30,9,0]]
    H = ext.Extrusion0(doc1,path,spath)
    return H
Beispiel #17
0
def CoffeeCup0(n=30,m=20,r0=20.):
    flag_cup = True
    flag_handle = True
    H1 = {}
    H1['V'] = []
    H1['E'] = []
    H1['pts'] = []
    H1['F'] = []
    H1['N'] = []
    H2 = {}
    H2['V'] = []
    H2['E'] = []
    H2['pts'] = []
    H2['F'] = []
    H2['N'] = []
    if flag_cup:
         # polygon curve of surface of revolution
         # Create Cup. At present, its imperfect recreating
         # a cover to coffee cup.
         curve1a = [[406, 388], [441, 384], [469, 378], [489, 363], [506, 347],
                   [518, 330], [520, 314], [522, 297], [525, 276], [528, 258],
                   [530, 228], [528, 182], [528, 150], [527, 113], [527, 91],
                   [532, 73], [540, 68]]
         curve1b = [[554, 70], [554, 86], [549, 108],
                   [550, 136], [546, 181], [547, 214], [544, 249], [544, 268],
                   [538, 281], [540, 288], [539, 300], [531, 312], [532, 329],
                   [526, 350], [513, 362], [502, 378], [482, 393], [446, 406],
                   [417, 409]]
         curve1 = curve1a + curve1b
         x0 = curve1[0][0]
         
         x_min = min(map(lambda pt: pt[0]-x0,curve1))
         x_max = max(map(lambda pt: pt[0]-x0,curve1))
         y_min = min(map(lambda pt: pt[1],curve1))
         y_max = max(map(lambda pt: pt[1],curve1))
         degrees = 0
         axis = [0,1,0]
         q = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
         scale = 1.
         s = [scale,scale,scale] # the same scale as previous for caps
         t = [0,0,0]
         H1 = rc.RevolveCurve(curve1,t,q,s, n, bcap=False, ecap=False)
    if flag_handle:
         # Create Handle
         curve2 = [[203, 130], [189, 114], [165, 102], [149, 100], [132, 101],
                   [116, 106], [106, 113], [107, 128], [112, 152], [118, 169],
                   [127, 184], [138, 201], [149, 208], [165, 209], [186, 214],
                   [207, 213]]
         # Assume curve has symmetry y-axis
         x0 = curve2[0][0]
         x_min = min(map(lambda pt: pt[0]-x0,curve2))
         x_max = max(map(lambda pt: pt[0]-x0,curve2))
         y_min = min(map(lambda pt: pt[1],curve2))
         y_max = max(map(lambda pt: pt[1],curve2))
         poly_wb = deepcopy(curve2)

         pts = map(lambda pt: [0,pt[1],0], poly_wb)
         y_min = min(map(lambda pt: pt[1],poly_wb))
         y_max = max(map(lambda pt: pt[1],poly_wb))
         doc = g.Cn(m)
         cx,cy,cz = [0,0,0]
         doc1 = rc.CreateCircleGeometry(doc,cx,cy,cz,r0)

         spath = []
         path = []
         pti = poly_wb[0]
         xi,yi = pti
         yi_last = yi
         
         dx = x_max-x_min
         dy = y_max-y_min

         for i in range(len(poly_wb)):
             pti = poly_wb[i]
             xi,yi = pti
             r = abs(xi - x0)
             dy = yi-yi_last
             epsilon = .1
             if abs(dy) > epsilon:
                 spath.append(1.)
                 path.append([xi,yi,0])

         degrees = 90+180
         axis = [1,0,0]
         q0 = aff.HH.rotation_quaternion(degrees,axis[0],axis[1],axis[2])
         q = q0
         t = [-184,0,100]
         s = [1,1,1]
         C = aff.Center(path)
         pts = aff.Translate(path,-C[0],-C[1],-C[2],align=False)
         pts = aff.Rotate(pts,q,align=False)
         pts = aff.Scale(pts, s[0],s[1],s[2],align=False)
         pts = aff.Translate(pts,t[0],t[1],t[2],align=False)
         path = pts
         H2 = ext.Extrusion0(doc1,path,spath)

    H = ext.GraphUnionS(H1,H2)
    
    return H