Skip to content

Commit 17a61a8

Browse files
committed
Merge branch 'codac2_dev' of github.com:codac-team/codac into multithread_pave
2 parents e86939a + 974ee29 commit 17a61a8

40 files changed

Lines changed: 876 additions & 245 deletions

doc/manual/development/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
Changelog
44
=========
55

6+
Upcoming version
7+
****************
8+
9+
Pull Request #379 from godardma (27/04)
10+
---------------------------------------
11+
12+
``Zonotope`` and ``Parallelepiped`` center is now ``c`` instead of ``z`` to avoid ambiguity.
13+
614
Version 2.0.2
715
*************
816

doc/manual/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ User manual
255255
* CtcCross / CtcNoCross
256256
* Shape contractors
257257
* CtcCtcBoundary
258-
* CtcWrapper
258+
* :ref:`sec-ctc-shape-ctcwrapper`
259259
* CtcImage
260260
* CtcDiscreteSet
261261
* Temporal contractors
@@ -317,8 +317,8 @@ User manual
317317
* :ref:`sec-zonotope`
318318
* Polyhedron
319319

320-
* :ref:`sec-actions`
321-
* :ref:`sec-actions-octasym`
320+
* :ref:`sec-tools`
321+
* :ref:`sec-tools-octasym`
322322

323323
* :ref:`sec-ellipsoids`
324324
* :ref:`sec-ellipsoids-intro`

doc/manual/manual/contractors/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Contractors, separators
1010
CtcDist <geometric/ctcdist>
1111
CtcPolar <geometric/ctcpolar>
1212
CtcVisible <geometric/ctcvisible>
13+
CtcWrapper <shape/ctcwrapper>
1314

1415
.. What are contractors? <http://codac.io>
1516
.. The Ctc class <http://codac.io>
@@ -109,7 +110,7 @@ Overview of contractors and separators
109110
* - ``CtcCtcBoundary``
110111
- ``SepCtcBoundary``
111112

112-
* - ``CtcWrapper``
113+
* - :ref:`CtcWrapper <sec-ctc-shape-ctcwrapper>`
113114
- ``SepWrapper``
114115

115116
* - ``CtcImage``
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. _sec-ctc-shape-ctcwrapper:
2+
3+
CtcWrapper
4+
===============================
5+
6+
Main author: `Maël Godard <https://godardma.github.io/>`_
7+
8+
The CtcWrapper is a contractor to contract a box with respect to a set represented by a Codac object.
9+
Currently supported objects are:
10+
11+
- :ref:`IntervalVector <sec-intervals-intervalvector-class>`
12+
- :ref:`Parallelepiped <subsec-zonotope-parallelepiped>`
13+
- PavingOut
14+
15+
Methods
16+
-------
17+
18+
Below is an example of the use of the CtcWrapper with a Parallelepiped.
19+
20+
.. tabs::
21+
22+
.. group-tab:: Python
23+
24+
.. literalinclude:: src.py
25+
:language: py
26+
:start-after: [ctcparallelepiped-1-beg]
27+
:end-before: [ctcparallelepiped-1-end]
28+
:dedent: 4
29+
30+
.. group-tab:: C++
31+
32+
.. literalinclude:: src.cpp
33+
:language: c++
34+
:start-after: [ctcparallelepiped-1-beg]
35+
:end-before: [ctcparallelepiped-1-end]
36+
:dedent: 4
37+
38+
.. admonition:: Technical documentation
39+
40+
See the `C++ API documentation of this class <../../api/html/classcodac2_1_1_ctc_wrapper.html>`_.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Geometric contractors
2+
=====================
3+
4+
.. toctree::
5+
6+
CtcCtcBoundary <http://codac.io>
7+
ctcwrapper.rst
8+
CtcImage <http://codac.io>
9+
CtcDiscreteSet <http://codac.io>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Codac tests
3+
* ----------------------------------------------------------------------------
4+
* \date 2026
5+
* \author Maël Godard
6+
* \copyright Copyright 2024 Codac Team
7+
* \license GNU Lesser General Public License (LGPL)
8+
*/
9+
10+
#include <catch2/catch_test_macros.hpp>
11+
#include <codac2_CtcWrapper.h>
12+
#include <codac2_Approx.h>
13+
14+
#include <codac2_Figure2D.h>
15+
16+
using namespace std;
17+
using namespace codac2;
18+
19+
TEST_CASE("CtcWrapper - Parallelepiped - manual")
20+
{
21+
{
22+
// [ctcparallelepiped-1-beg]
23+
IntervalVector x ({{0,5}, {0,5}});
24+
Parallelepiped p (Vector({1.5,2.8}), Matrix({{0.5,0.4},{0,0.2}}));
25+
CtcWrapper c(p);
26+
c.contract(x);
27+
// x = [ [0.599999, 2.40001] ; [2.59999, 3] ]
28+
// [ctcparallelepiped-1-end]
29+
30+
CHECK(Approx(x) == IntervalVector({{0.6, 2.4}, {2.6, 3}}));
31+
}
32+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python
2+
3+
# Codac tests
4+
# ----------------------------------------------------------------------------
5+
# \date 2026
6+
# \author Maël Godard
7+
# \copyright Copyright 2024 Codac Team
8+
# \license GNU Lesser General Public License (LGPL)
9+
10+
import sys, os
11+
import unittest
12+
import math
13+
from codac import *
14+
15+
class TestCtcShapeManual(unittest.TestCase):
16+
17+
def tests_CtcWrapper_Parallelepiped_manual(test):
18+
19+
# [ctcparallelepiped-1-beg]
20+
x = IntervalVector([[0,5], [0,5]])
21+
p = Parallelepiped(Vector([1.5,2.8]), Matrix([[0.5,0.4],[0,0.2]]))
22+
c = CtcWrapper_Parallelepiped(p)
23+
x = c.contract(x)
24+
# x = [ [0.599999, 2.40001] ; [2.59999, 3] ]
25+
# [ctcparallelepiped-1-end]
26+
27+
test.assertTrue(Approx(x) == IntervalVector([[0.6, 2.4], [2.6, 3]]))
28+
29+
if __name__ == '__main__':
30+
unittest.main()
52.4 KB
Loading

doc/manual/manual/geometry/zonotope.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ A zonotope is a convex and symmetric polytope.
1616
It can be represented as the Minkowski sum of a finite number of line segments, which are called its generators.
1717

1818
In Codac, zonotopes are represented by the class :class:`Zonotope`. A zonotope is defined by its center and its generators.
19-
The center is a :class:`Vector`, noted :math:`z`, and the generators are stored in a :class:`Matrix`, noted :math:`A`.
19+
The center is a :class:`Vector`, noted :math:`\mathbf{c}`, and the generators are stored in a :class:`Matrix`, noted :math:`\mathbf{A}`.
2020
Each column of the matrix corresponds to a generator.
2121

2222
The resulting zonotope is:
2323

2424
.. math::
25-
Z = z + A \cdot [-1,1]^m
25+
Z = \mathbf{c} + \mathbf{A} \cdot [-1,1]^m
2626
2727
Where :math:`m` is the number of generators (i.e., the number of columns of the matrix :math:`A`).
2828

@@ -37,24 +37,24 @@ It can be constructed in Codac as follows:
3737

3838
.. code-tab:: py
3939

40-
z = Vector([1,2])
40+
c = Vector([1,2])
4141
A = Matrix([[1,0,2],[0,1,1]])
4242

43-
Z = Zonotope(z, A)
43+
Z = Zonotope(c, A)
4444

4545
.. code-tab:: c++
4646

47-
Vector z({1,2});
47+
Vector c({1,2});
4848
Matrix A({{1,0,2},{0,1,1}});
4949

50-
Zonotope Z(z, A);
50+
Zonotope Z(c, A);
5151

5252
.. code-tab:: matlab
5353

54-
z = Vector({1,2});
54+
c = Vector({1,2});
5555
A = Matrix({{1,0,2},{0,1,1}});
5656

57-
Z = Zonotope(z,A);
57+
Z = Zonotope(c,A);
5858

5959
The resulting zonotope is represented in the figure below:
6060

examples/06_graphics_3D/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ int main()
3838

3939

4040
Figure3D fig_examples("3D examples");
41-
fig_examples.draw_axes(1.0);
41+
fig_examples.draw_axes();
42+
fig_examples.draw_axes(0.5);
43+
fig_examples.draw_axes(2.0,{0.5,0.5,0.5});
4244
fig_examples.draw_triangle({1,0,0},{0,1,0},{0,0,1},{ Color::dark_green(0.5), "triangle1" });
4345
fig_examples.draw_triangle({2,0,0},{{-1,0,0},{0,1,1},{0,0,-1}},
4446
{1,0,0},{0,1,0},{0,0,1},Color::purple(0.5));

0 commit comments

Comments
 (0)