Skip to content

Commit

Permalink
deploy: ebfe141
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinEnjalbert committed Jun 25, 2024
0 parents commit f803fa7
Show file tree
Hide file tree
Showing 61 changed files with 8,392 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 6993092a436420a966f28805302806b1
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/api.doctree
Binary file not shown.
Binary file added .doctrees/demo.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
Binary file added .doctrees/install.doctree
Binary file not shown.
Binary file added .doctrees/usage.doctree
Binary file not shown.
Empty file added .nojekyll
Empty file.
Binary file added _images/gallery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions _sources/api.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
===
API
===

.. autoclass:: SimExporter.core.exporter.Exporter
:special-members: __init__
:members: process


.. autoclass:: SimExporter.core.factory.Factory
:members: add_mesh, add_points, add_arrows, add_k3d_objects
42 changes: 42 additions & 0 deletions _sources/demo.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
====
Demo
====

.. raw:: html

<iframe src="_static/html/meshes.html" height="600px" width="100%"></iframe>

.. code-block:: python
from SimExporter.core import Exporter
# Load data
...
# Create the exporter
exporter = Exporter(animation=True,
fps=50)
# Add meshes to the scene
exporter.objects.add_mesh(positions=...,
cells=...,
color=[192, 28, 40],
alpha=0.6,
flat_shading=False,
time_positions=...)
exporter.objects.add_mesh(positions=...,
cells=...,
alpha=1.,
flat_shading=False,
wireframe=True,
colormap_name='Reds',
colormap_range=[0, 1],
time_colormaps=...,
time_positions=...)
# Export to HTML
exporter.process(filename='scene.html',
background_color='black',
menu_visible=True,
grid_visible=False,
frame_visible=True)
39 changes: 39 additions & 0 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
===========
SimExporter
===========

**SimExporter** is a Python module for creating 3D scenes of various 3D objects using
:K3D:`K3D <>` and exporting a 3D plot or a 3D animation in a standalone HTML file.

This HTML file can then be opened in any browsers on any laptop, is can then be easily integrated into a website or
presentation slides.


Features
--------

**SimExporter** provides a lightweight, user-friendly API to create 3D objects:

* Create various 3D object types: meshes, points, vectors;
* Associate time series to the 3D objects.

Then, the scene containing the 3D objects can be exported in a standalone HTML file:

* Export a static plot of the 3D objects;
* Export an animation using the time series associated to the 3D objects.


Gallery
-------

.. image:: _static/gallery.png



.. toctree::
:hidden:

Demo <demo.rst>
Install <install.rst>
How to use <usage.rst>
API <api.rst>
60 changes: 60 additions & 0 deletions _sources/install.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
=======
Install
=======

Requirements
------------

**SimExporter** has the following dependencies:

.. table::
:widths: 30 30 50

+---------------------+--------------+--------------------------------+
| **Dependency** | **Type** | **Instructions** |
+=====================+==============+================================+
| :Numpy:`Numpy <>` | **Required** | :guilabel:`pip install numpy` |
+---------------------+--------------+--------------------------------+
| :K3D:`K3D <>` | **Required** | :guilabel:`pip install k3d` |
+---------------------+--------------+--------------------------------+
| :Vedo:`Vedo <>` | **Required** | :guilabel:`pip install vedo` |
+---------------------+--------------+--------------------------------+
| :Colour:`Colour <>` | **Required** | :guilabel:`pip install colour` |
+---------------------+--------------+--------------------------------+


Install
-------

Install with *pip*
""""""""""""""""""

**SimExporter** can be easily installed with :guilabel:`pip` for users:

.. code-block:: bash
pip install git+https://github.com/RobinEnjalbert/SimExporter.git
You should be able to run:

.. code-block:: python
import SimExporter
Install from sources
""""""""""""""""""""

**SimExporter** can also be installed from sources for developers:

.. code-block:: bash
git clone https://github.com/RobinEnjalbert/SimExporter.git
cd SimExporter
pip install -e .
You should be able to run:

.. code-block:: python
import SimExporter
67 changes: 67 additions & 0 deletions _sources/usage.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
==========
How to use
==========

This light tutorial reviews the whole project API to create 3D objects and export them in HTML.


Step 1: Create the Exporter
---------------------------

The :py:class:`Exporter<SimExporter.core.exporter.Exporter>` class is the main user API to create and export 3D objects:

.. code-block:: python
from SimExporter.Core import Exporter
exporter = Exporter(animation=True,
fps=30)
The :guilabel:`animation` option defines if the exported output will be a static 3D plot or an animation (in that case,
the frame rate :guilabel:`fps` can be specified).


Step 2: Add 3D objects
----------------------

The **Exporter** exposes the methods to create several 3D objects in the :guilabel:`objects` attribute.

* Adding **mesh** with :py:meth:`objects.add_mesh<SimExporter.core.factory.Factory.add_mesh>`:

.. code-block:: python
exporter.objects.add_mesh(positions=my_mesh_positions,
cells=my_mesh_cells)
* Adding **points** with :py:meth:`objects.add_points<SimExporter.core.factory.Factory.add_points>`:

.. code-block:: python
exporter.objects.add_points(positions=my_points_positions)
* Adding **arrows** with :py:meth:`objects.add_arrows<SimExporter.core.factory.Factory.add_arrows>`:

.. code-block:: python
exporter.objects.add_arrows(positions=my_arrows_positions,
vectors=my_arrows_vectors)
* Adding standard **k3d objects** with :py:meth:`objects.add_k3d_objects<SimExporter.core.factory.Factory.add_k3d_objects>`:

.. code-block:: python
import k3d
lines = k3d.lines(vertices=my_lines_vertices,
indices=my_lines_indices)
exporter.objects.add_k3d_objects(lines)
Step 3: Export in HTML
----------------------

Finally, the call to :py:meth:`process<SimExporter.core.exporter.Exporter.process>` will export the 3D scene in HTML:

.. code-block:: python
exporter.process(filename='scene.html')
123 changes: 123 additions & 0 deletions _static/_sphinx_javascript_frameworks_compat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/* Compatability shim for jQuery and underscores.js.
*
* Copyright Sphinx contributors
* Released under the two clause BSD licence
*/

/**
* small helper function to urldecode strings
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
*/
jQuery.urldecode = function(x) {
if (!x) {
return x
}
return decodeURIComponent(x.replace(/\+/g, ' '));
};

/**
* small helper function to urlencode strings
*/
jQuery.urlencode = encodeURIComponent;

/**
* This function returns the parsed url parameters of the
* current request. Multiple values per key are supported,
* it will always return arrays of strings for the value parts.
*/
jQuery.getQueryParameters = function(s) {
if (typeof s === 'undefined')
s = document.location.search;
var parts = s.substr(s.indexOf('?') + 1).split('&');
var result = {};
for (var i = 0; i < parts.length; i++) {
var tmp = parts[i].split('=', 2);
var key = jQuery.urldecode(tmp[0]);
var value = jQuery.urldecode(tmp[1]);
if (key in result)
result[key].push(value);
else
result[key] = [value];
}
return result;
};

/**
* highlight a given string on a jquery object by wrapping it in
* span elements with the given class name.
*/
jQuery.fn.highlightText = function(text, className) {
function highlight(node, addItems) {
if (node.nodeType === 3) {
var val = node.nodeValue;
var pos = val.toLowerCase().indexOf(text);
if (pos >= 0 &&
!jQuery(node.parentNode).hasClass(className) &&
!jQuery(node.parentNode).hasClass("nohighlight")) {
var span;
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
if (isInSVG) {
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
} else {
span = document.createElement("span");
span.className = className;
}
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
document.createTextNode(val.substr(pos + text.length)),
node.nextSibling));
node.nodeValue = val.substr(0, pos);
if (isInSVG) {
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
var bbox = node.parentElement.getBBox();
rect.x.baseVal.value = bbox.x;
rect.y.baseVal.value = bbox.y;
rect.width.baseVal.value = bbox.width;
rect.height.baseVal.value = bbox.height;
rect.setAttribute('class', className);
addItems.push({
"parent": node.parentNode,
"target": rect});
}
}
}
else if (!jQuery(node).is("button, select, textarea")) {
jQuery.each(node.childNodes, function() {
highlight(this, addItems);
});
}
}
var addItems = [];
var result = this.each(function() {
highlight(this, addItems);
});
for (var i = 0; i < addItems.length; ++i) {
jQuery(addItems[i].parent).before(addItems[i].target);
}
return result;
};

/*
* backward compatibility for jQuery.browser
* This will be supported until firefox bug is fixed.
*/
if (!jQuery.browser) {
jQuery.uaMatch = function(ua) {
ua = ua.toLowerCase();

var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];

return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
jQuery.browser = {};
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
}
Loading

0 comments on commit f803fa7

Please sign in to comment.