mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
more features of DirectionalInterval
This commit is contained in:
parent
2dc506fcfd
commit
bd5699d5f1
@ -34,6 +34,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DirectionalInterval Intersect (const DirectionalInterval & i2)
|
||||||
|
{
|
||||||
|
DirectionalInterval res = *this;
|
||||||
|
res.minval = max(res.minval, i2.minval);
|
||||||
|
res.maxval = min(res.maxval, i2.maxval);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
bool Contains (gp_Pnt p, double eps = 1e-8)
|
bool Contains (gp_Pnt p, double eps = 1e-8)
|
||||||
{
|
{
|
||||||
// cout << "Contains point " << p.X() << "," << p.Y() << "," << p.Z() << " ? " << endl;
|
// cout << "Contains point " << p.X() << "," << p.Y() << "," << p.Z() << " ? " << endl;
|
||||||
|
@ -321,6 +321,13 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m)
|
|||||||
|
|
||||||
|
|
||||||
py::class_<DirectionalInterval> (m, "DirectionalInterval")
|
py::class_<DirectionalInterval> (m, "DirectionalInterval")
|
||||||
|
.def("__str__", [](DirectionalInterval self)
|
||||||
|
{
|
||||||
|
stringstream str;
|
||||||
|
str << "(" << self.minval << ", " << self.maxval << ")";
|
||||||
|
return str.str();
|
||||||
|
})
|
||||||
|
|
||||||
.def("__lt__", [](DirectionalInterval i, double val)
|
.def("__lt__", [](DirectionalInterval i, double val)
|
||||||
{
|
{
|
||||||
cout << "directionalinterval, lt, imin/max = " << i.minval << " / " << i.maxval << endl;
|
cout << "directionalinterval, lt, imin/max = " << i.minval << " / " << i.maxval << endl;
|
||||||
@ -331,6 +338,10 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m)
|
|||||||
cout << "directionalinterval, gt, imin/max = " << i.minval << " / " << i.maxval << endl;
|
cout << "directionalinterval, gt, imin/max = " << i.minval << " / " << i.maxval << endl;
|
||||||
return i > val;
|
return i > val;
|
||||||
})
|
})
|
||||||
|
.def("__and__", [](DirectionalInterval self, DirectionalInterval other) {
|
||||||
|
cout << "and of intervals" << endl;
|
||||||
|
return self.Intersect(other);
|
||||||
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
py::implicitly_convertible<py::tuple, gp_Pnt>();
|
py::implicitly_convertible<py::tuple, gp_Pnt>();
|
||||||
|
Loading…
Reference in New Issue
Block a user