本文整理汇总了Python中oricrete.folding.CreasePattern.solve方法的典型用法代码示例。如果您正苦于以下问题:Python CreasePattern.solve方法的具体用法?Python CreasePattern.solve怎么用?Python CreasePattern.solve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oricrete.folding.CreasePattern
的用法示例。
在下文中一共展示了CreasePattern.solve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BeispielCode2
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: BeispielCode4
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: BeispielCode3
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: twotriangle_stick_cnstr
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: triangle_stick_cnstr
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: halfcrane_2sticks
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: moving_truss_cp_square
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: BeispielCode5
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: moving_truss_cp_ff_cnstr
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: moving_truss_cp_cnstr
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
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: rhombus_2x3_grab_points
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
#.........这里部分代码省略.........
[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: rhombus_2x2_grab_points
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
#.........这里部分代码省略.........
[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: two_rhombus_grab_points
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
#.........这里部分代码省略.........
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: rhombus_3x3_crane
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
#.........这里部分代码省略.........
[(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: rhombus_3x2_crane
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import solve [as 别名]
#.........这里部分代码省略.........
[(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