Get indices of points in convex hull

LazySets.jl contains the function convex_hull. to get the points that form the convex hull of a set of points.

julia> x = rand(10); y = rand(10);

julia> t = map(x, y) do xi, yi
           [xi, yi]
       end;

julia> h = convex_hull(t)
7-element Vector{Vector{Float64}}:
 [0.27874509698405914, 0.8381264273624781]
 [0.4204741719144459, 0.27569852706323217]
 [0.47489782426354443, 0.22189599344415556]
 [0.8408411037903044, 0.08270095905730068]
 [0.9695545294784288, 0.08977018366438483]
 [0.7769612361366431, 0.6925328658255991]
 [0.44161422504009307, 0.8354916368597441]

Is there any way to get the indices of these points, rather than the points themselves?

There isn’t, but you could use the built-in indexin function between t and h.

As an alternative, this lightweight package can give you the indices. GitHub - jw3126/ConvexHulls2d.jl: Simple and lightweight convex hull in 2d