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

Function Geom_average_point

Code/Source/PythonAPI/Geometry_PyModule.cxx:233–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231");
232
233static PyObject *
234Geom_average_point(PyObject* self, PyObject* args)
235{
236 auto api = PyUtilApiFunction("O", PyRunTimeErr, __func__);
237 PyObject* pdObj;
238
239 if (!PyArg_ParseTuple(args, api.format, &pdObj)) {
240 return api.argsError();
241 }
242
243 // Get the vtkPolyData object from the Python object.
244 auto polydata = GetVtkPolyData(api, pdObj);
245 if (polydata == nullptr) {
246 return nullptr;
247 }
248
249 double pt[3];
250 cvPolyData cvPolydata(polydata);
251 if (sys_geom_AvgPt(&cvPolydata, pt) != SV_OK) {
252 api.error("Error calculating the average point for the polydata.");
253 return nullptr;
254 }
255
256 return Py_BuildValue("[d,d,d]", pt[0], pt[1], pt[2]);
257}
258
259//---------------------
260// Geom_classify_point

Callers

nothing calls this directly

Calls 4

sys_geom_AvgPtFunction · 0.85
argsErrorMethod · 0.80
errorMethod · 0.80
GetVtkPolyDataFunction · 0.70

Tested by

no test coverage detected