| 859 | "); |
| 860 | |
| 861 | static PyObject * |
| 862 | Geom_intersect(PyObject* self, PyObject* args) |
| 863 | { |
| 864 | auto api = PyUtilApiFunction("sss|d", PyRunTimeErr, __func__); |
| 865 | char *aName; |
| 866 | char *bName; |
| 867 | char *dstName; |
| 868 | double tolerance = 1e-6; |
| 869 | |
| 870 | if (!PyArg_ParseTuple(args, api.format, &aName, &bName, &dstName, &tolerance)) { |
| 871 | return api.argsError(); |
| 872 | } |
| 873 | |
| 874 | // Retrieve operands geometry. |
| 875 | auto srcA = GetRepositoryGeometry(api, aName); |
| 876 | if (srcA == nullptr ) { |
| 877 | return nullptr; |
| 878 | } |
| 879 | auto srcB = GetRepositoryGeometry(api, bName); |
| 880 | if (srcB == nullptr ) { |
| 881 | return nullptr; |
| 882 | } |
| 883 | |
| 884 | if (RepositoryGeometryExists(api, dstName)) { |
| 885 | return nullptr; |
| 886 | } |
| 887 | |
| 888 | cvPolyData *dst; |
| 889 | if (sys_geom_intersect(srcA, srcB, tolerance, &dst) != SV_OK) { |
| 890 | api.error("Error performing a Boolean intersection of geometry '" + std::string(aName) + " with '" + std::string(bName)+ "."); |
| 891 | return nullptr; |
| 892 | } |
| 893 | |
| 894 | if (!AddGeometryToRepository(api, dstName, dst)) { |
| 895 | return nullptr; |
| 896 | } |
| 897 | |
| 898 | return Py_BuildValue("s",dst->GetName()); |
| 899 | } |
| 900 | |
| 901 | //--------------- |
| 902 | // Geom_subtract |
nothing calls this directly
no test coverage detected