points = [rand(2) for _ in 1:1000]
points2 = [Meshes.Point(p...) for p in points]
chul = convexhull(points2)
coords=[[vert.coords.x.val,vert.coords.y.val] for vert in chul.rings[1].vertices]
push!(coords,coords[1])
lines(Point2f.(coords))
I assume there is a nicer way to convert back to regulat floats as opposed to: coords=[[vert.coords.x.val,vert.coords.y.val] for vert in chul.rings[1].vertices]
You need to construct a vector of Point. It is all explained in the docs.
Your example above is accessing internal fields of the point, which is not recommended. Rely on coords(point) to access the coordinates, or on to(point) to get the vector from the origin.
Apologies for giving up and asking on discourse, I had already spent a lot of time (compared to just using convhull in matlab) trying to find a usable convexhull function in Julia…the first two packages I tried gave errors when I added them…
Although shouldn’t the input types of the function be in its docstring? Upon reading ?convexhull I gave up pretty quickly. I appreciate it is somewhere in the docs.