| 169 | "); |
| 170 | |
| 171 | static PyObject * |
| 172 | Geom_align_profile(PyObject* self, PyObject* args, PyObject* kwargs) |
| 173 | { |
| 174 | //std::cout << "========== Geom_align_profile ==========" << std::endl; |
| 175 | auto api = PyUtilApiFunction("OO|O!", PyRunTimeErr, __func__); |
| 176 | static char *keywords[] = {"reference", "align", "use_distance", NULL}; |
| 177 | PyObject* refObj; |
| 178 | PyObject* alignObj; |
| 179 | PyObject* distArg; |
| 180 | |
| 181 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &refObj, &alignObj, &PyBool_Type, &distArg)) { |
| 182 | return api.argsError(); |
| 183 | } |
| 184 | auto use_distance = PyObject_IsTrue(distArg); |
| 185 | |
| 186 | // Get the vtkPolyData objects from the Python objects. |
| 187 | // |
| 188 | auto refPolydata = GetVtkPolyData(api, refObj); |
| 189 | if (refPolydata== nullptr) { |
| 190 | return nullptr; |
| 191 | } |
| 192 | cvPolyData refCvPolyData(refPolydata); |
| 193 | |
| 194 | auto alignPolydata = GetVtkPolyData(api, alignObj); |
| 195 | if (alignPolydata== nullptr) { |
| 196 | return nullptr; |
| 197 | } |
| 198 | cvPolyData alignCvPolyData(alignPolydata); |
| 199 | |
| 200 | // Align the profiles. |
| 201 | // |
| 202 | cvPolyData *result; |
| 203 | if (use_distance) { |
| 204 | result = sys_geom_AlignByDist(&refCvPolyData, &alignCvPolyData); |
| 205 | } else { |
| 206 | result = sys_geom_Align(&refCvPolyData, &alignCvPolyData); |
| 207 | } |
| 208 | |
| 209 | if (result == nullptr) { |
| 210 | api.error("The aligning profile operation failed."); |
| 211 | return nullptr; |
| 212 | } |
| 213 | |
| 214 | return vtkPythonUtil::GetObjectFromPointer(result->GetVtkPolyData()); |
| 215 | } |
| 216 | |
| 217 | //-------------------- |
| 218 | // Geom_average_point |
nothing calls this directly
no test coverage detected