Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/mathutils/mathutils_geometry.c
| Show First 20 Lines • Show All 1,459 Lines • ▼ Show 20 Lines | static PyObject *M_Geometry_convex_hull_2d(PyObject *UNUSED(self), PyObject *pointlist) | ||||
| if (len == -1) { | if (len == -1) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (len) { | if (len) { | ||||
| int *index_map; | int *index_map; | ||||
| Py_ssize_t len_ret, i; | Py_ssize_t len_ret, i; | ||||
| index_map = MEM_mallocN(sizeof(*index_map) * len * 2, __func__); | index_map = MEM_mallocN(sizeof(*index_map) * len, __func__); | ||||
| /* Non Python function */ | /* Non Python function */ | ||||
| len_ret = BLI_convexhull_2d(points, len, index_map); | len_ret = BLI_convexhull_2d(points, len, index_map); | ||||
| ret = PyList_New(len_ret); | ret = PyList_New(len_ret); | ||||
| for (i = 0; i < len_ret; i++) { | for (i = 0; i < len_ret; i++) { | ||||
| PyList_SET_ITEM(ret, i, PyLong_FromLong(index_map[i])); | PyList_SET_ITEM(ret, i, PyLong_FromLong(index_map[i])); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 328 Lines • Show Last 20 Lines | |||||