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


Python trimesh.load_mesh方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: import trimesh [as 別名]
# 或者: from trimesh import load_mesh [as 別名]
def __init__(self, fname):
        self.mesh = trimesh.load_mesh(fname)
        median = np.mean(self.mesh.bounds[:, :], axis=0)
        self.mesh.apply_translation(-median)
        max_length = np.max(np.abs(self.mesh.bounds[:, :]))
        length = 1.0 / (max_length * 2.0)
        self.mesh.apply_scale(length) 
開發者ID:grossjohannes,項目名稱:AlignNet-3D,代碼行數:9,代碼來源:pointcloud.py

示例2: read_3d_obj

# 需要導入模塊: import trimesh [as 別名]
# 或者: from trimesh import load_mesh [as 別名]
def read_3d_obj(fname="lion_data.npy", fname_obj="lion-reference.obj"):

    if os.path.isfile(fname):
        return np.load(fname)
    else:

        mesh = trimesh.load_mesh(fname_obj)
        a = np.array(mesh.vertices)
        x,y,z = -a[:,0],a[:,2],a[:,1]
        data = np.array(list(zip(x,y,z)))
        
        np.save(fname, data)

        return data 
開發者ID:ksanjeevan,項目名稱:mapper-tda,代碼行數:16,代碼來源:em_3d_help.py

示例3: __call__

# 需要導入模塊: import trimesh [as 別名]
# 或者: from trimesh import load_mesh [as 別名]
def __call__(self, path):
        mesh = trimesh.load_mesh(path)
        mesh.remove_degenerate_faces()
        mesh.fix_normals()
        mesh.fill_holes()
        mesh.remove_duplicate_faces()
        mesh.remove_infinite_values()
        mesh.remove_unreferenced_vertices()

        mesh.apply_translation(-mesh.centroid)

        r = np.max(np.linalg.norm(mesh.vertices, axis=-1))
        mesh.apply_scale(1 / r)

        if self.tr > 0:
            tr = np.random.rand() * self.tr
            rot = rnd_rot()
            mesh.apply_transform(rot)
            mesh.apply_translation([tr, 0, 0])

            if not self.rot:
                mesh.apply_transform(rot.T)

        if self.rot:
            mesh.apply_transform(rnd_rot())

        r = np.max(np.linalg.norm(mesh.vertices, axis=-1))
        mesh.apply_scale(0.99 / r)

        return mesh 
開發者ID:jonas-koehler,項目名稱:s2cnn,代碼行數:32,代碼來源:dataset.py

示例4: load_mesh

# 需要導入模塊: import trimesh [as 別名]
# 或者: from trimesh import load_mesh [as 別名]
def load_mesh(mesh_path):
    """Loads a mesh from file &computes it's centroid using V-REP style."""

    mesh = trimesh.load_mesh(mesh_path)

    # V-REP encodes the object centroid as the literal center of the object,
    # so we need to make sure the points are centered the same way
    center = lib.utils.calc_mesh_centroid(mesh, center_type='vrep')
    mesh.vertices -= center
    return mesh 
開發者ID:mveres01,項目名稱:multi-contact-grasping,代碼行數:12,代碼來源:collect_grasps.py

示例5: plot_mesh

# 需要導入模塊: import trimesh [as 別名]
# 或者: from trimesh import load_mesh [as 別名]
def plot_mesh(mesh_path, workspace2obj, axis=None):
    """Visualize where we will sample grasp candidates from

    Parameters
    ----------
    mesh_path : path to a given mesh
    workspace2obj : 4x4 transform matrix from the workspace to object
    axis : (optional) a matplotlib axis for plotting a figure
    """

    if axis is None:
        figure = plt.figure()
        axis = Axes3D(figure)
        axis.autoscale(False)

    # Load the object mesh
    mesh = trimesh.load_mesh(mesh_path)

    # V-REP encodes the object centroid as the literal center of the object,
    # so we need to make sure the points are centered the same way
    center = calc_mesh_centroid(mesh, center_type='vrep')
    mesh.vertices -= center

    # Rotate the vertices so they're in the frame of the workspace
    mesh.apply_transform(workspace2obj)

    # Construct a 3D mesh via matplotlibs 'PolyCollection'
    poly = Poly3DCollection(mesh.triangles, linewidths=0.05, alpha=0.25)
    poly.set_facecolor([0.5, 0.5, 1])
    axis.add_collection3d(poly)

    return plot_equal_aspect(mesh.vertices, axis) 
開發者ID:mveres01,項目名稱:multi-contact-grasping,代碼行數:34,代碼來源:utils.py

示例6: _getMesh

# 需要導入模塊: import trimesh [as 別名]
# 或者: from trimesh import load_mesh [as 別名]
def _getMesh(fname, change_units_from='mm'):
    change_units_from = change_units_from.lower()
    mesh = trimesh.load_mesh(fname)
    if change_units_from is not 'mm':
        mesh.units = change_units_from
        mesh.convert_units('mm')
    return mesh 
開發者ID:VanHulleOne,項目名稱:SciSlice,代碼行數:9,代碼來源:doneshapes.py


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