---------------------- PyUtilCheckPointData ---------------------- Check Python point data. The point data is a list [x,y,z] of three floats. If there is a problem with the data then the function returns false and a string describing the problem.
| 233 | // a string describing the problem. |
| 234 | // |
| 235 | bool PyUtilCheckPointData(PyObject *pointData, std::string& msg) |
| 236 | { |
| 237 | if (!PyList_Check(pointData)) { |
| 238 | msg = "is not a Python list."; |
| 239 | return false; |
| 240 | } |
| 241 | |
| 242 | if (PyList_Size(pointData) != 3) { |
| 243 | msg = "is not a 3D point (three float values)."; |
| 244 | return false; |
| 245 | } |
| 246 | |
| 247 | for (int i = 0; i < 3; i++) { |
| 248 | if (!PyFloat_Check(PyList_GetItem(pointData,i))) { |
| 249 | msg = "data at " + std::to_string(i) + " in the list is not a float."; |
| 250 | return false; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | return true; |
| 255 | } |
| 256 | |
| 257 | //------------------------ |
| 258 | // PyUtilConvertPointData |
no outgoing calls
no test coverage detected