| 274 | "); |
| 275 | |
| 276 | static PyObject * |
| 277 | Geom_point_inside(PyObject* self, PyObject* args, PyObject* kwargs) |
| 278 | { |
| 279 | //std::cout << "========== Geom_point_inside ==========" << std::endl; |
| 280 | auto api = PyUtilApiFunction("OO!", PyRunTimeErr, __func__); |
| 281 | static char *keywords[] = {"polydata", "point", NULL}; |
| 282 | PyObject* pdObj; |
| 283 | PyObject* pointArg; |
| 284 | |
| 285 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &pdObj, &PyList_Type, &pointArg)) { |
| 286 | return api.argsError(); |
| 287 | } |
| 288 | |
| 289 | // Get the vtkPolyData object from the Python object. |
| 290 | auto polydata = GetVtkPolyData(api, pdObj); |
| 291 | if (polydata == nullptr) { |
| 292 | return nullptr; |
| 293 | } |
| 294 | |
| 295 | // Get the point data. |
| 296 | double point[3]; |
| 297 | std::string emsg; |
| 298 | if (!PyUtilGetPointData<double>(pointArg, emsg, point)) { |
| 299 | api.error("The point argument " + emsg); |
| 300 | return nullptr; |
| 301 | } |
| 302 | |
| 303 | // Result is -1 if the point is outside, 1 if it is inside. |
| 304 | cvPolyData cvPolydata(polydata); |
| 305 | int result; |
| 306 | if (sys_geom_Classify(&cvPolydata, point, &result) != SV_OK) { |
| 307 | api.error("Error classifying a point for the geometry."); |
| 308 | return nullptr; |
| 309 | } |
| 310 | |
| 311 | return Py_BuildValue("N", PyBool_FromLong(result+1)); |
| 312 | } |
| 313 | |
| 314 | //------------------------------- |
| 315 | // Geom_interpolate_closed_curve |
nothing calls this directly
no test coverage detected