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

Function PyUtilPointVectorDataToPyList

Code/Source/PythonAPI/PyUtils.cxx:584–601  ·  view source on GitHub ↗

------------------------------- PyUtilPointVectorDataToPyList ------------------------------- Create a Python list from a vector of 3D points.

Source from the content-addressed store, hash-verified

582// Create a Python list from a vector of 3D points.
583//
584PyObject *
585PyUtilPointVectorDataToPyList(const std::vector<std::array<double,3>>& points)
586{
587 auto pointList = PyList_New(points.size());
588 int n = 0;
589
590 for (auto const& point : points) {
591 auto pointValues = PyList_New(3);
592 for (int i = 0; i < 3; i++) {
593 auto val = PyFloat_FromDouble((double)point[i]);
594 PyList_SetItem(pointValues, i, val);
595 }
596 PyList_SetItem(pointList, n, pointValues);
597 n += 1;
598 }
599
600 return Py_BuildValue("N", pointList);
601}
602
603//--------------------------------
604// PyUtilComputeNormalFromlPoints

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected