示例#1
0
def create_torus3_mesh(id, avg_func):
    global n_of_verts_in_init_torus
    file_prefix =   'torus'+ str(n_of_verts_in_init_torus) \
                  + '_3' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    orig_ctrl_mesh.init_as_torus(True, n_of_verts=n_of_verts_in_init_torus)
    return orig_ctrl_mesh, file_prefix
示例#2
0
def create_tetrahedron4_mesh(id, avg_func):
    file_prefix = 'tetrahedron_4' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    orig_ctrl_mesh.init_as_tetrahedron()
    orig_ctrl_mesh = orig_ctrl_mesh.refine_as_catmull_clark(\
        get_edge_vertex_func = DCtrlMesh.get_edge_vertex_as_mid,
        get_vrtx_vertex_func = DCtrlMesh.get_vrtx_vertex_as_copy)
    return orig_ctrl_mesh, file_prefix
示例#3
0
def create_mesh4_stl_file(id, avg_func):
    global stl_file_name
    file_prefix = stl_file_name + '_4' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    inp_file = INP_PATH_PREFIX + stl_file_name
    orig_ctrl_mesh.init_as_triang_mesh_stl_file(inp_file)
    orig_ctrl_mesh = orig_ctrl_mesh.refine_as_catmull_clark(\
        get_edge_vertex_func = DCtrlMesh.get_edge_vertex_as_mid,
        get_vrtx_vertex_func = DCtrlMesh.get_vrtx_vertex_as_copy)
    orig_ctrl_mesh.set_naive_normals()
    return orig_ctrl_mesh, file_prefix
示例#4
0
def create_mesh3_stl_file(id, avg_func):
    global stl_file_name
    file_prefix = stl_file_name + '_3' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    inp_file = INP_PATH_PREFIX + stl_file_name
    orig_ctrl_mesh.init_as_triang_mesh_stl_file(inp_file)
    orig_ctrl_mesh.set_naive_normals()
    return orig_ctrl_mesh, file_prefix
示例#5
0
def create_tube4_mesh(id, avg_func):
    file_prefix = 'tube_4' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    orig_ctrl_mesh.init_as_quad_cube(10.)
    orig_ctrl_mesh.extrude_face(9, 20.)
    dux = 60.
    duy = 60.
    duz = 240.
    orig_ctrl_mesh.id2obj[27].set_pt(np.array([dux, duy, duz]))
    orig_ctrl_mesh.id2obj[31].set_pt(np.array([-dux, duy, duz]))
    orig_ctrl_mesh.id2obj[35].set_pt(np.array([-dux, -duy, duz]))
    orig_ctrl_mesh.id2obj[39].set_pt(np.array([dux, -duy, duz]))
    dux = 60.
    duy = 60.
    duz = 0.4
    orig_ctrl_mesh.id2obj[5].set_pt(np.array([dux, duy, -duz]))
    orig_ctrl_mesh.id2obj[6].set_pt(np.array([dux, -duy, -duz]))
    orig_ctrl_mesh.id2obj[7].set_pt(np.array([-dux, -duy, -duz]))
    orig_ctrl_mesh.id2obj[8].set_pt(np.array([-dux, duy, -duz]))

    orig_ctrl_mesh.set_naive_normals()
    return orig_ctrl_mesh, file_prefix
示例#6
0
def create_tower4_mesh(id, avg_func):
    file_prefix = 'tower_4' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    orig_ctrl_mesh.init_as_quad_cube(10.)
    orig_ctrl_mesh.extrude_face(9, 20.)
    orig_ctrl_mesh.extrude_face(30, 20.)
    orig_ctrl_mesh.extrude_face(34, 20.)
    orig_ctrl_mesh.set_naive_normals()
    #orig_ctrl_mesh.print_ctrl_mesh()
    return orig_ctrl_mesh, file_prefix

    mpl.rcParams['legend.fontsize'] = 10
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d', aspect='equal')
    ax.view_init(azim=30, elev=25)
    orig_ctrl_mesh.plot(ax, True, 'k')
    plt.show()
    return orig_ctrl_mesh, file_prefix
示例#7
0
def create_tetrahedron3_mesh(id, avg_func):
    file_prefix = 'tetrahedron_3' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    orig_ctrl_mesh.init_as_tetrahedron()
    return orig_ctrl_mesh, file_prefix
示例#8
0
def create_crystal3_mesh(id, avg_func):
    file_prefix = 'crystal_3' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    offset = 10.
    fktr = 3.
    orig_ctrl_mesh.init_as_tetrahedron(offset)
    orig_ctrl_mesh.extrude_3triang_face(5, fktr * offset)
    #orig_ctrl_mesh.extrude_3triang_face(6, fktr * offset)
    orig_ctrl_mesh.extrude_3triang_face(7, fktr * offset)
    #orig_ctrl_mesh.extrude_3triang_face(8, fktr * offset)
    fids = [f.eid for f in orig_ctrl_mesh.f]
    for i in fids:
        orig_ctrl_mesh.extrude_3triang_face(i, 0)
    orig_ctrl_mesh.set_naive_normals()
    return orig_ctrl_mesh, file_prefix
示例#9
0
def create_cube3_mesh(id, avg_func):
    file_prefix = 'cube_3' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    orig_ctrl_mesh.init_as_triang_cube(10.)
    orig_ctrl_mesh.set_naive_normals()
    return orig_ctrl_mesh, file_prefix
示例#10
0
def create_cube4_mesh(id, avg_func):
    file_prefix = 'cube_4' + avg_fn_to_str(avg_func)
    orig_ctrl_mesh = DCtrlMesh(id, avg_func)
    orig_ctrl_mesh.init_as_quad_cube(10.)
    return orig_ctrl_mesh, file_prefix