本文整理汇总了Python中oricrete.folding.CreasePattern.get_R方法的典型用法代码示例。如果您正苦于以下问题:Python CreasePattern.get_R方法的具体用法?Python CreasePattern.get_R怎么用?Python CreasePattern.get_R使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oricrete.folding.CreasePattern
的用法示例。
在下文中一共展示了CreasePattern.get_R方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: moving_truss_cp_square
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import get_R [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 = FF(Rf = z_ - 0)
face_x_0 = FF(Rf = x_ - 0)
# face_xy_135 = FF(Rf = x_ + y_ - 1.0)
# face_xy_round = FF(Rf = x_**2 + (y_)**2 - 1.0)
# face_x_1_t = FF(Rf = x_ - 1.0 + 1.99 * t_)
# argument = 2*3.14159*t_
# face_x_1_t = FF(Rf = y_ + 3 + sp.sin(argument))
face_x_1_t = FF(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 = FF(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 = FF(Rf = y_ - 1.99 * t_)
cp.cnstr_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_R(X)
print 'initial dR\n', cp.get_dR(X)
X = cp.solve_ff(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
示例2: moving_truss_cp_ff_cnstr
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import get_R [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 = FF(Rf = z_ - 0)
face_x_0 = FF(Rf = x_ - 0)
face_x_1_t = FF(Rf = x_ - 1.0 + 1.99 * t_)
cp.cnstr_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_R(X)
print 'initial dR\n', cp.get_dR(X)
X = cp.solve_ff(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
示例3: moving_truss_cp_cnstr
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import get_R [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_R(X)
print 'initial dR\n', cp.get_dR(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
示例4: rhombus_3x3_crane
# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import get_R [as 别名]
#.........这里部分代码省略.........
[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