I'm fairly new to Mathematica (and programming in general tbh) and need this for a math project I'm working on.
I generate large collections of (rational, 2d) points and need to find which of these points are the vertices of the convex hull.
Some googling suggested that MeshCoordinates
would do this, but it does not exclude points on the edges of the convex hull that are collinear with the vertices. It also gives rounded decimals but that is less of an issue.
Is there a simple way to do this?
Edit to include a simplified example, the vertices of the unit square with a redundant point ({1, .5}
):
pts = {{0, 0}, {1, 0}, {0, 1}, {1, 1}, {1, .5}}
Both MeshCoordinates[ConvexHullMesh[pts]]
and ConvexHullMesh[pts]["VertexCoordinates"]
return the point {1, .5}
, which is clearly not a vertex of the unit square.
The points I'm generating are not random, they are the result of a fairly involved set of calculations and many of them can be collinear.
MeshCoordinates
. It actually seems to do exactly what you need. Could you show an example where you see extra points being added? $\endgroup$