Skip to content

Commit

Permalink
[ellips] minor update (merging branches)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRohou committed Dec 13, 2024
2 parents 51b30d6 + 8a1121a commit bce42f6
Show file tree
Hide file tree
Showing 78 changed files with 3,120 additions and 966 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
endif()

if(MSVC)
#add_compile_options(/W4 /WX) # temporarily removed because of multiple "the following warning is treated as an error" with WS
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
Expand Down
49 changes: 49 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,53 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mathjax_stmaryrd.js

endif()

endif()

# User manual (Sphinx)

find_package(Sphinx)

if(NOT SPHINX_FOUND)

message(STATUS "Sphinx not found, will not be able to generate the manual.")

else()

# Includes CMake commands in config file:
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/manual/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/manual/conf.py)

set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/manual)
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/manual)

# Copying _static files of Sphinx to build directories
foreach(static_file ${CMAKE_CURRENT_SOURCE_DIR}/manual/_static/)
file(COPY ${static_file} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/manual/_static/)
endforeach()

# Copying tmp files
foreach(static_file ${CMAKE_CURRENT_SOURCE_DIR}/manual/tmp/)
file(COPY ${static_file} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/manual/tmp/)
endforeach()

# todo: the SPHINX_EXECUTABLE is already set by FindSphinx.cmake:
# check that it works without the following overload for Win and Linux:
if(WIN32)
set(SPHINX_EXECUTABLE "sphinx-build")
else()
set(SPHINX_EXECUTABLE "python3" "-msphinx")
endif()

add_custom_target(manual
COMMAND
${SPHINX_EXECUTABLE} -b html
# Specifying path to conf.py generated by CMake:
-c ${CMAKE_CURRENT_BINARY_DIR}/manual/
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating the manual website using Sphinx")

install(DIRECTORY ${SPHINX_BUILD}/
DESTINATION share/manual/${CMAKE_PROJECT_NAME}
OPTIONAL)

endif()
10 changes: 10 additions & 0 deletions doc/manual/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
div.rst-content a:visited
{
color: #2980b9;
text-decoration: none;
}

div.rst-content li.toctree-l1 > a
{
font-weight: bold;
}
Empty file added doc/manual/_static/empty.txt
Empty file.
Empty file added doc/manual/_templates/empty.txt
Empty file.
40 changes: 40 additions & 0 deletions doc/manual/conf.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Codac'
copyright = 'Codac Team'
author = 'Codac Team'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx_rtd_theme',
]

templates_path = ['_templates']
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_logo = "_static/logos/logo_codac.svg"

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]

html_theme_options = {
'logo_only': True,
'display_version': True,
}
51 changes: 51 additions & 0 deletions doc/manual/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Codac manual
============


.. toctree::
:caption: Overview of Codac
:maxdepth: 3

Constraint programming and IA <http://codac.io>
The Codac framework <http://codac.io>
Target audience <http://codac.io>


.. toctree::
:caption: User manual
:maxdepth: 3

installation/index.rst
intervals/index.rst
linear/index.rst
functions/index.rst
tubes/index.rst
contractors/index.rst
separators/index.rst
pavers/index.rst
cn/index.rst
geometry/index.rst
ellipsoids/index.rst
topology/index.rst
visualization/index.rst
extensions/index.rst
seealso/index.rst
references/index.rst


.. toctree::
:caption: How-to guides
:maxdepth: 3

howto/robotics/index.rst
howto/geometry/index.rst
howto/dynamical/index.rst


.. toctree::
:caption: Development
:maxdepth: 3

Changelog <http://codac.io>
C++ API <http://codac.io>
Information for developers <http://codac.io>
Empty file added doc/manual/tmp/empty.txt
Empty file.
30 changes: 28 additions & 2 deletions examples/00_graphics/graphic_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
fig1.set_window_properties([50,50],[500,500]) # position, window size
fig1.set_axes(axis(0,[-10,10]), axis(1,[-10,10])) # (axis_id,[range_of_values_on_this_axis])
fig1.draw_box([[-1,1],[-1,1]],[Color.green(),Color.red(0.2)]) # drawing a green box with red opacity values inside
fig1.draw_circle([1,1],0.5,Color(255,155,5)) # drawing a circle at (1,1) of radius 0.5 with a custom RGB color
fig1.draw_circle([1,1],0.5,Color([255,155,5])) # drawing a circle at (1,1) of radius 0.5 with a custom RGB color
fig1.draw_ring([1,1],[4,6],Color.red()) # drawing a ring at (1,1) of radius [4,6] with a predefined red color

fig2 = Figure2D("My figure 2", GraphicOutput.VIBES | GraphicOutput.IPE)
Expand All @@ -44,5 +44,31 @@
fig2.draw_polygone([[2,4.5],[4,4.5],[4.2,3.5],[3.5,3]], [Color.none(),Color.green(0.5)])
fig2.draw_polyline([[-0.8,0],[0,1.5]], 0.2, [Color.red(),Color.black(0.3)])
fig2.draw_ellipse([1,1],[0.5,2], 0.2, [Color.blue(),Color.blue(0.3)])

# Colors
# predefined colors without and with opacity
fig2.draw_point([2,2], [Color.red(),Color.yellow(0.5)])
fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")])
# HTML color without and with opacity
fig2.draw_box([[2.4,2.9],[2.4,2.9]],[Color("#da3907"),Color("#da390755")])
# HSV color without and with opacity
fig2.draw_box([[2.6,3.1],[2.6,3.1]],[Color([108,90,78],Model.HSV),Color([108,90,78,20],Model.HSV)])
# RGB color auto cast from list without and with opacity
fig2.draw_box([[2.,2.3],[2.6,2.9]],[[255,0,255],[255,0,255,100]])

fig3 = Figure2D("ColorMap figure", GraphicOutput.VIBES | GraphicOutput.IPE)
fig3.set_axes(axis(0,[-1,21]), axis(1,[-5.5,0.5]))
fig3.set_window_properties([800,250],[500,500])

cmap_haxby=ColorMap.haxby()
cmap_default=ColorMap.basic()
cmap_blue_tube=ColorMap.blue_tube()
cmap_red_tube=ColorMap.red_tube()
cmap_rainbow=ColorMap.rainbow()

for i in range (20):
ratio=i/20
fig3.draw_box([[i,i+1],[-1,0]],[Color.black(),cmap_haxby.color(ratio)])
fig3.draw_box([[i,i+1],[-2,-1]],[Color.black(),cmap_default.color(ratio)])
fig3.draw_box([[i,i+1],[-3,-2]],[Color.black(),cmap_blue_tube.color(ratio)])
fig3.draw_box([[i,i+1],[-4,-3]],[Color.black(),cmap_red_tube.color(ratio)])
fig3.draw_box([[i,i+1],[-5,-4]],[Color.black(),cmap_rainbow.color(ratio)])
6 changes: 3 additions & 3 deletions examples/ellipsoid_dev/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ int main() {
// ----------------------------------------------------------

// step 1 identify the direction of non inclusion
Eigen::MatrixXd X = e4.G._e;
Eigen::MatrixXd Y = e6.G._e;
Eigen::MatrixXd X = e4.G;
Eigen::MatrixXd Y = e6.G;
Eigen::MatrixXd Y_inv = Y.inverse();
Eigen::MatrixXd D = Eigen::MatrixXd::Identity(3,3)- X.transpose()*Y_inv.transpose()*Y_inv*X;
cout << "D = " << D << endl;
Expand All @@ -84,7 +84,7 @@ int main() {
cout << " the vector associated to the min eigenvalue is " << v << endl;

// select the less included point and draw it on the figures
Eigen::VectorXd x = e4.mu._e+e4.G._e*v;
Eigen::VectorXd x = e4.mu+e4.G*v;
cout << "the point " << x << " is the less included point" << endl;
fig2.draw_point(x, {Color::black()});
fig3.draw_point(x, {Color::black()});
Expand Down
6 changes: 3 additions & 3 deletions examples/ellipsoid_example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main() {
Ellipsoid e2 = Ellipsoid(e1);
for (int i = 0; i < N; i++) {
Matrix A = h.diff(e2.mu).mid();
Vector b(h.eval(e2.mu).mid()._e - A._e * e2.mu._e);
Vector b(h.eval(e2.mu).mid() - A * e2.mu);
e2 = unreliable_linear_mapping(e2, A, b);
fig1.draw_ellipsoid(e2, {Color::green(), Color::green(0.3)});
}
Expand Down Expand Up @@ -138,8 +138,8 @@ int main() {
cout << e8 << endl;

cout << "\nDifference between e7 and e8:" << endl;
cout << "mu diff norm is " << (e7.mu._e - e8.mu._e).norm() << endl;
cout << "G diff norm is " << (e7.G._e - e8.G._e).norm() << endl;
cout << "mu diff norm is " << (e7.mu - e8.mu).norm() << endl;
cout << "G diff norm is " << (e7.G - e8.G).norm() << endl;

// ----------------------------------------------------------
// singular case for nonlinear mapping
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion python/src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
domains/interval/codac2_py_Interval_operations.cpp
domains/interval/codac2_py_IntervalMatrix.cpp
domains/interval/codac2_py_IntervalMatrixBase.h
domains/interval/codac2_py_IntervalRow.cpp
domains/interval/codac2_py_IntervalVector.cpp
domains/interval/codac2_py_IntervalVector_templ.h
domains/paving/codac2_py_Paving.cpp
domains/paving/codac2_py_PavingNode.cpp
domains/paving/codac2_py_Subpaving.cpp
Expand All @@ -56,6 +58,7 @@
matrices/codac2_py_arithmetic_sub.cpp
matrices/codac2_py_arithmetic_mul.cpp
matrices/codac2_py_arithmetic_div.cpp
matrices/codac2_py_Inversion.cpp
matrices/codac2_py_Matrix.cpp
matrices/codac2_py_MatrixBase.h
matrices/codac2_py_MatrixBlock.h
Expand Down Expand Up @@ -113,4 +116,4 @@
# ex: from codac import core
# core.Tube
# ex: from codac.core import Tube
# Tube
# Tube
6 changes: 4 additions & 2 deletions python/src/core/codac2_py_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void export_arithmetic_div(
py::class_<Row> export_Row(py::module& m);
py::class_<Vector> export_Vector(py::module& m);
py::class_<Matrix> export_Matrix(py::module& m);
void export_Inversion(py::module& m);

// paver
void export_pave(py::module& m);
Expand Down Expand Up @@ -158,13 +159,14 @@ PYBIND11_MODULE(_core, m)
auto py_B = export_EigenBlock<Matrix>(m, "MatrixBlock");
export_EigenBlock<Row>(m, "RowBlock");
export_EigenBlock<Vector>(m, "VectorBlock");
export_Inversion(m);

// domains
export_BoolInterval(m);
export_Ellipsoid(m);
auto py_Interval = export_Interval(m);
export_Interval_operations(m, py_Interval);
py::class_<IntervalRow> exported_intervalrow_class(m, "IntervalRow", DOC_TO_BE_DEFINED);
auto py_IR = export_IntervalRow(m);
auto py_IV = export_IntervalVector(m);
auto py_IM = export_IntervalMatrix(m);
auto py_IB = export_EigenBlock<IntervalMatrix>(m, "IntervalMatrixBlock");
Expand Down Expand Up @@ -217,4 +219,4 @@ PYBIND11_MODULE(_core, m)
// tools
export_Approx(m);

}
}
16 changes: 8 additions & 8 deletions python/src/core/domains/interval/codac2_py_IntervalMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,10 @@ py::class_<IntervalMatrix> export_IntervalMatrix(py::module& m)
DOC_TO_BE_DEFINED,
"x"_a)

.def(py::init<const IntervalRow&>(),
DOC_TO_BE_DEFINED,
"x"_a)

.def(py::init<const Vector&>(),
DOC_TO_BE_DEFINED,
"x"_a)

.def(py::init<const IntervalVector&>(),
DOC_TO_BE_DEFINED,
"x"_a)

.def(py::init<const Eigen::Block<Matrix>&>(),
DOC_TO_BE_DEFINED,
"x"_a)
Expand All @@ -110,6 +102,14 @@ py::class_<IntervalMatrix> export_IntervalMatrix(py::module& m)
}),
DOC_TO_BE_DEFINED,
"v"_a)

.def(py::init<const IntervalRow&>(),
DOC_TO_BE_DEFINED,
"x"_a)

.def(py::init<const IntervalVector&>(),
DOC_TO_BE_DEFINED,
"x"_a)

.def_static("empty", [](Index_type r, Index_type c)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ void export_IntervalMatrixBase(py::module& m, py::class_<S>& pyclass)
.def("diam", [](const S& x) { return x.diam(); },
MATRIXBASE_ADDONS_INTERVALMATRIXBASE_AUTO_DIAM_CONST)

.def("min_rad", [](const S& x) { return x.min_rad(); },
MATRIX_ADDONS_INTERVALMATRIXBASE_DOUBLE_MIN_RAD_CONST)

.def("max_rad", [](const S& x) { return x.max_rad(); },
MATRIX_ADDONS_INTERVALMATRIXBASE_DOUBLE_MAX_RAD_CONST)

.def("min_diam", [](const S& x) { return x.min_diam(); },
MATRIX_ADDONS_INTERVALMATRIXBASE_DOUBLE_MIN_DIAM_CONST)

Expand Down
Loading

0 comments on commit bce42f6

Please sign in to comment.