本文整理汇总了Python中oricrete.folding.CreasePattern类的典型用法代码示例。如果您正苦于以下问题:Python CreasePattern类的具体用法?Python CreasePattern怎么用?Python CreasePattern使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CreasePattern类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: moving_truss_cp_square
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