diff options
Diffstat (limited to 'source/blender/blenlib/intern/convexhull2d.c')
-rw-r--r-- | source/blender/blenlib/intern/convexhull2d.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/convexhull2d.c b/source/blender/blenlib/intern/convexhull2d.c index 5669a302bd8..2c29ef042a1 100644 --- a/source/blender/blenlib/intern/convexhull2d.c +++ b/source/blender/blenlib/intern/convexhull2d.c @@ -191,6 +191,8 @@ static int pointref_cmp_y(const void *a_, const void *b_) * \param points An array of 2D points. * \param n The number of points in points. * \param r_points An array of the convex hull vertex indices (max is n). + * _must_ be allocated as ``n * 2`` becauise of how its used internally, + * even though the final result will be no more then \a n in size. * \returns the number of points in r_points. */ int BLI_convexhull_2d(const float (*points)[2], const int n, int r_points[]) @@ -310,7 +312,7 @@ float BLI_convexhull_aabb_fit_points_2d(const float (*points)[2], unsigned int n float angle; - index_map = MEM_mallocN(sizeof(*index_map) * n, __func__); + index_map = MEM_mallocN(sizeof(*index_map) * n * 2, __func__); tot = BLI_convexhull_2d((const float (*)[2])points, (int)n, index_map); |