Skip to content

Commit

Permalink
Merge pull request #48 from martinRenou/docs
Browse files Browse the repository at this point in the history
Add docs
  • Loading branch information
martinRenou committed Sep 17, 2020
2 parents b230d26 + 063477d commit a3de32a
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ipygany
jupyter-sphinx==0.2.4a1
Binary file added docs/source/assets/fastscapelib_topo.vtk
Binary file not shown.
Binary file added docs/source/assets/piston.vtu
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sphinx_rtd_theme

extensions = [
# 'jupyter_sphinx',
'jupyter_sphinx',
]

templates_path = ['_templates']
Expand All @@ -26,4 +26,4 @@ def setup(app):
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
htmlhelp_basename = 'ipyganydoc'
html_static_path = ['_static']
html_static_path = []
51 changes: 51 additions & 0 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,54 @@

Usage
=====

``ipygany`` provides a set of tools for loading and analyzing 3D meshes in the Jupyter Notebook.

Loading your mesh in the Notebook
---------------------------------

``ipygany`` provides a ``PolyMesh`` class for loading triangle-based meshes, and a ``TetraMesh`` class for tetrahedron-based meshes.
Your meshes can be structured or unstructured grids.

You can either use vtk to load your meshes, or manually pass vertices buffers.

You need to create a 3D ``Scene`` widget in order to display your loaded mesh in the page.

.. jupyter-execute::

from ipygany import Scene, PolyMesh

mesh = PolyMesh.from_vtk('source/assets/fastscapelib_topo.vtk')
mesh.default_color = 'gray'

scene = Scene([mesh])
scene


Applying effects to your mesh
-----------------------------

You can apply multiple effects to your mesh for quick analysis, most of those effects are performed on the GPU, hence are super fast.

.. jupyter-execute::

from ipygany import IsoColor, Warp

colored_mesh = IsoColor(mesh, input='H', min=0., max=1003.)
warped_mesh = Warp(colored_mesh, input=(0, 0, ('H', 'X1')), warp_factor=0.)

scene2 = Scene([warped_mesh])
scene2


You can then control some parameters using other widgets:

.. jupyter-execute::

from ipywidgets import FloatSlider, jslink

warp_slider = FloatSlider(value=0., min=0., max=3.)

jslink((warped_mesh, 'factor'), (warp_slider, 'value'))

warp_slider

0 comments on commit a3de32a

Please sign in to comment.