MCPcopy Create free account
hub / github.com/SimVascular/SimVascular / Geom_align_profile

Function Geom_align_profile

Code/Source/PythonAPI/Geometry_PyModule.cxx:171–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169");
170
171static PyObject *
172Geom_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

Callers

nothing calls this directly

Calls 6

sys_geom_AlignByDistFunction · 0.85
sys_geom_AlignFunction · 0.85
argsErrorMethod · 0.80
errorMethod · 0.80
GetVtkPolyDataFunction · 0.70
GetVtkPolyDataMethod · 0.45

Tested by

no test coverage detected