Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/manual/manual/contractors/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.. _sec-ctc:
Contractors, separators
=======================

Expand Down
Binary file added doc/manual/manual/geometry/zonotope.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 60 additions & 6 deletions doc/manual/manual/geometry/zonotope.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,69 @@ The following classes represent zonotopes.
Zonotope
--------

.. doxygenclass:: codac2::Zonotope
:project: codac
:members:
A zonotope is a convex and symmetric polytope.
It can be represented as the Minkowski sum of a finite number of line segments, which are called its generators.

In Codac, zonotopes are represented by the class :class:`Zonotope`. A zonotope is defined by its center and its generators.
The center is a :class:`Vector`, noted :math:`z`, and the generators are stored in a :class:`Matrix`, noted :math:`A`.
Each column of the matrix corresponds to a generator.

The resulting zonotope is:

.. math::
Z = z + A \cdot [-1,1]^m

Where :math:`m` is the number of generators (i.e., the number of columns of the matrix :math:`A`).

For example, let us consider the following zonotope in :math:`\mathbb{R}^2`:

.. math::
Z = \left(\begin{array}{c} 1\\ 2\\ \end{array}\right) + \left(\begin{array}{ccc} 1 & 0 & 2 \\ 0 & 1 & 1 \end{array}\right) \cdot [-1,1]^3

It can be constructed in Codac as follows:

.. tabs::

.. code-tab:: py

z = Vector([1,2])
A = Matrix([[1,0,2],[0,1,1]])

Z = Zonotope(z, A)

.. code-tab:: c++

Vector z({1,2});
Matrix A({{1,0,2},{0,1,1}});

Zonotope Z(z, A);

.. code-tab:: matlab

z = Vector({1,2});
A = Matrix({{1,0,2},{0,1,1}});

Z = Zonotope(z,A);

The resulting zonotope is represented in the figure below:

.. figure:: zonotope.png
:width: 400px

Additional methods are provided to handle zonotopes.

- `box()`: gives the bounding box of the zonotope. Returns an :class:`IntervalVector`.
- `proj(v)`: Projects the zonotope on a given subspace, defined by the vector of indices `v` (:class:`std::vector\<Index\>`). Returns a :class:`Zonotope`.

.. _subsec-zonotope-parallelepiped:

Parallelepiped
--------------

.. doxygenclass:: codac2::Parallelepiped
:project: codac
:members:
A parallelepiped is a special case of zonotope, where the number of generators is equal or less than the dimension of the space.

It inherits from the `Zonotope` class, and thus has the same properties and methods. In addition, it defines the following methods:

- `vertices()`: gives the vertices of the parallelepiped. Returns a :class:`std::vector\<Vector\>`.
- `contains(v)`: checks if the point `v` is contained in the parallelepiped. Returns a :class:`BoolInterval`. **The matrix A must be invertible**
- `is_superset(x)`: checks if the parallelepiped is a superset of the :class:`IntervalVector` `x`. Returns a :class:`BoolInterval`. **The matrix A must be invertible**
Loading
Loading