Cleanup: improve 2D convex hull

Improve correctness, API, comments, memory usage and performance
of the 2D convex hull calculation.

Pre-requisite for UV packing improvements.

Differential Revision: https://developer.blender.org/D16055
This commit is contained in:
2022-09-25 13:09:44 +13:00
parent 2ead05d738
commit 5c93c37678
3 changed files with 46 additions and 67 deletions

View File

@@ -1465,7 +1465,7 @@ static PyObject *M_Geometry_convex_hull_2d(PyObject *UNUSED(self), PyObject *poi
int *index_map;
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 */
len_ret = BLI_convexhull_2d(points, len, index_map);