------------------------------- PyUtilPointVectorDataToPyList ------------------------------- Create a Python list from a vector of 3D points.
| 582 | // Create a Python list from a vector of 3D points. |
| 583 | // |
| 584 | PyObject * |
| 585 | PyUtilPointVectorDataToPyList(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 |
no test coverage detected