예제 #1
0
def BeispielCode2():    
    cp = CreasePattern()

    cp.nodes = [[0, 0, 0],
                [1, 0, 0],
                [1, 1, 0]]

    cp.crease_lines = [[0, 1],
                       [1, 2],
                       [2, 0]]
    cp.facets = [[0, 1, 2]]
    cp.cnstr_lhs = [[(0, 0, 1.0)],
                    [(0, 1, 1.0)],
                    [(0, 2, 1.0)],
                    [(1, 1, 1.0)],
                    [(1, 2, 1.0)],
                    [(2, 2, 1.0)]]

    cp.cnstr_rhs = [0, 0, 0, 0, 0, 0.5]

    X0 = [0, 0, 0, 0, 0, 0, 0, 0, 0.1]

    X = cp.solve(X0)

    return cp
예제 #2
0
def BeispielCode4():    
    cp = CreasePattern()

    cp.nodes = [[ 0, 0, 1.0 ],
                [ 1, 0, 1.5 ],
                [ 0.5, 0.0, 0.0],
                [ 0.1, 0, 1.05]]

    cp.crease_lines = [[ 0, 1 ],
                       [ 2, 3 ]]
    
    cp.facets = [[0, 1, 3]]

    cp.line_pts = [[3, 0]]
    
    cp.cnstr_lhs = [[(3, 0, 1.0)],
                    [(1, 2, 1.0)],
                    [(1, 1, 1.0)],
                    [(0, 2, 1.0)],
                    [(0, 1, 1.0)],
                    [(2, 0, 1.0)],
                    [(2, 1, 1.0)],
                    [(0, 0, 1.0)]]

    cp.cnstr_rhs = [1.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
    
    X0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0, 0]

    X = cp.solve(X0)

    return cp
예제 #3
0
def BeispielCode3():    
    cp = CreasePattern()

    cp.nodes = [[0, 0, 0],
                [1, 0, 0],
                [1, 1, 0],
                [0.5, 0.3, 0]] #Knoten fuer Grabpoint Element
    cp.crease_lines = [[0, 1],
                       [1, 2],
                       [2, 0]]
    
    cp.facets = [[0, 1, 2]]
    
    cp.grab_pts = [[3, 0]]
    
    cp.cnstr_lhs = [[(0, 0, 1.0)],
                    [(0, 1, 1.0)],
                    [(0, 2, 1.0)],
                    [(1, 1, 1.0)],
                    [(2, 1, 1.0)],
                    [(3, 2, 1.0)]]

    cp.cnstr_rhs = [0, 0, 0, 0, 0, 0.3]

    X0 = [0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0, 0, 0]

    X = cp.solve(X0)

    return cp
예제 #4
0
def twotriangle_stick_cnstr(n_steps = 10, dx = -0.3299999999999):
    """
        This example shows the use of Grabpoints an Sticks in a more complex creasepattern.
    """

    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[ 0, 0, 0 ],
                [ 1, 0, 0 ],
                [ 1, 1, 0],
                [0.667, 0.333, 0],
                [0.66, 0.33, 1],
                [ 0, 1, 0]]

    cp.crease_lines = [[ 0, 1 ],
                       [ 1, 2 ],
                       [ 2, 0 ],
                       [ 3, 4],
                       [ 0, 5],
                       [ 5, 2]]

    cp.facets = [[0, 1, 2 ],
                 [2, 5, 0]]

    cp.grab_pts = [[3, 0]  ]

    cp.cnstr_lhs = [
                    [(0, 0, 1.0)],
                    [(0, 1, 1.0)],
                    [(0, 2, 1.0)],
                    [(1, 1, 1.0)],
                    [(1, 2, 1.0)],
                    [(4, 2, 1.0)],
                    [(4, 0, 1.0)],
                    [(4, 1, 1.0)],
                    [(5, 2, 1.0)]]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0
                    , dx, 0.0, 0.0, 0.0
                    ]

    X = np.zeros((cp.n_dofs,), dtype = float)
    X[1] = 0.01

    print 'initial lengths\n', cp.c_lengths
    print 'initial vectors\n', cp.c_vectors

    print 'initial R\n', cp.get_G(X)
    print 'initial G_du\n', cp.get_G_du(X)

    X = cp.solve(X)

    print '========== results =============='
    print 'solution X\n', X
    print 'final positions\n', cp.get_new_nodes(X)
    print 'final vectors\n', cp.get_new_vectors(X)
    print 'final lengths\n', cp.get_new_lengths(X)

    return cp
예제 #5
0
def triangle_stick_cnstr(n_steps = 10, dx = -0.3299999999999):
    """
        This example shows new options of lines, as beams connected to grabpoints.
        This could be usefull for simulation the crane lifting up the oricrete construction.

    """
    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[ 0, 0, 0 ],
                [ 1, 0, 0 ],
                [ 1, 1, 0],
                [0.667, 0.333, 0],
                [0.1, 0.05, 0],
                [0.66, 0.33, 2]]

    cp.crease_lines = [[ 0, 1 ],
                       [ 1, 2 ],
                       [ 2, 0 ],
                       [ 3, 5]]

    cp.facets = [[0, 1, 2 ]]

    cp.grab_pts = [[3, 0],
                   [4, 0]]

    cp.cnstr_lhs = [[(0, 0, 1.0)],
                    [(0, 1, 1.0)],
                    [(0, 2, 1.0)],
                    [(1, 1, 1.0)],
                    [(1, 2, 1.0)],
                    [(5, 2, 1.0)],
                    [(5, 0, 1.0)],
                    [(5, 1, 1.0)]]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0
                    , dx, 0.0, 0.0]

    X = np.zeros((cp.n_dofs,), dtype = float)
    X[1] = 0.01

    print 'initial lengths\n', cp.c_lengths
    print 'initial vectors\n', cp.c_vectors

    print 'initial R\n', cp.get_G(X)
    print 'initial G_du\n', cp.get_G_du(X)

    X = cp.solve(X)

    print '========== results =============='
    print 'solution X\n', X
    print 'final positions\n', cp.get_new_nodes(X)
    print 'final vectors\n', cp.get_new_vectors(X)
    print 'final lengths\n', cp.get_new_lengths(X)

    return cp
예제 #6
0
def halfcrane_2sticks(n_steps = 10, dx = 1.5):

    """

    """

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 5000)

    cp.nodes = [[ 0, 0, 1.0 ],
                [ 1, 0, 1.15 ],
                [ 0.5, 0.5, -0.5],
                [ 0.5, -0.5, -0.5],
               # [ 0.5, 0, 0.75],
                [ 0.5, 0, 1.075]]

    cp.crease_lines = [[ 0, 1 ],
                       [ 2, 4 ],
                       [ 3, 4]]

    cp.facets = [[0, 1, 4]]

    cp.grab_pts = []

    cp.line_pts = [[4, 0],
                   #[4, 0]
                   ]

    cp.cnstr_lhs = [[(1, 2, 1.0)],
                    [(1, 0, 1.0)],
                    [(1, 1, 1.0)],
                    [(0, 2, 1.0)],
                    [(0, 1, 1.0)],
                    [(2, 0, 1.0), (3, 0, -1.0) ],
                    [(2, 1, 1.0), (3, 1, -1.0)],
                    [(2, 2, 1.0), (3, 2, -1.0)],
                    [(3, 2, 1.0)],
                    [(3, 0, 1.0)]]

    cp.cnstr_rhs = [dx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

    X = np.zeros((cp.n_dofs,), dtype = float)
    X[5] = 0.0001
    X[9] = 0.0001
   # X[10] = 0.01
  #  X[11] = 0.01
    X *= 1
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)

    print 'initial R\n', cp.get_G(X)
    print 'initial dR\n', cp.get_G_du(X)
    #cp.show_iter = True
    X = cp.solve(X)

    return cp
예제 #7
0
def moving_truss_cp_square(n_steps = 40):

    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[ 0, 2, 0 ],
                [ 0, 0, 0 ]]

    cp.crease_lines = [[ 0, 1 ]]

    face_z_0 = CF(Rf = z_ - 0)
    face_x_0 = CF(Rf = x_ - 0)
#    face_xy_135 = CF(Rf = x_ + y_ - 1.0)
#    face_xy_round = CF(Rf = x_**2 + (y_)**2 - 1.0)
#    face_x_1_t = CF(Rf = x_ - 1.0 + 1.99 * t_)
#    argument =  2*3.14159*t_   
#    face_x_1_t = CF(Rf = y_ + 3 + sp.sin(argument))
    face_x_1_t = CF(Rf = y_ - 1.0 * (t_ - 1) * sp.Heaviside(t_ - 1)
                    + 1.0 * (t_ - 3) * sp.Heaviside(t_ - 3)
                    + 1.0 * (t_ - 5) * sp.Heaviside(t_ - 5)
                    - 1.0 * (t_ - 7) * sp.Heaviside(t_ - 7))

    face_y_1_t = CF(Rf = x_ + 1.0 * t_ * sp.Heaviside(t_)
                    - 1.0 * (t_ - 1) * sp.Heaviside(t_ - 1)
                    - 1.0 * (t_ - 3) * sp.Heaviside(t_ - 3)
                    + 1.0 * (t_ - 5) * sp.Heaviside(t_ - 5)
                    + 1.0 * (t_ - 7) * sp.Heaviside(t_ - 7)
                    - 1.0 * (t_ - 8) * sp.Heaviside(t_ - 8))
# +3.14159/2.0    
#    face_x_1_t = CF(Rf = y_ - 1.99 * t_)
    cp.cf_lst = [(face_z_0, [0, 1]),
                    (face_x_0, [0]),
                    (face_x_1_t, [1]),
                    (face_y_1_t, [1])]

    X = np.zeros((cp.n_dofs,), dtype = float)
#    X[1] = 0.01
#    X[0] = 0.01


    print 'initial lengths\n', cp.c_lengths
    print 'initial vectors\n', cp.c_vectors

    print 'initial R\n', cp.get_G(X)
    print 'initial dR\n', cp.get_G_du(X)

    X = cp.solve(X)

    print '========== results =============='
    print 'solution X\n', X
    print 'final positions\n', cp.get_new_nodes(X)
    print 'final vectors\n', cp.get_new_vectors(X)
    print 'final lengths\n', cp.get_new_lengths(X)

    return cp
예제 #8
0
def BeispielCode5():    
    cp = CreasePattern()

    cp.nodes = [[ 0, 0, 0 ],
                [ 1, 0, 0 ]]

    cp.crease_lines = [[ 0, 1 ]]
    
    cp.cnstr_lhs = [[(0, 1, 1.0)],
                    [(0, 2, 1.0)],
                    [(0, 0, 1.0)],
                    [(1, 2, 1.0)],
                    [(0, 1, 0.5), (1, 1, -1.0)]]

    cp.cnstr_rhs = [1.0, 0.0, 0.0, 0.0, 0.0]
    
    X0 = [0, 0, 0, 0, 0.1, 0]

    X = cp.solve(X0)

    return cp
예제 #9
0
def moving_truss_cp_ff_cnstr(n_steps = 10, dx = -1.99):

    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[ 0, 0, 0 ],
                [ 1, 0, 0 ]]

    cp.crease_lines = [[ 0, 1 ]]

    face_z_0 = CF(Rf = z_ - 0)
    face_x_0 = CF(Rf = x_ - 0)
    face_x_1_t = CF(Rf = x_ - 1.0 + 1.99 * t_)
    cp.cf_lst = [(face_z_0, [0, 1]),
                    (face_x_0, [0]),
                    (face_x_1_t, [1])]

    cp.cnstr_lhs = [
                    [(1, 0, 1.0), (1, 1, 1.0)],
                    ]

    cp.cnstr_rhs = [0]

    X = np.zeros((cp.n_dofs,), dtype = float)
    X[1] = 0.01

    print 'initial lengths\n', cp.c_lengths
    print 'initial vectors\n', cp.c_vectors

    print 'initial R\n', cp.get_G(X)
    print 'initial dR\n', cp.get_G_du(X)

    X = cp.solve(X)

    print '========== results =============='
    print 'solution X\n', X
    print 'final positions\n', cp.get_new_nodes(X)
    print 'final vectors\n', cp.get_new_vectors(X)
    print 'final lengths\n', cp.get_new_lengths(X)

    return cp
예제 #10
0
def moving_truss_cp_cnstr(n_steps = 10, dx = -1.99):

    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[ 0, 0, 0 ],
                [ 1, 0, 0 ]]

    cp.crease_lines = [[ 0, 1 ]]

    cp.cnstr_lhs = [
                    [(0, 0, 1.0)],
                    [(0, 2, 1.0)],
                    [(1, 0, 1.0)],
                    [(1, 0, 1.0), (1, 1, 1.0)],
                    [(1, 2, 1.0)]
                    ]

    cp.cnstr_rhs = [0.0, 0.0, dx, 0.0, 0.0]

    X = np.zeros((cp.n_dofs,), dtype = float)
    X[1] = 0.01

    print 'initial lengths\n', cp.c_lengths
    print 'initial vectors\n', cp.c_vectors

    print 'initial R\n', cp.get_G(X)
    print 'initial dR\n', cp.get_G_du(X)

    X = cp.solve(X)

    print '========== results =============='
    print 'solution X\n', X
    print 'final positions\n', cp.get_new_nodes(X)
    print 'final vectors\n', cp.get_new_vectors(X)
    print 'final lengths\n', cp.get_new_lengths(X)

    return cp
예제 #11
0
def rhombus_2x3_grab_points(n_steps = 10, dx = 1.0):
    """
        This example shows a 2x3 rhombus creasepattern.
        It gives exact rules constrain design for an
        unlimited expansion in y-direction.
    """
    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0],
                [0, 1, 0],
                [0, 2, 0],
                [0, 3, 0],
                [1, 0, 0],
                [1, 1, 0],
                [1, 2, 0],
                [1, 3, 0],
                [2, 0, 0],
                [2, 1, 0],
                [2, 2, 0],
                [2, 3, 0],
                [0, 0.5, 0],
                [0, 1.5, 0],
                [0, 2.5, 0],
                [2, 0.5, 0],
                [2, 1.5, 0],
                [2, 2.5, 0],
                [0.5, 0.5, 0],
                [0.5, 1.5, 0],
                [0.5, 2.5, 0],
                [1.5, 0.5, 0],
                [1.5, 1.5, 0],
                [1.5, 2.5, 0],
                [0.5, 0.333, 0],
                [0.5, 0.667, 0],
                [0.5, 1.333, 0],
                [0.5, 1.667, 0],
                [0.5, 2.333, 0],
                [0.5, 2.667, 0],
                [1.5, 0.333, 0],
                [1.5, 0.667, 0],
                [1.5, 1.333, 0],
                [1.5, 1.667, 0],
                [1.5, 2.333, 0],
                [1.5, 2.667, 0]
                ]

    cp.crease_lines = [[0, 4],
                       [0, 12],
                       [0, 18],
                       [1, 5],
                       [1, 12],
                       [1, 13],
                       [1, 18],
                       [1, 19],
                       [2, 6],
                       [2, 13],
                       [2, 14],
                       [2, 19],
                       [2, 20],
                       [3, 7],
                       [3, 14],
                       [3, 20],
                       [4, 8],
                       [4, 18],
                       [4, 21],
                       [5, 9],
                       [5, 18],
                       [5, 19],
                       [5, 21],
                       [5, 22],
                       [6, 10],
                       [6, 19],
                       [6, 20],
                       [6, 22],
                       [6, 23],
                       [7, 11],
                       [7, 20],
                       [7, 23],
                       [8, 15],
                       [8, 21],
                       [9, 15],
                       [9, 16],
                       [9, 21],
                       [9, 22],
                       [10, 16],
                       [10, 17],
                       [10, 22],
                       [10, 23],
                       [11, 17],
                       [11, 23],
                       [12, 18],
                       [13, 19],
                       [14, 20],
                       [15, 21],
                       [16, 22],
                       [17, 23],
                       [18, 21],
                       [19, 22],
                       [20, 23]]

    cp.facets = [[0, 4, 18],
                 [4, 8, 21],
                 [4, 18, 21],
                 [0, 12, 18],
                 [8, 15, 21],
                 [1, 5, 18],
                 [5, 9, 21],
                 [5, 18, 21],
                 [1, 12, 18],
                 [9, 15, 21],
                 [1, 5, 19],
                 [5, 9, 22],
                 [5, 19, 22],
                 [1, 13, 19],
                 [9, 16, 22],
                 [2, 6, 19],
                 [6, 10, 22],
                 [6, 19, 22],
                 [2, 13, 19],
                 [10, 16, 22],
                 [2, 6, 20],
                 [6, 10, 23],
                 [6, 20, 23],
                 [2, 14, 20],
                 [10, 17, 23],
                 [3, 7, 20],
                 [7, 11, 23],
                 [7, 20, 23],
                 [3, 14, 20],
                 [11, 17, 23]
                 ]

    cp.grab_pts = [[24, 0],
                   [25, 5],
                   [26, 10],
                   [27, 15],
                   [28, 20],
                   [29, 25],
                   [30, 1],
                   [31, 6],
                   [32, 11],
                   [33, 16],
                   [34, 21],
                   [35, 26]
                   ]

    cp.cnstr_lhs = [[(5, 0, 1.0)],
                    [(13, 1, 1.0)],

                    [(12, 2, 1.0)],
                    [(13, 2, 1.0)],
                    [(14, 2, 1.0)],
                    [(15, 2, 1.0)],
                    [(16, 2, 1.0)],
                    [(17, 2, 1.0)],

                    [(24, 2, 1.0)],
                    [(24, 2, 1.0), (25, 2, -1.0)],
                    [(24, 2, 1.0), (30, 2, -1.0)],
                    [(24, 2, 1.0), (31, 2, -1.0)],
                    [(24, 1, 1.0), (30, 1, -1.0)],
                    [(24, 0, 1.0), (25, 0, -1.0)],

                    [(24, 0, 1.0), (27, 0, -1.0)],
                    [(26, 1, 1.0), (32, 1, -1.0)],
                    [(24, 2, 1.0), (26, 2, -1.0)],

                    [(24, 0, 1.0), (29, 0, -1.0)],
                    [(28, 1, 1.0), (34, 1, -1.0)]
                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, dx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.00005
    X0[5] = 0.00005
    X0[8] = 0.00005
    X0[11] = 0.00005
    X0[26] = 0.00005
    X0[29] = 0.00005
    X0[32] = 0.00005
    X0[35] = 0.00005
    X0[14] = 0.0003
    X0[17] = 0.0003
    X0[20] = 0.0003
    X0[23] = 0.0003
    X0[56] = 0.00025
    X0[59] = 0.00025
    X0[62] = 0.00025
    X0[65] = 0.00025
    X0[68] = 0.00025
    X0[71] = 0.00025

    X0[74] = 0.0002083
    X0[77] = 0.0002083
    X0[80] = 0.0002083
    X0[83] = 0.0002083
    X0[86] = 0.0002083
    X0[89] = 0.0002083
    X0[92] = 0.0002083
    X0[95] = 0.0002083
    X0[98] = 0.0002083
    X0[101] = 0.0002083
    X0[104] = 0.0002083
    X0[107] = 0.0002083

    X0 *= 1

   # np.set_printoptions(threshold='nan')
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d
    print 'cnstr', len(cp.cnstr_lhs)

    X = cp.solve(X0)
    return cp
예제 #12
0
def rhombus_2x2_grab_points(n_steps = 10, dx = 1.0):
    """
        This example shows a 2x2 rhombus creasepattern.
        It shows how a secon row stabilise the behavior
        of the creasepattern, so the constrains on systempoints
        can be reduced to a minimum.
    """
    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0],
                [0, 1, 0],
                [0, 2, 0],
                [1, 0, 0],
                [1, 1, 0],
                [1, 2, 0],
                [2, 0, 0],
                [2, 1, 0],
                [2, 2, 0],
                [0, 0.5, 0],
                [0, 1.5, 0],
                [2, 0.5, 0],
                [2, 1.5, 0],
                [0.5, 0.5, 0],
                [0.5, 1.5, 0],
                [1.5, 0.5, 0],
                [1.5, 1.5, 0],
                [0.5, 0.333, 0],
                [0.5, 0.667, 0],
                [0.5, 1.333, 0],
                [0.5, 1.667, 0],
                [1.5, 0.333, 0],
                [1.5, 0.667, 0],
                [1.5, 1.333, 0],
                [1.5, 1.667, 0]
                ]

    cp.crease_lines = [[0, 3],
                       [0, 9],
                       [0, 13],
                       [1, 4],
                       [1, 9],
                       [1, 10],
                       [1, 13],
                       [1, 14],
                       [2, 5],
                       [2, 10],
                       [2, 14],
                       [3, 6],
                       [3, 13],
                       [3, 15],
                       [4, 7],
                       [4, 13],
                       [4, 14],
                       [4, 15],
                       [4, 16],
                       [5, 8],
                       [5, 14],
                       [5, 16],
                       [6, 11],
                       [6, 15],
                       [7, 11],
                       [7, 12],
                       [7, 15],
                       [7, 16],
                       [8, 12],
                       [8, 16],
                       [9, 13],
                       [10, 14],
                       [11, 15],
                       [12, 16],
                       [13, 15],
                       [14, 16]]

    cp.facets = [[0, 3, 13],
                 [3, 6, 15],
                 [3, 13, 15],
                 [0, 9, 13],
                 [6, 11, 15],
                 [1, 4, 13],
                 [4, 7, 15],
                 [4, 13, 15],
                 [1, 9, 13],
                 [7, 11, 15],
                 [1, 4, 14],
                 [4, 7, 16],
                 [4, 14, 16],
                 [1, 10, 14],
                 [7, 16, 12],
                 [2, 5, 14],
                 [5, 8, 16],
                 [5, 14, 16],
                 [2, 10, 14],
                 [8, 12, 16]
                 ]

    cp.grab_pts = [[17, 0],
                   [18, 5],
                   [19, 10],
                   [20, 15],
                   [21, 1],
                   [22, 6],
                   [23, 11],
                   [24, 16]
                   ]

    cp.cnstr_lhs = [
                    #[(11, 1, 1.0)],
                    #[(12, 2, 1.0)],
                    #[(4, 2, 1.0), (5, 2, -1.0)],
                    #[(0, 0, 1.0), (2, 0, -1.0)],
                    #[(2, 1, 1.0), (5, 1, -1.0)],
                    [(4, 0, 1.0)],
                    [(4, 1, 1.0)],

                    [(9, 2, 1.0)],
                    [(10, 2, 1.0)],
                    [(11, 2, 1.0)],
                    [(12, 2, 1.0)],

                    [(17, 2, 1.0)],
                    [(17, 2, 1.0), (18, 2, -1.0)],
                    [(17, 2, 1.0), (21, 2, -1.0)],
                    [(17, 2, 1.0), (22, 2, -1.0)],
                   # [(11, 1, 1.0)],
                   # [(17, 1, 1.0), (25, 1, -1.0)],
                   # [(17, 0, 1.0), (18, 0, -1.0)],
                   # [(9, 0, 1.0), (10, 0, -1.0)],
                    [(17, 1, 1.0), (21, 1, -1.0)],
                    [(17, 0, 1.0), (18, 0, -1.0)],
                   # [(11, 0, 1.0), (12, 0, -1.0)]

                   # [(17, 1, 1.0), (25, 1, -1.0)],
                    [(17, 2, 1.0), (20, 2, -1.0)],
                    [(19, 1, 1.0), (23, 1, -1.0)],
                    [(17, 0, 1.0), (20, 0, -1.0)]

                    #[(17, 0, 1.0), (18, 0, -1.0)]
                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, dx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.00005
    X0[5] = 0.00005
    X0[8] = 0.00005
    X0[20] = 0.00005
    X0[23] = 0.00005
    X0[26] = 0.00005
    X0[11] = 0.0003
    X0[14] = 0.0003
    X0[17] = 0.0003
    X0[41] = 0.00025
    X0[44] = 0.00025
    X0[47] = 0.00025
    X0[50] = 0.00025

    X0[53] = 0.0002083
    X0[56] = 0.0002083
    X0[59] = 0.0002083
    X0[62] = 0.0002083
    X0[65] = 0.0002083
    X0[68] = 0.0002083
    X0[71] = 0.0002083
    X0[74] = 0.0002083


    X0 *= 1

    np.set_printoptions(threshold = 'nan')
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d
    print 'cnstr', len(cp.cnstr_lhs)

    X = cp.solve(X0)
    return cp
예제 #13
0
def two_rhombus_grab_points(n_steps = 10, dx = 1.0):
    """
        This example shows a 2x1 rhombus creasepattern.
        It shows how an enlargement of the creasepattern
        can reduce constrains.
    """

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0],
                [0, 1, 0],
                [1, 0, 0],
                [1, 1, 0],
                [2, 0, 0],
                [2, 1, 0],
                [0, 0.5, 0],
                [2, 0.5, 0],
                [0.5, 0.5, 0],
                [1.5, 0.5, 0],
                [0.5, 0.333, 0],
                [0.5, 0.667, 0],
                [1.5, 0.333, 0],
                [1.5, 0.667, 0]]

    cp.crease_lines = [[0, 2],
                       [0, 6],
                       [0, 8],
                       [1, 3],
                       [1, 6],
                       [1, 8],
                       [2, 4],
                       [2, 8],
                       [2, 9],
                       [3, 5],
                       [3, 8],
                       [3, 9],
                       [4, 7],
                       [4, 9],
                       [5, 7],
                       [5, 9],
                       [6, 8],
                       [7, 9],
                       [8, 9]]

    cp.facets = [[0, 2, 8],
                 [2, 4, 9],
                 [2, 8, 9],
                 [0, 6, 8],
                 [4, 7, 9],
                 [1, 3, 8],
                 [3, 5, 9],
                 [3, 8, 9],
                 [1, 6, 8],
                 [5, 7, 9]]

    cp.grab_pts = [[10, 0],
                   [11, 5],
                   [12, 1],
                   [13, 6]]

    cp.cnstr_lhs = [[(6, 1, 1.0)],
                    [(6, 2, 1.0)],
                    #[(7, 1, 1.0)],
                    #[(0, 1, 1.0), (2, 1, -1.0)],
                    [(7, 2, 1.0)],
                    [(2, 0, 1.0)],
                   # [(0, 1, 1.0), (2, 1, -1.0)],
                    #[(2, 2, 1.0), (3, 2, -1.0)],
                    [(10, 2, 1.0)],
                    [(10, 2, 1.0), (11, 2, -1.0)],
                    [(10, 2, 1.0), (12, 2, -1.0)],
                    [(10, 2, 1.0), (13, 2, -1.0)],
                    [(10, 0, 1.0), (11, 0, -1.0)],
                    [(10, 1, 1.0), (12, 1, -1.0)],
                    [(0, 1, 1.0), (2, 1, -1.0)]
                    #[(12, 0, 1.0), (13, 0, -1.0)]
                    ]

#    Working configuration
#    
#    cp.cnstr_lhs = [[(6, 1, 1.0)],
#                    [(6, 2, 1.0)],
#                    [(7, 1, 1.0)],
#                    [(7, 2, 1.0)],
#                    [(2, 0, 1.0)],
#                    [(0, 1, 1.0), (2, 1, -1.0)],
#                    [(2, 2, 1.0), (3, 2, -1.0)],
#                    [(10, 2, 1.0)],
#                    [(10, 2, 1.0), (11, 2, -1.0)],
#                    [(10, 2, 1.0), (12, 2, -1.0)],
#                    [(12, 2, 1.0), (13, 2, -1.0)]
#                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, dx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.0005
    X0[5] = 0.0005
    X0[14] = 0.0005
    X0[17] = 0.0005
    X0[11] = 0.003
    X0[8] = 0.003
    X0[26] = 0.0025
    X0[29] = 0.0025

    X0[32] = 0.002083              # ! Anfangskonfiguration nicht zu ausgepraegt 
    X0[35] = 0.002083
    X0[38] = 0.002083
    X0[41] = 0.002083               #   waehle, grabpoints werden sonst abgehaengt
    X0 *= 1
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d
    print 'cnstr', len(cp.cnstr_lhs)

    X = cp.solve(X0)
    return cp
예제 #14
0
def rhombus_3x3_crane(n_steps = 10, dx = 0.7):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 3,
                              n_x = 3,
                              n_y = 6,
                              MAX_ITER = 5000)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += -0.1559

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0], #31
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [0.5, 2.333, 0], #35
                  [0.5, 2.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [1.5, 2.333, 0],
                  [1.5, 2.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.667, 0],
                  [2.5, 1.333, 0], #45
                  [2.5, 1.667, 0],
                  [2.5, 2.333, 0],
                  [2.5, 2.667, 0]]#48

    crane_nodes = [[1.5, 0.5, 1.0], #49
                   [0.5, 0.5, 1],
                   [2.5, 0.5, 1],
                   [0.5, 0.333, 1.0],
                   [0.5, 0.667, 1.0],
                   [2.5, 0.333, 1.0],
                   [2.5, 0.667, 1.0], #55
                   [1.5, 0.333, 1.0],
                   [1.5, 0.667, 1.0],

                   [1.5, 1.5, 1.0],
                   [0.5, 1.5, 1],
                   [2.5, 1.5, 1], #60
                   [0.5, 1.333, 1.0],
                   [0.5, 1.667, 1.0],
                   [2.5, 1.333, 1.0],
                   [2.5, 1.667, 1.0],
                   [1.5, 1.333, 1.0], #65
                   [1.5, 1.667, 1.0],

                   [1.5, 2.5, 1.0],
                   [0.5, 2.5, 1],
                   [2.5, 2.5, 1],
                   [0.5, 2.333, 1.0], #70
                   [0.5, 2.667, 1.0],
                   [2.5, 2.333, 1.0],
                   [2.5, 2.667, 1.0],
                   [1.5, 2.333, 1.0],
                   [1.5, 2.667, 1.0], #75
                   ]

    cp.nodes = np.vstack([cp.nodes, grab_nodes])
    cp.nodes = np.vstack([cp.nodes, crane_nodes])


    crane_cl = [#crane 1
                [49, 50], #72
                [49, 51],
                [50, 52],
                [50, 53],
                [51, 54],
                [51, 55],
                [49, 56],
                [49, 57],

                [52, 31],
                [53, 32],
                [54, 43],
                [55, 44],
                [56, 37],
                [57, 38],
                #crane 2
                [58, 59],
                [58, 60],
                [59, 61],
                [59, 62],
                [60, 63],
                [60, 64],
                [58, 65],
                [58, 66],

                [61, 33],
                [62, 34],
                [63, 45],
                [64, 46],
                [65, 39],
                [66, 40],

                #crane 3
                [67, 68],
                [67, 69],
                [68, 70],
                [68, 71],
                [69, 72],
                [69, 73],
                [67, 74],
                [67, 75],

                [70, 35],
                [71, 36],
                [72, 47],
                [73, 48],
                [74, 41],
                [75, 42],

                ]

    cp.crease_lines = np.vstack([cp.crease_lines, crane_cl])

    cp.grab_pts = [[31, 0],
                   [32, 21],
                   [33, 1],
                   [34, 22],
                   [35, 2],
                   [36, 23],
                   [37, 3],
                   [38, 24],
                   [39, 4],
                   [40, 25],
                   [41, 5],
                   [42, 26],
                   [43, 6],
                   [44, 27],
                   [45, 7],
                   [46, 28],
                   [47, 8],
                   [48, 29]
                   ]




    cnstr_lhs_3 = [[(49, 2, 1.0)],
                    [(49, 0, 1.0)],
                    [(49, 1, 1.0), (67, 1, 1.0)],
                    [(49, 2, 1.0), (58, 2, -1.0)],
                    [(49, 2, 1.0), (67, 2, -1.0)],
                    [(49, 2, 1.0), (56, 2, -1.0)],
                    [(49, 2, 1.0), (57, 2, -1.0)],
                    [(49, 0, 1.0), (56, 0, -1.0)],
                    [(49, 0, 1.0), (57, 0, -1.0)],
                    [(50, 2, 1.0), (52, 2, -1.0)],
                    [(50, 2, 1.0), (53, 2, -1.0)],
                    [(50, 0, 1.0), (52, 0, -1.0)],
                    [(50, 0, 1.0), (53, 0, -1.0)],
                    [(51, 2, 1.0), (54, 2, -1.0)],
                    [(51, 2, 1.0), (55, 2, -1.0)],
                    [(51, 0, 1.0), (54, 0, -1.0)],
                    [(51, 0, 1.0), (55, 0, -1.0)],
                    [(50, 2, 1.0)],
                    [(51, 2, 1.0)],
                    [(50, 1, 1.0), (49, 1, -1.0)],
                    [(51, 1, 1.0), (49, 1, -1.0)],

                    [(58, 0, 1.0)],
                    [(58, 2, 1.0), (65, 2, -1.0)],
                    [(58, 2, 1.0), (66, 2, -1.0)],
                    [(58, 0, 1.0), (65, 0, -1.0)],
                    [(58, 0, 1.0), (66, 0, -1.0)],
                    [(59, 2, 1.0), (61, 2, -1.0)],
                    [(59, 2, 1.0), (62, 2, -1.0)],
                    [(59, 0, 1.0), (61, 0, -1.0)],
                    [(59, 0, 1.0), (62, 0, -1.0)],
                    [(60, 2, 1.0), (63, 2, -1.0)],
                    [(60, 2, 1.0), (64, 2, -1.0)],
                    [(60, 0, 1.0), (63, 0, -1.0)],
                    [(60, 0, 1.0), (64, 0, -1.0)],
                    [(59, 2, 1.0)],
                    [(60, 2, 1.0)],
                    [(59, 1, 1.0)],
                    [(60, 1, 1.0)],
                    [(58, 1, 1.0)],

                    [(67, 0, 1.0)],
                    [(67, 2, 1.0), (74, 2, -1.0)],
                    [(67, 2, 1.0), (75, 2, -1.0)],
                    [(67, 0, 1.0), (74, 0, -1.0)],
                    [(67, 0, 1.0), (75, 0, -1.0)],
                    [(68, 2, 1.0), (70, 2, -1.0)],
                    [(68, 2, 1.0), (71, 2, -1.0)],
                    [(68, 0, 1.0), (70, 0, -1.0)],
                    [(68, 0, 1.0), (71, 0, -1.0)],
                    [(69, 2, 1.0), (72, 2, -1.0)],
                    [(69, 2, 1.0), (73, 2, -1.0)],
                    [(69, 0, 1.0), (72, 0, -1.0)],
                    [(69, 0, 1.0), (73, 0, -1.0)],
                    [(68, 2, 1.0)],
                    [(69, 2, 1.0)],
                    [(67, 1, 1.0), (27, 1, -1.0)],
                    [(68, 1, 1.0), (67, 1, -1.0)],
                    [(69, 1, 1.0), (67, 1, -1.0)],

                    #[(35, 1, 1.0), (12, 1, -1.0)],
                    #[(46, 1, 1.0), (13, 1, -1.0)],
                    #[(35, 1, 1.0), (46, 1, 1.0)],
                    #[(36, 1, 1.0), (47, 1, 1.0)],

                    [(25, 0, 1.0)],
                    [(17, 1, 1.0)],
                    #[(10, 1, 1.0)],
                    #[(37, 2, 1.0), (48, 2, -1.0)],
                    #[(26, 1, 1.0), (30, 1, -1.0)],
                    #[(0, 1, 1.0), (3, 1, -1.0)],
                    #[(37, 2, 1.0), (38, 2, -1.0)],
                    #[(29, 1, 1.0), (33, 1, -1.0)],
                    #[(31, 1, 1.0), (37, 1, -1.0)],
                    #[(7, 2, 1.0), (11, 2, -1.0)],
                    #[(22, 0, 1.0), (24, 0, -1.0)],
                    #[(38, 0, 1.0), (49, 0, -1.0)],
                    #[(48, 2, 1.0), (49, 2, -1.0)],
                    #[(3, 2, 1.0), (6, 2, -1.0)],
                    #[(24, 1, 1.0), (28, 1, -1.0)],
                    #[(27, 1, 1.0), (31, 1, -1.0)],
                    [(4, 2, 1.0), (8, 2, -1.0)],
                    #[(3, 1, 1.0), (6, 1, -1.0)],
                    #[(5, 2, 1.0), (8, 2, -1.0)],
                    #[(30, 0, 1.0), (31, 0, -1.0)]
                    #[(30, 0, 1.0), (31, 0, -1.0)],
                    #[(31, 0, 1.0), (32, 0, -1.0)]
#                    [(12, 2, 1.0)],
#                    [(13, 0, 1.0)],
#                    [(14, 2, 1.0)],
#                    [(15, 2, 1.0)]
                    ]
    cp.cnstr_lhs = cnstr_lhs_3

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx


    X_ext = np.zeros((cp.n_dofs - len(X_rcp.reshape((-1,))),), dtype = float)
    X0 = np.hstack([X_rcp.reshape((-1,)), X_ext])


    X0[113] = 0.1441
    X0[116] = 0.1441
    X0[119] = 0.1441
    X0[122] = 0.1441
    X0[125] = 0.1441
    X0[128] = 0.1441

    X0[149] = 0.1441
    X0[176] = 0.1441
    X0[203] = 0.1441
    #X0[131] = 0.45
    #X0[152] = 0.1441
    #X0[155] = 0.1441

   # X0[132] = 0.1441
    #X0[135] = -0.1441


    cp.create_rcp_tex(name = 'rcp_x3_y3.tex')

    X0 *= 0.1
    #np.set_printoptions(threshold='nan')
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * 3 - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)

    #cp.show_iter = True    
    X = cp.solve(X0)
    return cp
예제 #15
0
def rhombus_3x2_crane(n_steps = 10, dx = 1):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 2,
                              n_x = 3,
                              n_y = 4,
                              MAX_ITER = 5000)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += -0.1559

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0],
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.667, 0],
                  [2.5, 1.333, 0],
                  [2.5, 1.667, 0]]#33

    crane_nodes = [[1.5, 0.5, 1.0], #34
                   [0.5, 0.5, 1],
                   [2.5, 0.5, 1],
                   [0.5, 0.333, 1.0],
                   [0.5, 0.667, 1.0], #38
                   [2.5, 0.333, 1.0],
                   [2.5, 0.667, 1.0],
                   [1.5, 0.333, 1.0],
                   [1.5, 0.667, 1.0],

                   [1.5, 1.5, 1.0], #43
                   [0.5, 1.5, 1],
                   [2.5, 1.5, 1],
                   [0.5, 1.333, 1.0], #46
                   [0.5, 1.667, 1.0],
                   [2.5, 1.333, 1.0],
                   [2.5, 1.667, 1.0],
                   [1.5, 1.333, 1.0],
                   [1.5, 1.667, 1.0], #51
                   ]

    cp.nodes = np.vstack([cp.nodes, grab_nodes])
    cp.nodes = np.vstack([cp.nodes, crane_nodes])


    crane_cl = [#crane 1
                [34, 35], #49
                [34, 36],
                [35, 37],
                [35, 38],
                [36, 39],
                [36, 40],
                [34, 41], #55
                [34, 42],

                [37, 22],
                [38, 23], #60
                [39, 30],
                [40, 31],
                [41, 26],
                [42, 27],
                #crane 2
                [43, 44], #65
                [43, 45],
                [44, 46],
                [44, 47],
                [45, 48],
                [45, 49],
                [43, 50],
                [43, 51],
                [46, 24],
                [47, 25],
                [48, 32],
                [49, 33],
                [50, 28],
                [51, 29],

                ]

    cp.crease_lines = np.vstack([cp.crease_lines, crane_cl])

    cp.grab_pts = [[22, 0],
                   [23, 14],
                   [26, 2],
                   [27, 16],
                   [30, 4],
                   [31, 18],
                   [24, 1],
                   [25, 15],
                   [28, 3],
                   [29, 17],
                   [32, 5],
                   [33, 19]
                   ]
#    cp.line_pts = [[37, 49],
#                   [38, 50],
#                   [48, 63],
#                   [49, 64]
#                   ]
#    

    cnstr_lhs_2 = [[(34, 2, 1.0)],
                    [(34, 0, 1.0)],
#                    [(34, 1, 1.0)],
                    [(34, 2, 1.0), (41, 2, -1.0)],
                    [(34, 2, 1.0), (42, 2, -1.0)],
                    [(34, 2, 1.0), (43, 2, -1.0)],
                    [(34, 0, 1.0), (41, 0, -1.0)],
                    [(34, 0, 1.0), (42, 0, -1.0)],
                    [(35, 2, 1.0), (37, 2, -1.0)],
                    [(35, 2, 1.0), (38, 2, -1.0)],
                    [(35, 0, 1.0), (37, 0, -1.0)],
                    [(35, 0, 1.0), (38, 0, -1.0)],
                    [(36, 2, 1.0), (39, 2, -1.0)],
                    [(36, 2, 1.0), (40, 2, -1.0)],
                    [(36, 0, 1.0), (39, 0, -1.0)],
                    [(36, 0, 1.0), (40, 0, -1.0)],
                    [(35, 2, 1.0)],
                    [(36, 2, 1.0)],
                    [(36, 1, 1.0), (34, 1, -1.0)],
                    [(35, 1, 1.0), (34, 1, -1.0)],

                    [(43, 0, 1.0)],
#                    [(43, 1, 1.0)],
                    [(43, 2, 1.0), (50, 2, -1.0)],
                    [(43, 2, 1.0), (51, 2, -1.0)],
                    [(43, 0, 1.0), (50, 0, -1.0)],
                    [(43, 0, 1.0), (51, 0, -1.0)],
                    [(44, 2, 1.0), (46, 2, -1.0)],
                    [(44, 2, 1.0), (47, 2, -1.0)],
                    [(44, 0, 1.0), (46, 0, -1.0)],
                    [(44, 0, 1.0), (47, 0, -1.0)],
                    [(45, 2, 1.0), (48, 2, -1.0)],
                    [(45, 2, 1.0), (49, 2, -1.0)],
                    [(45, 0, 1.0), (48, 0, -1.0)],
                    [(45, 0, 1.0), (49, 0, -1.0)],
                    [(44, 2, 1.0)],
                    [(45, 2, 1.0)],
                    [(44, 1, 1.0), (43, 1, -1.0)],
                    [(45, 1, 1.0), (43, 1, -1.0)],

                    [(4, 0, 1.0)],
                    [(1, 1, 1.0)],

                    [(22, 1, 1.0), (26, 1, -1.0)],

                    [(3, 2, 1.0), (6, 2, -1.0)],
                    [(23, 1, 1.0), (27, 1, -1.0)],
                    [(27, 1, 1.0), (31, 1, -1.0)],
                    [(22, 0, 1.0), (23, 0, -1.0)],
                    [(34, 1, 1.0), (18, 1, -1.0)],
                    [(34, 1, 1.0), (43, 1, 1.0)]


                    ]

    cnstr_lhs_1 = [[(34, 2, 1.0)],
                    [(34, 0, 1.0)],
                    [(34, 1, 1.0)],
                    [(34, 2, 1.0), (41, 2, -1.0)],
                    [(34, 2, 1.0), (42, 2, -1.0)],
                    [(34, 2, 1.0), (43, 2, -1.0)],
                    [(34, 0, 1.0), (41, 0, -1.0)],
                    [(34, 0, 1.0), (42, 0, -1.0)],
                    [(35, 2, 1.0), (37, 2, -1.0)],
                    [(35, 2, 1.0), (38, 2, -1.0)],
                    [(35, 0, 1.0), (37, 0, -1.0)],
                    [(35, 0, 1.0), (38, 0, -1.0)],
                    [(36, 2, 1.0), (39, 2, -1.0)],
                    [(36, 2, 1.0), (40, 2, -1.0)],
                    [(36, 0, 1.0), (39, 0, -1.0)],
                    [(36, 0, 1.0), (40, 0, -1.0)],
                    [(35, 2, 1.0)],
                    [(36, 2, 1.0)],
                    [(36, 1, 1.0)],
                    [(35, 1, 1.0)],

                    [(43, 0, 1.0)],
                    [(43, 1, 1.0), (45, 1, -1.0)],
                    [(43, 2, 1.0), (50, 2, -1.0)],
                    [(43, 2, 1.0), (51, 2, -1.0)],
                    [(43, 0, 1.0), (50, 0, -1.0)],
                    [(43, 0, 1.0), (51, 0, -1.0)],
                    [(44, 2, 1.0), (46, 2, -1.0)],
                    [(44, 2, 1.0), (47, 2, -1.0)],
                    [(44, 0, 1.0), (46, 0, -1.0)],
                    [(44, 0, 1.0), (47, 0, -1.0)],
                    [(45, 2, 1.0), (48, 2, -1.0)],
                    [(45, 2, 1.0), (49, 2, -1.0)],
                    [(45, 0, 1.0), (48, 0, -1.0)],
                    [(45, 0, 1.0), (49, 0, -1.0)],
                    [(44, 2, 1.0)],
                    [(45, 2, 1.0)],
                    [(44, 1, 1.0), (43, 1, -1.0)],
                    [(43, 1, 1.0), (19, 1, -1.0)],

                    #[(35, 1, 1.0), (12, 1, -1.0)],
                    #[(46, 1, 1.0), (13, 1, -1.0)],
                    #[(35, 1, 1.0), (46, 1, 1.0)],
                    #[(36, 1, 1.0), (47, 1, 1.0)],

                    [(4, 0, 1.0)],
                    [(1, 1, 1.0), (10, 1, -1.0)],
                    #[(10, 1, 1.0)],
                    #[(37, 2, 1.0), (48, 2, -1.0)],
                    #[(26, 1, 1.0), (30, 1, -1.0)],
                    #[(0, 1, 1.0), (3, 1, -1.0)],
                    #[(37, 2, 1.0), (38, 2, -1.0)],
                    #[(29, 1, 1.0), (33, 1, -1.0)],
                    [(22, 1, 1.0), (26, 1, -1.0)],
                    #[(22, 0, 1.0), (24, 0, -1.0)],
                    #[(38, 0, 1.0), (49, 0, -1.0)],
                    #[(48, 2, 1.0), (49, 2, -1.0)],
                    #[(3, 2, 1.0), (6, 2, -1.0)],
                    #[(24, 1, 1.0), (28, 1, -1.0)],
                    #[(27, 1, 1.0), (31, 1, -1.0)],
                    [(3, 2, 1.0), (6, 2, -1.0)],
                    #[(3, 1, 1.0), (6, 1, -1.0)],
                    #[(5, 2, 1.0), (8, 2, -1.0)],
                    #[(30, 0, 1.0), (31, 0, -1.0)]
                    #[(30, 0, 1.0), (31, 0, -1.0)],
                    [(22, 0, 1.0), (23, 0, -1.0)]
#                    [(12, 2, 1.0)],
#                    [(13, 0, 1.0)],
#                    [(14, 2, 1.0)],
#                    [(15, 2, 1.0)]
                    ]

    cnstr_lhs_3 = [[(34, 2, 1.0)],
                    [(34, 0, 1.0)],
                    [(34, 1, 1.0), (43, 1, 1.0)],
                    [(34, 2, 1.0), (41, 2, -1.0)],
                    [(34, 2, 1.0), (42, 2, -1.0)],
                    #[(34, 2, 1.0), (43, 2, -1.0)],
                    [(34, 0, 1.0), (41, 0, -1.0)],
                    [(34, 0, 1.0), (42, 0, -1.0)],
                    [(35, 2, 1.0), (37, 2, -1.0)],
                    [(35, 2, 1.0), (38, 2, -1.0)],
                    [(35, 0, 1.0), (37, 0, -1.0)],
                    [(35, 0, 1.0), (38, 0, -1.0)],
                    [(36, 2, 1.0), (39, 2, -1.0)],
                    [(36, 2, 1.0), (40, 2, -1.0)],
                    [(36, 0, 1.0), (39, 0, -1.0)],
                    [(36, 0, 1.0), (40, 0, -1.0)],
                    [(35, 2, 1.0)],
                    [(36, 2, 1.0)],
                    [(36, 1, 1.0), (34, 1, -1.0)],
                    [(35, 1, 1.0), (34, 1, -1.0)],

                    [(43, 0, 1.0)],
                    [(43, 1, 1.0), (45, 1, -1.0)],
                    [(43, 2, 1.0), (50, 2, -1.0)],
                    [(43, 2, 1.0), (51, 2, -1.0)],
                    [(43, 0, 1.0), (50, 0, -1.0)],
                    [(43, 0, 1.0), (51, 0, -1.0)],
                    [(44, 2, 1.0), (46, 2, -1.0)],
                    [(44, 2, 1.0), (47, 2, -1.0)],
                    [(44, 0, 1.0), (46, 0, -1.0)],
                    [(44, 0, 1.0), (47, 0, -1.0)],
                    [(45, 2, 1.0), (48, 2, -1.0)],
                    [(45, 2, 1.0), (49, 2, -1.0)],
                    [(45, 0, 1.0), (48, 0, -1.0)],
                    [(45, 0, 1.0), (49, 0, -1.0)],
                    [(44, 2, 1.0)],
                    [(45, 2, 1.0)],
                    [(44, 1, 1.0), (43, 1, -1.0)],
                    [(43, 1, 1.0), (19, 1, -1.0)],

                    #[(35, 1, 1.0), (12, 1, -1.0)],
                    #[(46, 1, 1.0), (13, 1, -1.0)],
                    #[(35, 1, 1.0), (46, 1, 1.0)],
                    #[(36, 1, 1.0), (47, 1, 1.0)],

                    [(4, 0, 1.0)],
                    [(1, 1, 1.0)],
                    #[(10, 1, 1.0)],
                    #[(37, 2, 1.0), (48, 2, -1.0)],
                    #[(26, 1, 1.0), (30, 1, -1.0)],
                    #[(0, 1, 1.0), (3, 1, -1.0)],
                    #[(37, 2, 1.0), (38, 2, -1.0)],
                    #[(29, 1, 1.0), (33, 1, -1.0)],
                    [(22, 1, 1.0), (26, 1, -1.0)],
                    [(22, 0, 1.0), (23, 0, -1.0)],
                    #[(38, 0, 1.0), (49, 0, -1.0)],
                    #[(48, 2, 1.0), (49, 2, -1.0)],
                    #[(3, 2, 1.0), (6, 2, -1.0)],
                    #[(24, 1, 1.0), (28, 1, -1.0)],
                    #[(27, 1, 1.0), (31, 1, -1.0)],
                    [(3, 2, 1.0), (6, 2, -1.0)],
                    #[(3, 1, 1.0), (6, 1, -1.0)],
                    #[(5, 2, 1.0), (8, 2, -1.0)],
                    #[(30, 0, 1.0), (31, 0, -1.0)]
                    #[(30, 0, 1.0), (31, 0, -1.0)],
                    [(22, 0, 1.0), (23, 0, -1.0)]
#                    [(12, 2, 1.0)],
#                    [(13, 0, 1.0)],
#                    [(14, 2, 1.0)],
#                    [(15, 2, 1.0)]
                    ]
    cp.cnstr_lhs = cnstr_lhs_1

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx


    X_ext = np.zeros((cp.n_dofs - len(X_rcp.reshape((-1,))),), dtype = float)
    X0 = np.hstack([X_rcp.reshape((-1,)), X_ext])

    X0[68] = 0.0
    X0[71] = 0.0
    X0[74] = 0.0
    X0[77] = 0.0
    X0[80] = 0.1441
    X0[83] = 0.1441
    X0[86] = 0.1441
    X0[89] = 0.1441
    X0[92] = 0.0
    X0[95] = 0.0
    X0[98] = 0.0
    X0[101] = 0.0

    X0[104] = 0.1441
    X0[125] = 0.1441
    X0[128] = 0.1441
    #X0[131] = 0.45
    X0[152] = 0.1441
    X0[155] = 0.1441

    X0[132] = 0.1441
    X0[135] = -0.1441





    X0 *= 0.1
    #np.set_printoptions(threshold='nan')
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)
#    sf = SingularityFinder()
#    sf.singul_test(cp.get_G_du(X0))

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * 3 - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)

    #cp.show_iter = True    
    X = cp.solve(X0)
    return cp
예제 #16
0
def rhombus_3x2_grab_points_for_crane(n_steps = 10, dx = 1.5):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 2,
                              n_x = 3,
                              n_y = 4,
                              MAX_ITER = 500)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += 0.15
    print 'X_rcp', X_rcp

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0], #22
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.666, 0],
                  [2.5, 1.333, 0],
                  [2.5, 1.667, 0]]

    cp.nodes = np.vstack([cp.nodes, grab_nodes])

    cp.grab_pts = [
                   [22, 0],
                   [23, 14],
                   [26, 2],
                   [27, 16],
                   [30, 4],
                   [31, 18],
                   [24, 1],
                   [25, 15],
                   [28, 3],
                   [29, 17],
                   [32, 5],
                   [33, 19]
                   ]

    cp.cnstr_lhs = [[(12, 2, 1.0)],
                    [(13, 2, 1.0)],
                    [(14, 2, 1.0)],
                    [(15, 2, 1.0)],
                    [(1, 1, 1.0)],
                    [(18, 0, 1.0)],

                    [(26, 2, 1.0)],
                    [(22, 1, 1.0), (26, 1, -1.0)],
                    [(26, 1, 1.0), (30, 1, -1.0)],
                    [(23, 1, 1.0), (27, 1, -1.0)],
                    [(5, 2, 1.0), (8, 2, -1.0)],
                    [(24, 1, 1.0), (28, 1, -1.0)],
                    [(28, 1, 1.0), (32, 1, -1.0)],
                    [(25, 1, 1.0), (29, 1, -1.0)],
                    [(3, 2, 1.0), (6, 2, -1.0)],
                    [(22, 2, 1.0), (30, 2, -1.0)],
                    [(29, 1, 1.0), (33, 1, -1.0)]

                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, dx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]


    X_ext = np.zeros((cp.n_g * cp.n_d,), dtype = float)
    X0 = np.hstack([X_rcp.reshape((-1,)), X_ext])

    X0[68] = 0.3059
    X0[71] = 0.3059
    X0[74] = 0.3059
    X0[77] = 0.3059
    X0[80] = 0.4389
    X0[83] = 0.4389
    X0[86] = 0.4389
    X0[89] = 0.4389
    X0[92] = 0.3059
    X0[95] = 0.3059
    X0[98] = 0.3059
    X0[101] = 0.3059

    X0 *= 0.01
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d
    print 'cnstr', len(cp.cnstr_lhs)
    #cp.show_iter = True    
    X = cp.solve(X0)
    return cp
예제 #17
0
def rhombus_3x1_crane_sticks(n_steps = 10, dx = 1.0):

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0], #0
                [0, 1, 0],
                [1, 0, 0],
                [1, 1, 0],
                [2, 0, 0],
                [2, 1, 0], #5
                [3, 0, 0],
                [3, 1, 0],
                [0, 0.5, 0],
                [3, 0.5, 0],
                [0.5, 0.5, 0], #10
                [1.5, 0.5, 0],
                [2.5, 0.5, 0],
                [0.5, 0.333, 0], #13
                [0.5, 0.667, 0],
                [1.5, 0.333, 0],
                [1.5, 0.667, 0],
                [2.5, 0.333, 0],
                [2.5, 0.666, 0],
                [1.5, 0.5, 1.0],
                [0, 0.5, 1],
                [3, 0.5, 1],
                [0.5, 0.5, 1.0],
                [2.5, 0.5, 1.0],
                [0.5, 0.333, 1.0],
                [0.5, 0.667, 1.0],
                [2.5, 0.333, 1.0],
                [2.5, 0.667, 1.0],
                [1.5, 0.333, 1.0],
                [1.5, 0.667, 1.0]
                ]

    cp.crease_lines = [[0, 2], #0
                       [0, 8],
                       [0, 10],
                       [1, 3],
                       [1, 8],
                       [1, 10],
                       [2, 4],
                       [2, 10],
                       [2, 11],
                       [3, 5],
                       [3, 10], #10
                       [3, 11],
                       [4, 6],
                       [4, 11],
                       [4, 12],
                       [5, 7],
                       [5, 11],
                       [5, 12],
                       [6, 9],
                       [6, 12],
                       [7, 9], #20
                       [7, 12],
                       [8, 10],
                       [9, 12],
                       [10, 11],
                       [11, 12],
                       [19, 20], #26
                       [19, 21],
                       [22, 24],
                       [22, 25],
                       [19, 28],
                       [19, 29],
                       [23, 26],
                       [23, 27],
                       [13, 24],
                       [14, 25],
                       [15, 28],
                       [16, 29],
                       [17, 26],
                       [18, 27],
                       [20, 8],
                       [9, 21]
                       ]

    cp.facets = [[0, 2, 10],
                 [2, 4, 11],
                 [4, 6, 12],
                 [2, 11, 10],
                 [4, 11, 12],
                 [0, 8, 10],
                 [6, 9, 12],
                 [1, 3, 10],
                 [3, 5, 11],
                 [5, 7, 12],
                 [3, 10, 11],
                 [5, 11, 12],
                 [1, 8, 10],
                 [7, 9, 12]
                 ]
    cp.line_pts = [[22, 26],
                   [23, 27]]

    cp.grab_pts = [[13, 0],
                   [14, 7],
                   [15, 1],
                   [16, 8],
                   [17, 2],
                   [18, 9]
                   ]

    cp.cnstr_lhs = [[(19, 2, 1.0)],
                    [(19, 1, 1.0)],
                    [(19, 0, 1.0)],
                    [(20, 1, 1.0)],
                    [(20, 2, 1.0)],
                    [(21, 1, 1.0)],
                    [(21, 2, 1.0)],
                    [(22, 0, 1.0), (24, 0, -1.0)],
                    [(22, 0, 1.0), (25, 0, -1.0)],
                    [(22, 2, 1.0), (24, 2, -1.0)],
                    [(22, 2, 1.0), (25, 2, -1.0)],
                    [(19, 0, 1.0), (28, 0, -1.0)],
                    [(19, 0, 1.0), (29, 0, -1.0)],
                    [(19, 2, 1.0), (28, 2, -1.0)],
                    [(19, 2, 1.0), (29, 2, -1.0)],
                    [(23, 0, 1.0), (26, 0, -1.0)],
                    [(23, 0, 1.0), (27, 0, -1.0)],
                    [(23, 2, 1.0), (26, 2, -1.0)],
                    [(23, 2, 1.0), (27, 2, -1.0)],
                    [(14, 1, 1.0), (16, 1, -1.0)],

                    #[(8, 2, 1.0)],
                    [(11, 1, 1.0)],
                    #[(9, 2, 1.0)],
                    [(11, 0, 1.0)],
                    [(13, 0, 1.0), (14, 0, -1.0)],
                    [(16, 1, 1.0), (18, 1, -1.0)],
                    [(2, 2, 1.0), (4, 2, -1.0)],
                    #[(13, 2, 1.0), (17, 2, -1.0)],
                    [(13, 1, 1.0), (15, 1, -1.0)]
                    ]

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.00005
    X0[5] = 0.00005
    X0[20] = 0.00005
    X0[23] = 0.00005

    X0[35] = 0.0003

    X0[8] = 0.00025
    X0[11] = 0.00025
    X0[14] = 0.00025
    X0[17] = 0.00025

    X0[32] = 0.00017
    X0[38] = 0.00017

    X0[41] = 0.00016334
    X0[44] = 0.00016334
    X0[47] = 0.00028335
    X0[50] = 0.00028335
    X0[53] = 0.00016334
    X0[56] = 0.00016334
    X0[59] = 0.00025
    X0[66] = 0.0001
    X0[68] = 0.00016334
    X0[69] = -0.0001
    X0[71] = 0.00016334
    X0[72] = 0.0001
    X0[74] = 0.00016334
    X0[75] = 0.0001
    X0[77] = 0.00016334
    X0[78] = -0.0001
    X0[80] = 0.00016334
    X0[81] = -0.0001
    X0[83] = 0.00016334
    X0[86] = 0.00025
    X0[89] = 0.00025
    X0 *= 1

    np.set_printoptions(threshold = 'nan')
    print 'dR', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)

    #cp.show_iter = True 
    X = cp.solve(X0)
    #print'Iterationnodes', cp.iteration_nodes
    cp.get_line_position(0)
    return cp
예제 #18
0
def line_test_crane(n_steps = 10, dx = 1.0):

    """

    """

    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[0.75, 0.333, 0],
                [0.75, 0.667, 0],
                [2.25, 0.333, 0],
                [2.25, 0.667, 0],
                [1.5, 0.5, 1.5],
                [0, 0.5, 1],
                [3, 0.5, 1],
                [0.8, 0.5, 1.266],
                [2.2, 0.5, 1.266]
#                [0.8, 0.333, 1.0533],
#                [0.8, 0.667, 1.0533],
#                [2.2, 0.333, 1.0533],
#                [2.2, 0.667, 1.0533],
                ]

    cp.crease_lines = [[ 4, 5 ],
                       [ 4, 6 ],
                       [ 7, 0],
                       [ 7, 1],
                       [ 8, 2],
                       [ 8, 3]]
#                       [ 7, 9 ],
#                       [ 7, 10 ],
#                       [ 8, 11 ],
#                       [ 8, 12 ],

#                       [ 0, 9 ],
#                       [ 1, 10],
#                       [ 2, 11],
#                       [ 3, 12]]

    cp.facets = [[0, 1, 2]]

    cp.grab_pts = []

    cp.line_pts = [[7, 0],
                   [8, 1]]

    cp.cnstr_lhs = [[(4, 2, 1.0)],
                    #[(0, 1, 1.0)],
                    [(4, 0, 1.0)],
                    #[(4, 1, 1.0)],
                    [(5, 1, 1.0)],
                    [(5, 2, 1.0)],
                    [(6, 1, 1.0)],
                    [(6, 2, 1.0)],
#                    [(7, 2, 1.0), (9, 2, -1.0)],
#                    [(7, 0, 1.0), (9, 0, -1.0)],
#                    [(7, 2, 1.0), (10, 2, -1.0)],
#                    [(7, 0, 1.0), (10, 0, -1.0)],
#                    [(8, 2, 1.0), (11, 2, -1.0)],
#                    [(8, 0, 1.0), (11, 0, -1.0)],
#                    [(8, 2, 1.0), (12, 2, -1.0)],
#                    [(8, 0, 1.0), (12, 0, -1.0)],
                    [(0, 2, 1.0), (1, 2, -1.0)],
                    [(0, 1, 1.0), (1, 1, -1.0)],
                    [(0, 0, 1.0), (1, 0, -1.0)],
                    [(2, 2, 1.0), (3, 2, -1.0)],
                    [(2, 0, 1.0), (3, 0, -1.0)],
                    [(2, 1, 1.0), (3, 1, -1.0)],
                    [(0, 0, 1.0)],
                    [(2, 1, 1.0)],
                    [(0, 1, 1.0)],
                    [(2, 0, 1.0)],
                    [(0, 2, 1.0)],
                    [(2, 2, 1.0)],
                   # [(0, 1, 1.0)],

                    ]

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx

    X = np.zeros((cp.n_dofs,), dtype = float)
    X[14] = 0.0001
    X[2] = 0.0001
   # X[10] = 0.01
  #  X[11] = 0.01

    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)
    cp.show_iter = True
    X = cp.solve(X)

    return cp
예제 #19
0
def rhombus_3x3_crane(n_steps = 10, dx = 0.7):
    """
        This example shows a 3x2 rhombus creasepattern.

    """
    cpr = YoshimuraCreasePattern(n_steps = n_steps,
                              L_x = 3,
                              L_y = 3,
                              n_x = 3,
                              n_y = 6,
                              MAX_ITER = 5000)

    X_rcp = cpr.generate_X0()
    X_rcp = X_rcp.reshape((-1, 3))
    X_rcp[:, 2] += -0.1559

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = cpr.nodes

    cp.crease_lines = cpr.crease_lines

    cp.facets = cpr.facets

    grab_nodes = [[0.5, 0.333, 0], #31
                  [0.5, 0.667, 0],
                  [0.5, 1.333, 0],
                  [0.5, 1.667, 0],
                  [0.5, 2.333, 0], #35
                  [0.5, 2.667, 0],
                  [1.5, 0.333, 0],
                  [1.5, 0.667, 0],
                  [1.5, 1.333, 0],
                  [1.5, 1.667, 0],
                  [1.5, 2.333, 0],
                  [1.5, 2.667, 0],
                  [2.5, 0.333, 0],
                  [2.5, 0.667, 0],
                  [2.5, 1.333, 0], #45
                  [2.5, 1.667, 0],
                  [2.5, 2.333, 0],
                  [2.5, 2.667, 0]]#48



    cp.nodes = np.vstack([cp.nodes, grab_nodes])





    cp.grab_pts = [[31, 0],
                   [32, 21],
                   [33, 1],
                   [34, 22],
                   [35, 2],
                   [36, 23],
                   [37, 3],
                   [38, 24],
                   [39, 4],
                   [40, 25],
                   [41, 5],
                   [42, 26],
                   [43, 6],
                   [44, 27],
                   [45, 7],
                   [46, 28],
                   [47, 8],
                   [48, 29]
                   ]




    cnstr_lhs_3 = [[(31, 1, 1.0)],
                   [(31, 1, 1.0), (36, 1, 1.0)],
                   [(16, 2, 1.0)],
                   [(17, 2, 1.0)],
                   [(18, 2, 1.0)],
                   [(19, 2, 1.0)],
                   [(20, 2, 1.0)],
                   [(21, 2, 1.0)],
                   [(17, 1, 1.0)],
                   [(20, 1, 1.0)],
                   [(20, 0, 1.0)],
                   [(37, 1, 1.0), (42, 1, 1.0)],
                   [(31, 2, 1.0), (36, 2, -1.0)],
                   [(37, 2, 1.0), (42, 2, -1.0)],
                   [(43, 1, 1.0), (48, 1, 1.0)],
                   [(43, 2, 1.0), (48, 2, 1.0)],
                   [(33, 1, 1.0), (34, 1, 1.0)],
                   [(39, 1, 1.0), (40, 1, 1.0)],
                   [(45, 1, 1.0), (46, 1, 1.0)],
                   [(19, 0, 1.0), (21, 0, -1.0)],
                   [(1, 2, 1.0), (2, 0, -1.0)]

                    ]
    cp.cnstr_lhs = cnstr_lhs_3

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx


    X_ext = np.zeros((cp.n_dofs - len(X_rcp.reshape((-1,))),), dtype = float)
    X0 = np.hstack([X_rcp.reshape((-1,)), X_ext])








    X0 *= 0.1
    #np.set_printoptions(threshold='nan')
    print 'dR', cp.get_dR(X0)
    print 'R', cp.get_R(X0)

    cp.set_next_node(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * 3 - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)

    cp.show_iter = True
    X = cp.solve(X0)
    return cp
예제 #20
0
def rhombus_3x1_grab_points(n_steps = 10, dx = 1.5):
    """
        This example shows a 3x1 rhombus creasepattern.
        In this creasepattern, the grabpoints lift up
        in different speeds. So their must be new rules
        defined for constrain setup.
    """
    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0],
                [0, 1, 0],
                [1, 0, 0],
                [1, 1, 0],
                [2, 0, 0],
                [2, 1, 0],
                [3, 0, 0],
                [3, 1, 0],
                [0, 0.5, 0],
                [3, 0.5, 0],
                [0.5, 0.5, 0],
                [1.5, 0.5, 0],
                [2.5, 0.5, 0],
                [0.5, 0.333, 0],
                [0.5, 0.667, 0],
                [1.5, 0.333, 0],
                [1.5, 0.667, 0],
                [2.5, 0.333, 0],
                [2.5, 0.666, 0]
                ]

    cp.crease_lines = [[0, 2],
                       [0, 8],
                       [0, 10],
                       [1, 3],
                       [1, 8],
                       [1, 10],
                       [2, 4],
                       [2, 10],
                       [2, 11],
                       [3, 5],
                       [3, 10],
                       [3, 11],
                       [4, 6],
                       [4, 11],
                       [4, 12],
                       [5, 7],
                       [5, 11],
                       [5, 12],
                       [6, 9],
                       [6, 12],
                       [7, 9],
                       [7, 12],
                       [8, 10],
                       [9, 12],
                       [10, 11],
                       [11, 12]]

    cp.facets = [[0, 2, 10],
                 [2, 4, 11],
                 [4, 6, 12],
                 [2, 11, 10],
                 [4, 11, 12],
                 [0, 8, 10],
                 [6, 9, 12],
                 [1, 3, 10],
                 [3, 5, 11],
                 [5, 7, 12],
                 [3, 10, 11],
                 [5, 11, 12],
                 [1, 8, 10],
                 [7, 9, 12]
                 ]

    cp.grab_pts = [[13, 0],
                   [14, 7],
                   [15, 1],
                   [16, 8],
                   [17, 2],
                   [18, 9]
                   ]

    cp.cnstr_lhs = [[(8, 2, 1.0)],
                    [(9, 2, 1.0)],
                    [(8, 1, 1.0)],
                    #[(9, 1, 1.0)],
                    [(11, 0, 1.0)],
                    #[(8, 1, 1.0), (9, 1, -1.0)],
                    [(15, 2, 1.0)],
                    [(15, 2, 1.0), (16, 2, -1.0)],
                    [(13, 1, 1.0), (15, 1, -1.0)],
                    [(15, 1, 1.0), (17, 1, -1.0)],
                    [(14, 1, 1.0), (16, 1, -1.0)],
                    [(16, 1, 1.0), (18, 1, -1.0)],
                    [(13, 0, 1.0), (14, 0, -1.0)],
                    [(17, 0, 1.0), (18, 0, -1.0)],
                    [(13, 2, 1.0), (17, 2, -1.0)]
                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, dx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.00005
    X0[5] = 0.00005
    X0[20] = 0.00005
    X0[23] = 0.00005

    X0[35] = 0.0003

    X0[8] = 0.00025
    X0[11] = 0.00025
    X0[14] = 0.00025
    X0[17] = 0.00025

    X0[32] = 0.00017
    X0[38] = 0.00017

    X0[41] = 0.00016334
    X0[44] = 0.00016334
    X0[47] = 0.00028335
    X0[50] = 0.00028335
    X0[53] = 0.00016334
    X0[56] = 0.00016334

    X0 *= 1

    # np.set_printoptions(threshold='nan')
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d
    print 'cnstr', len(cp.cnstr_lhs)

    X = cp.solve(X0)
    return cp
예제 #21
0
# This software is provided without warranty under the terms of the BSD
# license included in simvisage/LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license.  The license
# is also available online at http://www.simvisage.com/licenses/BSD.txt
#
# Thanks for using Simvisage open source!
#
# Created on Dec 20, 2011 by: rch

# own Modules
from oricrete.folding import \
    CreasePattern, CF, x_, y_, z_, t_ , \
    CreasePatternView

import numpy as np

if __name__ == '__main__':

    cp = CreasePattern(nodes = [[0, 0, 0]], n_steps = 10)

    cp.cf_lst = [(CF(Rf = z_ - x_ ** 2 - 0), [0]),
                    (CF(Rf = y_ - x_ ** 2 - 0), [0]),
                    (CF(Rf = x_ - t_ - 0), [0])]

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    print 'X ff final', cp.solve(X0)

    cpv = CreasePatternView(data = cp, show_cnstr = True)
    cpv.configure_traits()
        time_arr=np.linspace(1, 0, 10),
        MAX_ITER=200,
    )

    cp2.tf_lst = [(face_z_t, n_arr)]

    cp2.cnstr_lhs = [
        [(n_h[1, 0], 0, 1.0)],  # 0
        #                       [(n_h[1, -1], 0, 1.0)], # 1
        #                    [(n_h[1, -1], 1, 1.0), (n_h[1, 0], 1, 1.0)],
    ]
    cp2.cnstr_rhs = np.zeros((len(cp2.cnstr_lhs),), dtype=float)

    X0 = -1e-3 * np.linalg.norm(u_unfoldable) * u_unfoldable

    u_unfolded = cp2.solve(X0, acc=1e-5)

    # ===========================================================================
    # Print results
    # ===========================================================================
    u_zero = np.zeros_like(cp.nodes).flatten()
    print "G_cl(uf_zero)", uf.get_G(u_zero, 0)
    print "G_cl(uf_no_constraint)", uf.get_G(u_no_constraint, 0)
    print "G_cl(uf_constant_length)", uf.get_G(u_constant_length, 0)
    print "G_cl(uf_unfoldable)", uf.get_G(u_unfoldable, 0)
    print "u_flattened(z)", (u_unfoldable + u_unfolded).reshape(cp2.n_n, cp2.n_d)[:, 2]

    my_model = CreasePatternView(data=cp, ff_resolution=30, show_cnstr=True)
    my_model.configure_traits()

    my_model = CreasePatternView(data=cp2, ff_resolution=30, show_cnstr=True)
예제 #23
0
def rhombus_3x1_crane(n_steps = 10, dx = 1.0):
    '''
        This is a first modell of the which should lift the creasepattern.
        It shows a configuration of constrains in which the crane will lift the pattern
        in the expectet form. NOTE: There is no influence of gravity.
    '''

    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0], #0
                [0, 1, 0],
                [1, 0, 0],
                [1, 1, 0],
                [2, 0, 0],
                [2, 1, 0], #5
                [3, 0, 0],
                [3, 1, 0],
                [0, 0.5, 0],
                [3, 0.5, 0],
                [0.5, 0.5, 0], #10
                [1.5, 0.5, 0],
                [2.5, 0.5, 0],
                [0.5, 0.333, 0], #13
                [0.5, 0.667, 0],
                [1.5, 0.333, 0],
                [1.5, 0.667, 0],
                [2.5, 0.333, 0],
                [2.5, 0.667, 0],
                [1.5, 0.5, 1.0],
                [0, 0.5, 1], #20
                [3, 0.5, 1],
                [0, 0.333, 1.0],
                [0, 0.667, 1.0],
                [3, 0.333, 1.0],
                [3, 0.667, 1.0],
                [1.5, 0.333, 1.0],
                [1.5, 0.667, 1.0]
                ]

    cp.crease_lines = [[0, 2], #0
                       [0, 8],
                       [0, 10],
                       [1, 3],
                       [1, 8],
                       [1, 10],
                       [2, 4],
                       [2, 10],
                       [2, 11],
                       [3, 5],
                       [3, 10], #10
                       [3, 11],
                       [4, 6],
                       [4, 11],
                       [4, 12],
                       [5, 7],
                       [5, 11],
                       [5, 12],
                       [6, 9],
                       [6, 12],
                       [7, 9], #20
                       [7, 12],
                       [8, 10],
                       [9, 12],
                       [10, 11],
                       [11, 12],

                       [19, 20], #26
                       [19, 21],
                       [20, 22],
                       [20, 23],
                       [19, 26],
                       [19, 27],
                       [21, 24],
                       [21, 25],
                       [13, 22],
                       [14, 23],
                       [15, 26],
                       [16, 27],
                       [17, 24],
                       [18, 25],
                      # [20, 8],
                      # [9, 21]
                       ]

    cp.facets = [[0, 2, 10],
                 [2, 4, 11],
                 [4, 6, 12],
                 [2, 11, 10],
                 [4, 11, 12],
                 [0, 8, 10],
                 [6, 9, 12],
                 [1, 3, 10],
                 [3, 5, 11],
                 [5, 7, 12],
                 [3, 10, 11],
                 [5, 11, 12],
                 [1, 8, 10],
                 [7, 9, 12]
                 ]
    #cp.line_pts = [[22, 26],
    #               [23, 27]]

    cp.grab_pts = [[13, 0],
                   [14, 7],
                   [15, 1],
                   [16, 8],
                   [17, 2],
                   [18, 9]
                   ]

    cp.cnstr_lhs = [[(19, 2, 1.0)],
                    [(19, 1, 1.0)],
                    [(19, 0, 1.0)],
                    [(20, 1, 1.0)],
                    [(20, 2, 1.0)],
                    [(21, 1, 1.0)],
                    [(21, 2, 1.0)],
                    [(20, 0, 1.0), (22, 0, -1.0)],
                    [(20, 0, 1.0), (23, 0, -1.0)],
                    [(20, 2, 1.0), (22, 2, -1.0)],
                    [(20, 2, 1.0), (23, 2, -1.0)],
                    [(19, 0, 1.0), (26, 0, -1.0)],
                    [(19, 0, 1.0), (27, 0, -1.0)],
                    [(19, 2, 1.0), (26, 2, -1.0)],
                    [(19, 2, 1.0), (27, 2, -1.0)],
                    [(21, 0, 1.0), (24, 0, -1.0)],
                    [(21, 0, 1.0), (25, 0, -1.0)],
                    [(21, 2, 1.0), (24, 2, -1.0)],
                    [(21, 2, 1.0), (25, 2, -1.0)],
                    [(14, 1, 1.0), (16, 1, -1.0)],

                    #[(8, 2, 1.0)],
                    [(11, 1, 1.0)],
                    #[(9, 2, 1.0)],
                    [(11, 0, 1.0)],
                    [(13, 0, 1.0), (14, 0, -1.0)],
                    [(16, 1, 1.0), (18, 1, -1.0)],
                    [(2, 2, 1.0), (4, 2, -1.0)],
                    #[(13, 2, 1.0), (17, 2, -1.0)],
                    [(13, 1, 1.0), (15, 1, -1.0)]
                    ]

    cp.cnstr_rhs = np.zeros((cp.n_dofs,))
    cp.cnstr_rhs[0] = dx

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.00005
    X0[5] = 0.00005
    X0[20] = 0.00005
    X0[23] = 0.00005

    X0[35] = 0.0003

    X0[8] = 0.00025
    X0[11] = 0.00025
    X0[14] = 0.00025
    X0[17] = 0.00025

    X0[32] = 0.00017
    X0[38] = 0.00017

    X0[41] = 0.00016334
    X0[44] = 0.00016334
    X0[47] = 0.00028335
    X0[50] = 0.00028335
    X0[53] = 0.00016334
    X0[56] = 0.00016334
    X0[59] = 0.00025
    X0[66] = 0.0001
    X0[68] = 0.00016334
    X0[69] = -0.0001
    X0[71] = 0.00016334
    X0[72] = 0.0001
    X0[74] = 0.00016334
    X0[75] = 0.0001
    X0[77] = 0.00016334
    X0[78] = -0.0001
    X0[80] = 0.00016334
    X0[81] = -0.0001
    X0[83] = 0.00016334
#    X0[86] = 0.00025
#    X0[89] = 0.00025
    X0 *= 1

    np.set_printoptions(threshold = 'nan')
    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d - cp.n_l * 2
    print 'cnstr', len(cp.cnstr_lhs)

    #cp.show_iter = True 
    X = cp.solve(X0)
    #print'Iterationnodes', cp.iteration_nodes
    #cp.get_line_position(0)  
    return cp
예제 #24
0
def small_rhombus_grab_points(n_steps = 10, dx = 0.3333):
    """
        This example shows a 1x1 rhombus creasepattern with grabpoinst for movement.
        The creasepattern should give first rules for possible movements of the creasepattern
        under a standard bearing. The Intetion is to hold the endpoints of the
        middelline on an fixed z-plane and y-plane and to hold the system in one point in
        x-direction. So it can lift up while the endpoints are moving against the point
        fixed in x-direction.
        Now their should be as many constrains as possible build up over the grabpoints.
    """
    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0],
                [0, 1, 0],
                [1, 0, 0],
                [1, 1, 0],
                [0, 0.5, 0],
                [1, 0.5, 0],
                [0.5, 0.5, 0],
                [0.5, 0.333, 0],
                [0.5, 0.667, 0]]

    cp.crease_lines = [[0, 2],
                       [0, 4],
                       [0, 6],
                       [1, 3],
                       [1, 4],
                       [1, 6],
                       [2, 5],
                       [2, 6],
                       [3, 5],
                       [3, 6],
                       [4, 6],
                       [5, 6]]

    cp.facets = [[0, 2, 6],
                 [0, 4, 6],
                 [2, 5, 6],
                 [1, 3, 6],
                 [1, 4, 6],
                 [3, 5, 6]]

    cp.grab_pts = [[7, 0],
                   [8, 3]]

    cp.cnstr_lhs = [[(4, 1, 1.0)],
                    #[(5, 1, 1.0)],
                    [(4, 2, 1.0)],
                    [(5, 2, 1.0)],
                    [(6, 0, 1.0)],
                    [(0, 1, 1.0), (2, 1, -1.0)],
                    [(7, 1, 1.0), (8, 1, 1.0)],
                    #[(6, 2, 1.0)],
                    #[(6, 1, 1.0)]
                    [(7, 0, 1.0), (8, 0, -1.0)],
                    [(7, 2, 1.0)],
                    [(7, 2, 1.0), (8, 2, -1.0)]
                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, dx, 0.0]

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.0001
    X0[5] = 0.0001
    X0[8] = 0.0001
    X0[11] = 0.0001
    X0[20] = 0.0002
    X0[23] = 0.000167                # ! Anfangskonfiguration nicht zu ausgepraegt 
    X0[26] = 0.000167               #   waehle, grabpoints werden sonst abgehaengt

    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d
    print 'cnstr', len(cp.cnstr_lhs)

    X = cp.solve(X0)
    return cp
예제 #25
0
from oricrete.folding import CreasePattern
    
cp = CreasePattern()

cp.nodes = [[0, 0, 0],
            [1, 0, 0],
            [1, 1, 0]]

cp.crease_lines = [[0, 1],
                   [1, 2],
                   [2, 0]]
    
cp.cnstr_lhs = [[(0, 0, 1.0)],
                [(0, 1, 1.0)],
                [(0, 2, 1.0)],
                [(1, 1, 1.0)],
                [(1, 2, 1.0)],
                [(2, 2, 1.0)]]

cp.cnstr_rhs = [0, 0, 0, 0, 0, 0.5]

X0 = [0, 0, 0, 0, 0, 0, 0, 0, 0.1]

X = cp.solve(X0)




예제 #26
0
def small_rhombus_grab_stick(n_steps = 10, dx = 1.0):
    """
        See small_rhombus_grab_points. System is only extended with some beams.
    """
    cp = CreasePattern(n_steps = n_steps, MAX_ITER = 500)

    cp.nodes = [[0, 0, 0],
                [0, 1, 0],
                [1, 0, 0],
                [1, 1, 0],
                [0, 0.5, 0],
                [1, 0.5, 0],
                [0.5, 0.5, 0],
                [0.5, 0.45, 0],
                [0.5, 0.55, 0],
                [0.5, 0.5, 0.5]]

    cp.crease_lines = [[0, 2],
                       [0, 4],
                       [0, 6],
                       [1, 3],
                       [1, 4],
                       [1, 6],
                       [2, 5],
                       [2, 6],
                       [3, 5],
                       [3, 6],
                       [4, 6],
                       [5, 6],
                       [7, 9],
                       [8, 9]]

    cp.facets = [[0, 2, 6],
                 [0, 4, 6],
                 [2, 5, 6],
                 [1, 3, 6],
                 [1, 4, 6],
                 [3, 5, 6]]

    cp.grab_pts = [[7, 0],
                   [8, 3]]

    cp.cnstr_lhs = [[(4, 1, 1.0)],
                    [(5, 1, 1.0)],
                    [(4, 2, 1.0)],
                    [(5, 2, 1.0)],
                    [(6, 0, 1.0)],
                    [(0, 1, 1.0), (2, 1, -1.0)],
                    [(1, 1, 1.0), (3, 1, -1.0)],
                    [(9, 2, 1.0)],
                    [(9, 1, 1.0)],
                    [(9, 0, 1.0)]
                    ]

    cp.cnstr_rhs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, dx, 0.0, 0.0]

    X0 = np.zeros((cp.n_dofs,), dtype = float)

    X0[2] = 0.0001
    X0[5] = 0.0001
    X0[8] = 0.0001
    X0[11] = 0.0001
    X0[20] = 0.0002
    X0[23] = 0.000167               # ! Anfangskonfiguration nicht zu ausgepraegt 
    X0[26] = 0.000167               #   waehlen, grabpoints werden sonst abgehaengt

    print 'G_du', cp.get_G_du(X0)
    print 'R', cp.get_G(X0)

    print 'L_vct', cp.grab_pts_L
    print 'n_dofs', cp.n_dofs
    print 'n_c', cp.n_c
    print 'n_g', cp.n_g
    print 'necessary constraints', cp.n_dofs - cp.n_c - cp.n_g * cp.n_d
    print 'cnstr', len(cp.cnstr_lhs)

    X = cp.solve(X0)
    return cp