mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-03 16:50:34 +05:00
fix occ - Nearest
This commit is contained in:
parent
74192981cf
commit
8dfdfb9579
@ -127,9 +127,11 @@ public:
|
|||||||
for (auto shape : *this)
|
for (auto shape : *this)
|
||||||
{
|
{
|
||||||
double dist = BRepExtrema_DistShapeShape(shape, vertex).Value();
|
double dist = BRepExtrema_DistShapeShape(shape, vertex).Value();
|
||||||
// cout << "dist = " << dist << endl;
|
|
||||||
if (dist < mindist)
|
if (dist < mindist)
|
||||||
nearestshape = shape;
|
{
|
||||||
|
nearestshape = shape;
|
||||||
|
mindist = dist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nearestshape;
|
return nearestshape;
|
||||||
}
|
}
|
||||||
@ -1627,6 +1629,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
.def("Nearest", [] (ListOfShapes & shapes, gp_Pnt pnt)
|
.def("Nearest", [] (ListOfShapes & shapes, gp_Pnt pnt)
|
||||||
{ return CastShape(shapes.Nearest(pnt)); },
|
{ return CastShape(shapes.Nearest(pnt)); },
|
||||||
py::arg("p"), "returns shape nearest to point 'p'")
|
py::arg("p"), "returns shape nearest to point 'p'")
|
||||||
|
.def("Nearest", [] (ListOfShapes & shapes, gp_Pnt2d pnt)
|
||||||
|
{ return CastShape(shapes.Nearest( { pnt.X(), pnt.Y(), 0 })); },
|
||||||
|
py::arg("p"), "returns shape nearest to point 'p'")
|
||||||
|
|
||||||
.def_property("name", [](ListOfShapes& shapes)
|
.def_property("name", [](ListOfShapes& shapes)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user