Skip to content

Commit

Permalink
Merge pull request #2 from RobinEnjalbert/v25.0
Browse files Browse the repository at this point in the history
Update doc, add license.
  • Loading branch information
RobinEnjalbert authored Nov 13, 2024
2 parents 90487fb + ee0fa7c commit 859be45
Show file tree
Hide file tree
Showing 10 changed files with 733 additions and 75 deletions.
504 changes: 504 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SimRender

A **Python** library for **3D interactive rendering** of **numerical simulations**.
A **Python** module for **3D interactive rendering** of **numerical simulations** on runtime.

![gallery](docs/src/_static/img/logo.gif)

Expand All @@ -12,9 +12,9 @@ code**.
The main feature is that users can launch an **interactive 3D rendering window without blocking** the execution of the
python process.

The Core of this project is **compatible with any numerical simulation** written in Python and provides the
The project is **compatible with any numerical simulation** written in Python and provides the
following list of features.
**Additional cool features** are also available for [**SOFA**](https://www.sofa-framework.org/) **numerical
**Additional features** are also compatible with [**SOFA**](https://www.sofa-framework.org/) **numerical
simulations**.


Expand All @@ -24,22 +24,20 @@ simulations**.

## Features

Core features
Main features:
* a **simple API** to create and update visual objects from simulated data;
* several **customizable visual objects**: meshes, point clouds, arrows;
* several **customizable visual objects**: meshes, point clouds, arrows, lines and 2D text;
* several available **viewers**:
* `Viewer`: a simple rendering window to render the current state of a **single** numerical simulation;
* `ViewerBatch`: an advanced rendering window to render the current state of **several** numerical simulations
**simultaneously**;
* `Player`: an advanced rendering window to **navigate** through the numerical simulation **time steps** (play/pause,
back/forth).

Additional SOFA features
SOFA compatible features:
* an enhanced API to **update** visual objects **automatically** with Data callbacks;
* an option to **render** the numerical simulation **completely automatically** given the **scene graph**;
* an enhanced `Player` to **select** the **displayed models**.

See more on the project [**documentation**](https://mimesis-inria.github.io/SimRender/).
* an enhanced `Player` to **select** the **displayed models** (incoming).


## Install
Expand Down
36 changes: 16 additions & 20 deletions docs/src/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Project Details
Global Structure
----------------

The main feature of **SimRender** is to provide an interactive 3D rendering window without blocking the execution of
the python code.
This is achieved using two different processes: the first one is the main process launch by the user (called *local
process* in the documentation), from which an other process is launched automatically to display the interactive 3D
rendering (called *remote process* in the documentation).
The main feature of **SimRender** is to provide an interactive 3D rendering window to render a running numerical
simulation without blocking the execution of the python process.
This is achieved using two different python processes: the first one is the main process launch by the user (called
*local process* in the documentation), from which an other subprocess is launched to display the interactive 3D
rendering window (called *remote process* in the documentation).

.. figure:: /_static/img/structure.png
:align: center
Expand All @@ -22,33 +22,29 @@ Viewer
As shown in the figure above, the *local Viewer* is used in the simulation process and the *remote Viewer* is dedicated
to the 3D rendering window.

The *local Viewer* is a simple user interface to launch, update and close the 3D rendering.
The *local Factory* is accessible through this object to provide the visualization data.
The *local Viewer* is a simple user interface to launch, render and close the 3D rendering.
The *local Factory* is accessible through this interface to create and update 3D objects with simulated data.

The *remote Viewer* runs in a dedicated python process, launched with the
`subprocess <https://docs.python.org/3/library/subprocess.html>`_ module.
It creates and display the 3D rendering window designed with
`Vedo <https://vedo.embl.es/>`_, accessing objects data through the *remote Factory*.
The *remote Viewer* runs in a dedicated python `subprocess <https://docs.python.org/3/library/subprocess.html>`_.
It creates and display the 3D objects using `vedo <https://vedo.embl.es/>`_, getting data through the *remote Factory*.
A timer callback is checking for new rendering steps in the *remote Factory* so that the rendering window remains
interactive.


Factory
-------

*Factories* are used to synchronize the *Viewers* and the shared data access.
*Factories* are used to synchronize the *Viewers* and the access shared data between processes.

The *local Factory* has methods to easily initialize and update the visualization data for several 3D object types
(point clouds, meshes, arrows).
The *local Factory* is a simple user interface to init and update the visualization data fields for several 3D object
types (point clouds, meshes, arrows, lines and 2D text).

Then, the *remote Factory* will recover these data to create and update the 3D objects in the *remote Viewer*.
Then, the *remote Factory* will access these data fields to create and update the 3D objects in the *remote Viewer*.


Memory
------

The *Memories* are the bridge to communicate data between the *local* and the *remote* processes.
To achieve this, a
`multiprocessing.SharedMemory <https://docs.python.org/3/library/multiprocessing.shared_memory.html>`_ is created for
each visualization data and used as buffer for a
`numpy.ndarray <https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html>`_.
The *Memories* are the shared access to data between the *local* and the *remote* processes.
A `SharedMemory <https://docs.python.org/3/library/multiprocessing.shared_memory.html>`_ is created for each data field
and used as buffer for a `numpy array <https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html>`_.
27 changes: 23 additions & 4 deletions docs/src/api.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
=============
API - Generic
=============
===
API
===


Core
----


.. autoclass:: SimRender.core.local.viewer.Viewer
Expand All @@ -15,4 +19,19 @@ API - Generic
:members: start, stop

.. autoclass:: SimRender.core.local.factory.Objects
:members: add_mesh, update_mesh, add_points, update_points, add_arrows, update_arrows, add_text, update_text
:members: add_mesh, update_mesh, add_points, update_points, add_arrows, update_arrows, add_lines, update_lines, add_text, update_text


SOFA
----

.. autoclass:: SimRender.sofa.local.viewer.Viewer
:special-members: __init__
:members: launch, render, shutdown

.. autoclass:: SimRender.sofa.local.player.Player
:special-members: __init__
:members: launch, render, shutdown

.. autoclass:: SimRender.sofa.local.factory.Objects
:members: add_sofa_mesh, add_sofa_points, add_sofa_arrows, add_scene_graph
20 changes: 10 additions & 10 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ code**.
The main feature is that users can launch an **interactive 3D rendering window without blocking** the execution of the
python process.

The Core of this project is **compatible with any numerical simulation** written in Python and provides the
The project is **compatible with any numerical simulation** written in Python and provides the
following list of features.
**Additional cool features** are also available for :SOFA:`SOFA <>` **numerical simulations**.
**Additional features** are also compatible with :SOFA:`SOFA <>` **numerical simulations**.

.. image:: _static/img/heart.gif


Features
--------

Core features
Main features:

* a **simple API** to create and update visual objects from simulated data;
* several **customizable visual objects**: meshes, point clouds, arrows;
* several **customizable visual objects**: meshes, point clouds, arrows, lines, 2D text;
* several available **viewers**:
* `Viewer`: a simple rendering window to render the current state of a **single** numerical simulation;
* `ViewerBatch`: an advanced rendering window to render the current state of **several** numerical simulations
**simultaneously**;
* `Player`: an advanced rendering window to **navigate** through the numerical simulation **time steps** (play/pause,
back/forth).

Additional SOFA features
SOFA compatible features:

* an enhanced API to **update** visual objects **automatically** with Data callbacks;
* an option to **render** the numerical simulation **completely automatically** given the **scene graph**;
* an enhanced `Player` to **select** the **displayed models**.
* an enhanced `Player` to **select** the **displayed models** (incoming).


Gallery
Expand All @@ -46,7 +46,7 @@ Gallery
.. toctree::
:hidden:

Install <install.rst>
About <about.rst>
How to use <usage.rst>
API <api.rst>
Install <install.rst>
About <about.rst>
Getting started <usage.rst>
API <api.rst>
Loading

0 comments on commit 859be45

Please sign in to comment.