diff --git a/python/src/core/paving/codac_py_ConnectedSubset.cpp b/python/src/core/paving/codac_py_ConnectedSubset.cpp index 5890fe326..a1b0d233d 100644 --- a/python/src/core/paving/codac_py_ConnectedSubset.cpp +++ b/python/src/core/paving/codac_py_ConnectedSubset.cpp @@ -13,7 +13,9 @@ #include #include #include +#include "codac_type_caster.h" +#include "codac_Vector.h" #include "codac_ConnectedSubset.h" // Generated file from Doxygen XML (doxygen2docstring.py): #include "codac_py_ConnectedSubset_docs.h" @@ -32,5 +34,12 @@ void export_ConnectedSubset(py::module& m) .def("get_boxes", &ConnectedSubset::get_boxes, CONNECTEDSUBSET_VECTORINTERVALVECTOR_GET_BOXES) + .def("is_strictly_included_in_paving", &ConnectedSubset::is_strictly_included_in_paving, + CONNECTEDSUBSET_BOOL_IS_STRICTLY_INCLUDED_IN_PAVING) + + .def("contains", &ConnectedSubset::contains, + CONNECTEDSUBSET_BOOL_CONTAINS_VECTOR, + "p"_a.noconvert()) + ; } \ No newline at end of file diff --git a/src/core/paving/codac_ConnectedSubset.cpp b/src/core/paving/codac_ConnectedSubset.cpp index 81799fa53..f1029dd36 100644 --- a/src/core/paving/codac_ConnectedSubset.cpp +++ b/src/core/paving/codac_ConnectedSubset.cpp @@ -36,6 +36,14 @@ namespace codac return box().is_strict_interior_subset(get_paving()->box()); } + bool ConnectedSubset::contains(const Vector& p) const + { + for(const auto& subset_item : m_v_subset_items) + if(subset_item->box().contains(p)) + return true; + return false; + } + const Paving* ConnectedSubset::get_paving() const { assert(!m_v_subset_items.empty() && "no items in ConnectedSubset (empty items vector)"); diff --git a/src/core/paving/codac_ConnectedSubset.h b/src/core/paving/codac_ConnectedSubset.h index c4591b611..6eb6956a9 100644 --- a/src/core/paving/codac_ConnectedSubset.h +++ b/src/core/paving/codac_ConnectedSubset.h @@ -14,6 +14,7 @@ #include #include "codac_IntervalMatrix.h" +#include "codac_Vector.h" #include "codac_Set.h" namespace codac @@ -56,6 +57,14 @@ namespace codac */ bool is_strictly_included_in_paving() const; + /** + * \brief Tests if p is contained in the connected subset + * + * \param p vector to be tested + * \return `true` if p is inside this + */ + bool contains(const Vector& p) const; + /** * \brief Returns a const pointer to the paving structure *