ase_notebook.backend.threejs module¶
A module for creating a pythreejs visualisation of a structure.
-
class
ase_notebook.backend.threejs.
RenderContainer
(top_level, **kwargs)[source]¶ Bases:
object
Container for the renderer, with attribute access for key elements.
-
ase_notebook.backend.threejs.
add_labels
(element_groups, key_elements, use_label_arrays)[source]¶ Create label elements for the scene.
-
ase_notebook.backend.threejs.
create_arrow_texture
(width=512, height=512, color='red', right=True)[source]¶ Create an array map of an arrow.
-
ase_notebook.backend.threejs.
create_world_axes
(camera, controls, initial_rotation=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), length=30, width=3, camera_fov=10)[source]¶ Create a renderer, containing an axes and camera that is synced to another camera.
adapted from http://jsfiddle.net/aqnL1mx9/
- Parameters
camera (pythreejs.PerspectiveCamera) –
controls (pythreejs.OrbitControls) –
initial_rotation (list or numpy.array) – initial rotation of the axes
length (int) – length of axes lines
width (int) – line width of axes
- Returns
- Return type
pythreejs.Renderer
-
ase_notebook.backend.threejs.
gather_3d_objects
(obj, objects=None)[source]¶ Recurse through objects children, to gather the set of 3D objects.
-
ase_notebook.backend.threejs.
generate_3js_render
(element_groups, canvas_size, zoom, camera_fov=30, background_color='white', background_opacity=1.0, reuse_objects=False, use_atom_arrays=False, use_label_arrays=False)[source]¶ Create a pythreejs scene of the elements.
Regarding initialisation performance, see: https://github.com/jupyter-widgets/pythreejs/issues/154
-
ase_notebook.backend.threejs.
make_basic_gui
(container)[source]¶ Create a basic GUI layout.
- Parameters
container (RenderContainer) –
- Returns
- Return type
ipywidgets.GridspecLayout