Mesh: overload MeshAlgorithm::NearestFacetOnRay to set a max. angle between facet and ray

This commit is contained in:
wmayer
2022-02-13 12:46:01 +01:00
parent 0f2123b175
commit 4e1ce8a15f
3 changed files with 25 additions and 5 deletions

View File

@@ -1830,7 +1830,8 @@ PyObject* MeshPy::nearestFacetOnRay(PyObject *args)
{
PyObject* pnt_p;
PyObject* dir_p;
if (!PyArg_ParseTuple(args, "OO", &pnt_p, &dir_p))
double maxAngle = MeshCore::Mathd::PI;
if (!PyArg_ParseTuple(args, "OO|d", &pnt_p, &dir_p, &maxAngle))
return nullptr;
try {
@@ -1854,7 +1855,7 @@ PyObject* MeshPy::nearestFacetOnRay(PyObject *args)
if (alg.NearestFacetOnRay(pnt, dir, grid, res, index) ||
alg.NearestFacetOnRay(pnt, -dir, grid, res, index)) {
#else
if (alg.NearestFacetOnRay(pnt, dir, res, index)) {
if (alg.NearestFacetOnRay(pnt, dir, static_cast<float>(maxAngle), res, index)) {
#endif
Py::Tuple tuple(3);
tuple.setItem(0, Py::Float(res.x));