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


Python pythreejs.Geometry方法代码示例

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


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

示例1: joint_children

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Geometry [as 别名]
def joint_children(joints3D, color="blue", links=None):
    material = p3js.LineBasicMaterial(color=color, linewidth=4)

    scene_children = []
    # For each 24 joint
    if links is None:
        links = [
            (0, 1, 2, 3, 4),
            (0, 5, 6, 7, 8),
            (0, 9, 10, 11, 12),
            (0, 13, 14, 15, 16),
            (0, 17, 18, 19, 20),
        ]
    for link in links:
        for j1, j2 in zip(link[0:-1], link[1:]):
            geometry = p3js.Geometry(vertices=joints3D[(j1, j2), :].tolist())
            line = p3js.Line(geometry, material)
            scene_children.append(line)
    return scene_children 
开发者ID:hassony2,项目名称:obman_train,代码行数:21,代码来源:visualizemeshes.py

示例2: lines_children

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Geometry [as 别名]
def lines_children(origins, targets, color="blue"):
    material = p3js.LineBasicMaterial(color=color, linewidth=4)

    scene_children = []
    # For each 24 joint
    for origin, target in zip(origins, targets):
        geometry = p3js.Geometry(vertices=np.array([origin, target]).tolist())
        line = p3js.Line(geometry, material)
        scene_children.append(line)
    return scene_children 
开发者ID:hassony2,项目名称:obman_train,代码行数:12,代码来源:visualizemeshes.py

示例3: get_polylines_pythreejs

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Geometry [as 别名]
def get_polylines_pythreejs(polylines):
    lines = []
    for x in polylines:
        line_geometry = pythreejs.Geometry(
            vertices=x["vertices"])
        linewidth = x.get("linewidth", 1.0)
        line = pythreejs.Line(
            geometry=line_geometry,
            material=pythreejs.LineBasicMaterial(color=x["color"], linewidth=linewidth),
            type='LinePieces')
        lines.append(line)

    return lines 
开发者ID:daavoo,项目名称:pyntcloud,代码行数:15,代码来源:pythreejs_backend.py

示例4: show

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Geometry [as 别名]
def show(self, show_point_color=False):
        initial_point_size = 0.03
        point_materials = []
        for idx, (name, points) in enumerate(self.points.items()):
            if idx == 0:
                cloud = PyntCloud(points.get_points(show_point_color=show_point_color))
                #  print(clean_polylines(self.polylines))
                self.scene = cloud.plot(return_scene=True, initial_point_size=initial_point_size, polylines=clean_polylines(self.polylines), background=self.background)
                pss = [ps for ps in self.scene.children if type(ps) == pythreejs.objects.Points_autogen.Points]
                assert len(pss) > 0
                pss[0].name = name
                if points.opacity is not None:
                    pss[0].material.opacity = points.opacity
                    pss[0].material.transparent = True
                point_materials.append(pss[0].material)
            else:
                ppoints = get_points(points.points, points.color, show_point_color=show_point_color)
                ps = pyntcloud.plot.pythreejs_backend.get_pointcloud_pythreejs(ppoints[["x", "y", "z"]].values, ppoints[['red', 'green', 'blue']].values / 255.)
                ps.name = name
                ps.material.size = initial_point_size
                self.scene.children = [ps] + list(self.scene.children)
                if points.opacity is not None:
                    ps.material.opacity = points.opacity
                    ps.material.transparent = True
                #  if name == 'original':
                #      ps.material.opacity = 0.3
                #      ps.material.transparent = True
                point_materials.append(ps.material)

        for idx, (name, mesh) in enumerate(self.meshes.items()):
            # https://render.githubusercontent.com/view/ipynb?commit=645ea6bea758555978f83bd0004ce561fa58d99c&enc_url=68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6a7570797465722d776964676574732f707974687265656a732f363435656136626561373538353535393738663833626430303034636535363166613538643939632f6578616d706c65732f4578616d706c65732e6970796e62&nwo=jupyter-widgets%2Fpythreejs&path=examples%2FExamples.ipynb&repository_id=15400194&repository_type=Repository#Buffer-Geometries
            vertices = mesh.get_vertices()
            faces = mesh.get_faces()
            vertexcolors = ['#ff0000' for _ in range(len(vertices))]
            # Map the vertex colors into the 'color' slot of the faces
            faces = [f + [None, [vertexcolors[i] for i in f], None] for f in faces]
            geometry = pythreejs.Geometry(vertices=vertices, faces=faces, colors=vertexcolors)
            geometry.exec_three_obj_method('computeFaceNormals')
            mesh_obj = pythreejs.Mesh(geometry=geometry, material=pythreejs.MeshBasicMaterial(color='white', side='DoubleSide'), position=[0, 0, 0])
            mesh_obj.name = name
            self.scene.children = [mesh_obj] + list(self.scene.children)

        for key, value in self.visibility_dict.items():
            self.change_visibility(key, value)

        widgets = []
        size = ipywidgets.FloatSlider(value=initial_point_size, min=0.0, max=initial_point_size * 10, step=initial_point_size / 100)
        for point_materials in point_materials:
            ipywidgets.jslink((size, 'value'), (point_materials, 'size'))
        widgets.append(ipywidgets.Label('Point size:'))
        widgets.append(size)
        display(ipywidgets.HBox(children=widgets))


#  if __name__ == '__main__':
#      test() 
开发者ID:grossjohannes,项目名称:AlignNet-3D,代码行数:58,代码来源:pointcloud.py

示例5: ray2mesh

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Geometry [as 别名]
def ray2mesh(ray):
    rays=py3js.Group()

    w = ray.wavelength
    rc, gc, bc = wavelength2RGB(w)
    rc=int(255*rc)
    gc=int(255*gc)
    bc=int(255*bc)
    material = py3js.LineBasicMaterial(color = "#{:02X}{:02X}{:02X}".format(rc,gc,bc))



    rl = ray2list(ray)

    for r in rl:
        geometry = py3js.Geometry()
        geometry.vertices =  r
        line = py3js.Line( geometry, material)
        rays.add(line)

    return rays


#def ray2mesh(ray):
#    rays=py3js.Group()

#    P1 = ray.pos
#    w = ray.wavelength
#    rc, gc, bc = wavelength2RGB(w)
#    rc=int(255*rc)
#    gc=int(255*gc)
#    bc=int(255*bc)
#    material = py3js.LineBasicMaterial(color = "#{:02X}{:02X}{:02X}".format(rc,gc,bc))

#    if len(ray.childs) > 0:
#        P2 = ray.childs[0].pos
#    else:
#        P2 = P1 + 10. * ray.dir
    
#    if ray.intensity != 0:
        
#        geometry = py3js.Geometry()
    
#        geometry.vertices =  [list(P1),list(P2)]
        
#        line = py3js.Line( geometry, material)
        
#        rays.add(line)
    
#    for i in ray.childs:
#        rays.add(ray2mesh(i))
#    return rays 
开发者ID:cihologramas,项目名称:pyoptools,代码行数:54,代码来源:ipywidgets.py


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