当前位置: 首页>>代码示例>>Python>>正文


Python CreasePattern.cnstr_lst方法代码示例

本文整理汇总了Python中oricrete.folding.CreasePattern.cnstr_lst方法的典型用法代码示例。如果您正苦于以下问题:Python CreasePattern.cnstr_lst方法的具体用法?Python CreasePattern.cnstr_lst怎么用?Python CreasePattern.cnstr_lst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oricrete.folding.CreasePattern的用法示例。


在下文中一共展示了CreasePattern.cnstr_lst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: moving_truss_cp_square

# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import cnstr_lst [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
开发者ID:MatthiasSch,项目名称:local,代码行数:56,代码来源:ex01_moving_truss.py

示例2: moving_truss_cp_ff_cnstr

# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import cnstr_lst [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
开发者ID:MatthiasSch,项目名称:local,代码行数:42,代码来源:ex01_moving_truss.py

示例3: CreasePattern

# 需要导入模块: from oricrete.folding import CreasePattern [as 别名]
# 或者: from oricrete.folding.CreasePattern import cnstr_lst [as 别名]
# 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, FF, x_, y_, z_, t_ , \
    CreasePatternView

import numpy as np

if __name__ == '__main__':

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

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

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

    print 'R_ff', cp.get_cnstr_R_ff(X0, 1)
    print 'dR_ff', cp.get_cnstr_dR_ff(X0, 0)
    print 'X ff final', cp.solve_ff(X0)

    cpv = CreasePatternView(data = cp, show_cnstr = True)
    cpv.configure_traits()
开发者ID:MatthiasSch,项目名称:local,代码行数:32,代码来源:ex00_point_on_face.py


注:本文中的oricrete.folding.CreasePattern.cnstr_lst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。