當前位置: 首頁>>代碼示例>>Python>>正文


Python CreasePattern.get_new_vectors方法代碼示例

本文整理匯總了Python中oricrete.folding.CreasePattern.get_new_vectors方法的典型用法代碼示例。如果您正苦於以下問題:Python CreasePattern.get_new_vectors方法的具體用法?Python CreasePattern.get_new_vectors怎麽用?Python CreasePattern.get_new_vectors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oricrete.folding.CreasePattern的用法示例。


在下文中一共展示了CreasePattern.get_new_vectors方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: twotriangle_stick_cnstr

# 需要導入模塊: from oricrete.folding import CreasePattern [as 別名]
# 或者: from oricrete.folding.CreasePattern import get_new_vectors [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
開發者ID:kelidas,項目名稱:oricrete,代碼行數:61,代碼來源:ex05_triangle.py

示例2: triangle_stick_cnstr

# 需要導入模塊: from oricrete.folding import CreasePattern [as 別名]
# 或者: from oricrete.folding.CreasePattern import get_new_vectors [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
開發者ID:kelidas,項目名稱:oricrete,代碼行數:57,代碼來源:ex05_triangle.py

示例3: triangle_cp_cnstr

# 需要導入模塊: from oricrete.folding import CreasePattern [as 別名]
# 或者: from oricrete.folding.CreasePattern import get_new_vectors [as 別名]
def triangle_cp_cnstr(n_steps = 10, dx = -0.3299999999999):

    """
        This example demonstrates the main funtions of Grabpoints.
        Two Grabpoints are integrated in a single triangle.
        Grabpoint one is used as regulare constrain moved in z-direction.
        Grabpoint two is used as control point, which gives back the coordinations of
        an exact point on the face in every iteration step.

    """

    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[ 0, 0, 0 ],
                [ 1, 0, 0 ],
                [ 1, 1, 0],
                [0.667, 0.333, 0],
                [0.2, 0.1, 0]]

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

    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)],
                    [(3, 2, 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
開發者ID:kelidas,項目名稱:oricrete,代碼行數:57,代碼來源:ex05_triangle.py

示例4: moving_truss_cp_square

# 需要導入模塊: from oricrete.folding import CreasePattern [as 別名]
# 或者: from oricrete.folding.CreasePattern import get_new_vectors [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
開發者ID:kelidas,項目名稱:oricrete,代碼行數:56,代碼來源:ex01_moving_truss.py

示例5: moving_truss_cp_circle

# 需要導入模塊: from oricrete.folding import CreasePattern [as 別名]
# 或者: from oricrete.folding.CreasePattern import get_new_vectors [as 別名]
def moving_truss_cp_circle(n_steps = 40):

    cp = CreasePattern(n_steps = n_steps)

    cp.nodes = [[ 0, 1, 0 ],
                [ 0, -1, 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_ + sp.cos(1.0 * t_))
    face_y_1_t = FF(Rf = x_ + sp.sin(1.0 * t_))
# +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,代碼行數:47,代碼來源:ex01_moving_truss.py

示例6: moving_truss_cp_ff_cnstr

# 需要導入模塊: from oricrete.folding import CreasePattern [as 別名]
# 或者: from oricrete.folding.CreasePattern import get_new_vectors [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
開發者ID:kelidas,項目名稱:oricrete,代碼行數:42,代碼來源:ex01_moving_truss.py

示例7: moving_truss_cp_cnstr

# 需要導入模塊: from oricrete.folding import CreasePattern [as 別名]
# 或者: from oricrete.folding.CreasePattern import get_new_vectors [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
開發者ID:kelidas,項目名稱:oricrete,代碼行數:39,代碼來源:ex01_moving_truss.py


注:本文中的oricrete.folding.CreasePattern.get_new_vectors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。