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


Python pythreejs.Scene方法代码示例

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


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

示例1: _default_scene

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Scene [as 别名]
def _default_scene(self):
        # could be removed when https://github.com/jovyan/pythreejs/issues/176 is solved
        # the default for pythreejs is white, which leads the volume rendering pass to make everything white
        return pythreejs.Scene(background=None) 
开发者ID:maartenbreddels,项目名称:ipyvolume,代码行数:6,代码来源:widgets.py

示例2: __init__

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Scene [as 别名]
def __init__(self, settings):
        self.__update_settings(settings)
        self._light = p3s.DirectionalLight(color='white', position=[0, 0, 1], intensity=0.6)
        self._light2 = p3s.AmbientLight(intensity=0.5)
        self._cam = p3s.PerspectiveCamera(position=[0, 0, 1], lookAt=[0, 0, 0], fov=self.__s["fov"],
                                     aspect=self.__s["width"]/self.__s["height"], children=[self._light])
        self._orbit = p3s.OrbitControls(controlling=self._cam)
        self._scene = p3s.Scene(children=[self._cam, self._light2], background=self.__s["background"])#"#4c4c80"
        self._renderer = p3s.Renderer(camera=self._cam, scene = self._scene, controls=[self._orbit],
                    width=self.__s["width"], height=self.__s["height"], antialias=self.__s["antialias"])

        self.__objects = {}
        self.__cnt = 0 
开发者ID:skoch9,项目名称:meshplot,代码行数:15,代码来源:Viewer.py

示例3: Plot3D

# 需要导入模块: import pythreejs [as 别名]
# 或者: from pythreejs import Scene [as 别名]
def Plot3D(S,size=(800,200),center=(0,0,0), rot=[(pi/3., pi/6., 0 )],scale=1):
    """Function to create 3D interactive visualization widgets in a jupyter 
    notebook

    Args:
        S: (:class:`~pyoptools.raytrace.system.System`,
            :class:`~pyoptools.raytrace.component.Component` or
            :class:`~pyoptools.raytrace.component.Component`) Object to plot
        size: (Tuple(float,float)) Field of view in X and Y for the window
            shown in the notebook.
        center: (Tuple(float,float,float) Coordinate of the center of the
            visualization window given in the coordinate system of the object
            to plot.
        rot:   List of tuples. Each tuple describe an (Rx, Ry, Rz) rotation and
               are applied in order to generate the first view of the window. 
        scale: (float)  Scale factor applied to the rendered window

    Returns:
        pyjs renderer needed to show the image in the jupiter notebook.

    """
    width,height=size
    
    
    light =  py3js.DirectionalLight(color='#ffffff',
                                    intensity=.7,
                                    position=[0, 1000,0])
    alight =  py3js.AmbientLight(color='#777777',)

    
    # Set up a scene and render it:
    #cam = py3js.PerspectiveCamera(position=[0, 0, 500], fov=70, children=[light], aspect=width / height)

    pos = array((0, 0, 500))

    for r in rot:
        pos=dot(rot_z(r[2]),pos)
        pos=dot(rot_y(r[1]),pos)
        pos=dot(rot_x(r[0]),pos)
    
    cam = py3js.OrthographicCamera(-width/2*scale,width/2*scale, height/2*scale,
                                   -height/2*scale,children=[light],
                                   position=list(pos),
                                   zoom=scale)

    if isinstance(S,System):
        c=sys2mesh(S)
    elif isinstance(S,Component):
        c=comp2mesh(S,(0,0,0),(0,0,0))
    else:
        c=surf2mesh(S,(0,0,0),(0,0,0))

        
    scene = py3js.Scene(children=[c, alight,cam],background="#000000")
    oc=py3js.OrbitControls(controlling=cam)
    oc.target=center
    renderer = py3js.Renderer(camera=cam, background='black', background_opacity=1,
                          scene=scene, controls=[oc],width=width*scale, height=height*scale)

    return(renderer) 
开发者ID:cihologramas,项目名称:pyoptools,代码行数:62,代码来源:ipywidgets.py


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