本文整理汇总了Python中pythreejs.Mesh方法的典型用法代码示例。如果您正苦于以下问题:Python pythreejs.Mesh方法的具体用法?Python pythreejs.Mesh怎么用?Python pythreejs.Mesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pythreejs
的用法示例。
在下文中一共展示了pythreejs.Mesh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_mesh
# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Mesh [as 别名]
def get_mesh(fname):
return Mesh(fname)
示例2: show
# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Mesh [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()