Skip to content

Commit

Permalink
Merge pull request #346 from K3D-tools/devel
Browse files Browse the repository at this point in the history
2.13.0
  • Loading branch information
artur-trzesiok authored May 17, 2022
2 parents 1b034dd + 422bea6 commit f68df78
Show file tree
Hide file tree
Showing 148 changed files with 2,779 additions and 1,128 deletions.
6 changes: 4 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
git add and git commit
rm -rf build
rm -rf dist
python setup.py sdist upload
python setup.py bdist_wheel upload
pip install -ve .
python setup.py sdist
python setup.py bdist_wheel
twine upload dist/*
cd js
grunt build
npm publish
Expand Down
4 changes: 2 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip install -ve .
jupyter nbextension install --py --user k3d
jupyter nbextension enable --py --user k3d
python setup.py sdist
python setup.py bdist_wheel
@REM python setup.py sdist
@REM python setup.py bdist_wheel
12 changes: 6 additions & 6 deletions docs/source/basic_functionality/Camera.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Camera
======

Camera is 9-th vector:
The camera state is determined by a 9-th degree vector:

.. code::
Expand All @@ -12,8 +12,8 @@ Camera is 9-th vector:
]
Is is synchronized between frontend and backend automatically.
Below there is an example of camera manipulation in Python backend.
It is synchronized between the frontend and backend automatically.
There is an example below of camera manipulation using the Python backend.


.. code::
Expand All @@ -31,7 +31,7 @@ Below there is an example of camera manipulation in Python backend.
.. k3d_plot ::
:filename: camera/camera01.py
Look at bigger icosahedron from above (z>0) and first quarter of xy plane:
Look at the bigger icosahedron from above (z>0) and from the first quarter of xy plane:

.. code::
Expand All @@ -42,7 +42,7 @@ Look at bigger icosahedron from above (z>0) and first quarter of xy plane:
.. k3d_plot ::
:filename: camera/camera02.py
Look at smaller icosahedron from above (z>0)
Look at the smaller icosahedron from above (z>0)

.. code::
Expand All @@ -53,7 +53,7 @@ Look at smaller icosahedron from above (z>0)
.. k3d_plot ::
:filename: camera/camera03.py
Look at larger icosahedron from a point above its center orienting camera to have y-axis up.
Look at the larger icosahedron from a point above its center, orienting camera to have y-axis up.

.. code::
Expand Down
7 changes: 3 additions & 4 deletions docs/source/basic_functionality/Implicit_plot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ In this case a function of three variables is sampled on 3d equidistant grid and
an `k3d.marching_cubes` object which will do the visualization.

Note that:
- data exchanged between frontend and backend is big
- browser javascript does mesh computation
- the amount of data exchanged between the frontend and backend is big
- the browser javascript does the mesh computations
- `level` is a single scalar parameter which can be passed to the frontend for data exploration
- it is possible to use [jslink](https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Events.html#Linking-widgets-attributes-from-the-client-side) for interaction without a Python kernel].
- it is possible to use `jslink <https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Events.html#Linking-widgets-attributes-from-the-client-side>`_ for interaction without a Python kernel.

.. code::
Expand Down Expand Up @@ -37,7 +37,6 @@ Note that:
zmin=zmin, zmax=zmax, level=0.0,
flat_shading=False)
plot += plt_iso
plot += plt_iso
plot.display()
.. k3d_plot ::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ There are two ways of changing data in the plot:
.. k3d_plot ::
:filename: interaction/Interaction01.py
Using backend to send a data at each timestep
Using the backend to send data at each timestep
---------------------------------------------

The Python backend can update attribute of any plot object in K3D-jupyter.
Expand All @@ -36,7 +36,7 @@ The Python backend can update attribute of any plot object in K3D-jupyter.
Sending a dictionary of all timesteps
-------------------------------------

In this case it is possible to play an animation using only frontend.
In this case it is possible to play an animation using only the frontend.
Time is a string denoting wall time.

.. code::
Expand All @@ -46,7 +46,7 @@ Time is a string denoting wall time.
.. k3d_plot ::
:filename: interaction/Interaction02.py
The animation can be controlled from GUI or by several attributes:
The animation can be controlled from the GUI or by several attributes:

.. code::
Expand All @@ -58,7 +58,7 @@ The number of frames which are played can be inspected or set with plot.fps attr
plot.fps
One can programatically change or read the time in the animation using:
One can programmatically change or read the time in the animation using:

.. code::
Expand Down
5 changes: 2 additions & 3 deletions docs/source/basic_functionality/Line.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Line
====

Let us draw a trajectory of `N` steps of an approximation to the
[Wiener Process](https://en.wikipedia.org/wiki/Wiener_process) in three dimensions.
Let us draw a trajectory of `N` steps of an approximation to the `Wiener Process <https://en.wikipedia.org/wiki/Wiener_process>`_ in three dimensions.

Below, a blue thin line is a trajectory and the total displacement is shown with red thick line.
Below, a blue thin line is a trajectory and the total displacement is shown with a red thick line.

Line takes data as an array of coordinates `[number_of_points,3]`.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/basic_functionality/Mesh.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Mesh
====

Mesh is an object which displays triangles in 3d. An scalar can be displayed on the mesh
Mesh is an object that displays triangles in 3d. A scalar can be displayed on the mesh
using color map.

.. code::
Expand Down Expand Up @@ -46,7 +46,7 @@ Scalars can be updated interactively using ipywidgets communication:
.. k3d_plot ::
:filename: mesh/Mesh02.py
It is possible to send time series of an attribute values:
It is possible to send a time series consisting of attribute values:

.. code::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/basic_functionality/Points.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Points
======

To draw points one needs to prepare data in the array of coordinates `[number_of_points, 3]`.
To draw points one needs to prepare data as an array of coordinates `[number_of_points, 3]`.
Colors for all the points can either be the same or have an individual value (`colors` attribute).

When the number of points is larger than $10^3$ it is recommended to use fast shaders: `flat`, `
Expand Down
4 changes: 2 additions & 2 deletions docs/source/basic_functionality/Surface.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Surface
=======

`k3d.surface` is an easy way to produce plot of an explicit function of two variables
`k3d.surface` is an easy way to produce a plot of an explicit function of two variables
f(x,y) on a rectangular domain.

It takes a table of values, i.e. `f(x_i,y_i) = f[j,i]`. Proper scaling of x and y
axes can by done by specifying `xmin/xmax` parameters.
axes can be done by specifying `xmin/xmax` parameters.

.. code::
Expand Down
66 changes: 33 additions & 33 deletions docs/source/basic_plotting.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Basic plottting
Basic plottting
===============

Creating and displaying a plot
Expand All @@ -15,10 +15,10 @@ To show the plot below a Jupyter cell, we call its ``display()`` method.
import k3d
plot = k3d.plot()
# here you would normally create objects to display
# and add them to the plot
plot.display()
If K3D-jupyter is installed properly, after executing the above snippet you
Expand Down Expand Up @@ -47,7 +47,7 @@ In the next example we will learn how to display objects on the plot.
.. code:: ipython3
import k3d
k3d.points([0, 0, 0])
This is, however not a good practice, because a ``Plot`` object is created
Expand All @@ -60,7 +60,7 @@ Adding objects to plot
----------------------

The main idea is that plot objects (e.g. lines, meshed wtc) are
interactively added to the plot.
interactively added to the plot.

To draw the triangle we will use the ``mesh()`` method from the ``k3d``
module. This method creates a ``Mesh`` object, which can be added to a
Expand All @@ -70,15 +70,15 @@ K3D ``Plot``.
import k3d
plot = k3d.plot()
vertices = [[0, 0, 0], [1, 0, 0], [0, 0, 1]]
indices = [[0, 1, 2]]
mesh = k3d.mesh(vertices, indices)
plot += mesh
plot.display()
.. k3d_plot ::
Expand All @@ -105,14 +105,14 @@ variables:

.. code:: ipython3
plot += k3d.mesh([0, 1, 1,
1, 1, 0,
plot += k3d.mesh([0, 1, 1,
1, 1, 0,
1, 1, 1,
1, 2, 2,
1, 1, 1,
2, 1, 1], [0, 1, 2, 3, 4, 5], color=0x00ff00)
plot
.. k3d_plot ::
Expand All @@ -126,7 +126,7 @@ variables:
:figclass: align-center

One blue and two green triangles



This is a plot of two meshes. Please note – in the second case we didn’t
Expand Down Expand Up @@ -160,7 +160,7 @@ place, where having named our objects beforehand comes in handy:
Having variables is also convenient when we want to modify the objects
already shown.
already shown.



Expand All @@ -187,8 +187,8 @@ with wheel / both mose buttons: zooms in or out (only vertical)
To return to the default camera position, press the “Camera reset” icon
from the top-right toolbar

Fullscreen mode and detachted mode
++++++++++++++++++++++++++++++++++
Fullscreen mode and detached mode
+++++++++++++++++++++++++++++++++

It is possible to switch the plot to fullscreen mode using the
“Fullscreen” icon from the toolbar. To exit fullscreen mode press the
Expand All @@ -200,49 +200,49 @@ widget” icon.


.. _snapshots:

Screenshots and snapshots
-------------------------

To save a screenshot of the current view, press the “Save screenshot
icon from the toolbar. It provides better resolution, which can be
controlled by `plot.screenshot_scale` parameter.
To save a screenshot of the current view, press the “Screenshot
button in the Controls section of the toolbar. It provides better resolution, which can be
controlled by the `plot.screenshot_scale` parameter.

The filename will be generated as “K3D-”, then a string of digits
(technically: decimal timestamp) and then “.png”.

.. note: If the `plot.name` is set it will be used as a name of the screenshot.
Screenshots can be made programatically by:
Screenshots can be made programmatically by:

.. code:: ipython3
plot.fetch_screenshot()
The ".png" file is contained in the `plot.screenshot` attribute,
however its synchronization might be a little bit delayed (it relies
on asynchronous traitlets mechanism internally)
on asynchronous traitlets mechanism internally).


Snapshot is a "live" version of a screen in the form of standalone
html file. Similarly to snapshots, it can be done programmatically via:

Snapshot is a "live" version of a screne in the form of stand-alone
html file. Similarily to snapshots it can be done programatically via:



- on the javascript side `plot.fetch_snapshot()`, note that fetching
might take some time, and `plot.snapshot`
might take some time, and `plot.snapshot` won't be set until it finishes
- on the python side `plot.get_snapshot()`

In this case one has to write HTML code to a file:


.. code::
with open('../_static/points.html','w') as fp:
fp.write(plot.snapshot)
Expand Down
Loading

0 comments on commit f68df78

Please sign in to comment.