mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 06:00:33 +05:00
Merge branch 'ge_directionalintervall' into 'master'
__ge__ and __le__ operator for DirectionalInterval See merge request ngsolve/netgen!502
This commit is contained in:
commit
81b22633cd
@ -230,13 +230,13 @@ namespace netgen
|
|||||||
bool openmin = false, openmax = false;
|
bool openmin = false, openmax = false;
|
||||||
|
|
||||||
DirectionalInterval (gp_Vec adir) : dir(adir) { ; }
|
DirectionalInterval (gp_Vec adir) : dir(adir) { ; }
|
||||||
DirectionalInterval (const DirectionalInterval & i2)
|
DirectionalInterval (const DirectionalInterval & i2) = default;
|
||||||
: dir(i2.dir), minval(i2.minval), maxval(i2.maxval) { ; }
|
|
||||||
|
|
||||||
DirectionalInterval operator< (double val) const
|
DirectionalInterval operator< (double val) const
|
||||||
{
|
{
|
||||||
DirectionalInterval i2 = *this;
|
DirectionalInterval i2 = *this;
|
||||||
i2.maxval = val;
|
i2.maxval = val;
|
||||||
|
i2.openmax = true;
|
||||||
return i2;
|
return i2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,9 +244,25 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
DirectionalInterval i2 = *this;
|
DirectionalInterval i2 = *this;
|
||||||
i2.minval = val;
|
i2.minval = val;
|
||||||
|
i2.openmin = true;
|
||||||
return i2;
|
return i2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DirectionalInterval operator<= (double val) const
|
||||||
|
{
|
||||||
|
DirectionalInterval i2 = *this;
|
||||||
|
i2.maxval = val;
|
||||||
|
i2.openmax = false;
|
||||||
|
return i2;
|
||||||
|
}
|
||||||
|
|
||||||
|
DirectionalInterval operator>= (double val) const
|
||||||
|
{
|
||||||
|
DirectionalInterval i2 = *this;
|
||||||
|
i2.minval = val;
|
||||||
|
i2.openmin = false;
|
||||||
|
return i2;
|
||||||
|
}
|
||||||
|
|
||||||
DirectionalInterval Intersect (const DirectionalInterval & i2)
|
DirectionalInterval Intersect (const DirectionalInterval & i2)
|
||||||
{
|
{
|
||||||
|
@ -103,6 +103,14 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m)
|
|||||||
cout << IM(6) << "vec, gt v - " << netgen::occ2ng(v) << ", val = " << val << endl;
|
cout << IM(6) << "vec, gt v - " << netgen::occ2ng(v) << ", val = " << val << endl;
|
||||||
return DirectionalInterval(v) > val;
|
return DirectionalInterval(v) > val;
|
||||||
})
|
})
|
||||||
|
.def("__le__", [](gp_Vec v, double val)
|
||||||
|
{
|
||||||
|
return DirectionalInterval(v) <= val;
|
||||||
|
})
|
||||||
|
.def("__ge__", [](gp_Vec v, double val)
|
||||||
|
{
|
||||||
|
return DirectionalInterval(v) >= val;
|
||||||
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
py::class_<gp_Dir>(m, "gp_Dir", "3d OCC direction")
|
py::class_<gp_Dir>(m, "gp_Dir", "3d OCC direction")
|
||||||
|
@ -1589,7 +1589,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
{
|
{
|
||||||
ListOfShapes selected;
|
ListOfShapes selected;
|
||||||
for (auto s : self)
|
for (auto s : self)
|
||||||
if (interval.Contains(Center(s)))
|
if (interval.Contains(Center(s), GetBoundingBox(s).Diam() * 1e-7))
|
||||||
selected.push_back(s);
|
selected.push_back(s);
|
||||||
return selected;
|
return selected;
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user