Skip to content

Commit b04641a

Browse files
committed
Start on documentation
1 parent bb36110 commit b04641a

File tree

2 files changed

+113
-11
lines changed

2 files changed

+113
-11
lines changed

docs/source/index.rst

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,50 @@
1-
.. pythreejs documentation master file, created by
2-
sphinx-quickstart on Tue Apr 4 13:24:33 2017.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
51

6-
Welcome to pythreejs's documentation!
2+
pythreejs
73
=====================================
84

5+
Version: |release|
6+
7+
**pythreejs** is a `Jupyter widgets`_ based `notebook`_ extension that allows Jupyter to leverage
8+
the WebGL capabilities of modern browsers by creating bindings to the javascript library `three.js`_.
9+
10+
11+
By being based on top of the jupyter-widgets infrastructure, it allows for eased integration
12+
with other interactive tools for notebooks.
13+
14+
15+
Quickstart
16+
----------
17+
18+
To get started with pythreejs, install with pip::
19+
20+
pip install pythreejs
21+
22+
.. TODO: Config calls
23+
24+
25+
Contents
26+
--------
27+
928
.. toctree::
1029
:maxdepth: 2
11-
:caption: Contents:
30+
:caption: Installation and usage
31+
32+
installing
33+
introduction
34+
35+
36+
.. toctree::
37+
:maxdepth: 2
38+
:caption: Development
39+
40+
develop-install
41+
42+
1243

44+
.. links
1345
46+
.. _`Jupyter widgets`: https://jupyter.org/widgets.html
1447

15-
Indices and tables
16-
==================
48+
.. _`notebook`: https://jupyter-notebook.readthedocs.io/en/latest/
1749

18-
* :ref:`genindex`
19-
* :ref:`modindex`
20-
* :ref:`search`
50+
.. _`three.js`: https://threejs.org/

docs/source/introduction.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
=============
2+
Introduction
3+
=============
4+
5+
The pythreejs API attempts to mimic the three.js API as closely as possible, so
6+
any resource on its API should also be helpful for understanding pythreejs. See for
7+
example the `official three.js documentation`_.
8+
9+
The major difference between the two is the render loop. As we normally do not
10+
want to call back to the kernel for every rendered frame, some helper classes
11+
have been created to allow for user interaction with the scene with minimal
12+
overhead:
13+
14+
15+
Renderer classes
16+
----------------
17+
While the :py:class:`~pythreejs.WebGLRenderer` class mimics its three.js
18+
counterpart in only rendering frames on demand (one frame per call to its
19+
:py:meth:`~pythreejs.WebGLRenderer.render` method), the :py:class:`~pythreejs.Renderer` class
20+
sets up an interactive render loop allowing for `interactive controls`_ and `animation`_.
21+
Similarly, a :py:class:`~pythreejs.Preview` widget allows for a quick visualization of various
22+
threejs objects.
23+
24+
25+
.. _interactive controls:
26+
27+
Interactive controls
28+
--------------------
29+
These are classes for managing user interaction with the WebGL canvas,
30+
and translating that into actions. One example is the :py:class:`~pythreejs.OrbitControls`
31+
class, which allows the user to control the camera by zooming, panning, and orbital rotation
32+
around a target. Another example is the :py:class:`~pythreejs.Picker` widget, which allows
33+
for getting the objects and surface coordinates underneath the mouse cursor.
34+
35+
36+
.. _animation:
37+
38+
Animation views
39+
---------------
40+
The view widgets for the :py:class:`~pythreejs.AnimationAction` class
41+
gives interactive controls to the user for controlling a `threejs animation`_.
42+
43+
44+
-------
45+
46+
47+
Other notable deviations from the threejs API are listed below:
48+
49+
- Buffers are based on `numpy arrays`_, with their inbuilt knowledge of shape and dtype.
50+
As such, most threejs APIs that take a buffer is slightly modified (fewer options need
51+
to be specified explicitly).
52+
53+
- The generative geometry objects (e.g. :py:class:`~pythreejs.SphereGeometry` and
54+
:py:class:`~pythreejs.BoxBufferGeometry`) do not sync their vertices or similar data
55+
by default. To gain acess to the generated data, convert them to either the
56+
:py:class:`~pythreejs.Geometry` or :py:class:`~pythreejs.BufferGeometry` type with
57+
the :py:meth:`~pythreejs.BufferGeometry.from_ref` factory method. See the method
58+
documentation for further details.
59+
60+
- Methods are often not mirrored to the Python side. However, they can be
61+
executed with the :py:meth:`~pythreejs.ThreeWidget.exec_three_obj_method` method.
62+
Consider contributing
63+
64+
65+
66+
.. links
67+
68+
.. _`official three.js documentation`: https://threejs.org/docs/
69+
70+
.. _`threejs animation`: https://threejs.org/docs/#manual/introduction/Animation-system
71+
72+
.. _`numpy arrays`: https://www.numpy.org/

0 commit comments

Comments
 (0)