# A GraphicsMeshConvexHull[] peculiarity

I have been unable to explain the behavior of GraphicsMeshConvexHull[] on the following (highly simplified) example:

pts = {{-1/6, -1/18}, {-4/31, 1/9}, {-1/26, -12/73},
{1/6, 2/37}, {1/26, 12/73}, {4/31, -1/9}};

GraphicsMeshMeshInit[];

idx = ConvexHull[pts];

idx2 = Most[First[FindCurvePath[pts]]];

GraphicsRow[{Graphics[Line[pts]], Graphics[Line[pts[[idx]]]], Graphics[Line[pts[[idx2]]]]}]


I get the following result on my system (version 8.0.4 on Linux, if it matters):

As you can see, ConvexHull[] does not seem to work properly on my set of points, while FindCurvePath[] has no problem. However, I had wanted to use ConvexHull[] because it consistently orders points in an anticlockwise manner (or at the very least it seems to), while FindCurvePath[] sometimes orders points clockwise. I can break down and just implement the Graham scan myself, but I'd prefer to understand why the hidden convex hull routine is not behaving in the manner I expect.

-
Why are you bothering with GraphicsMesh? –  m_goldberg Feb 26 '13 at 6:30
See my comment to your answer. –  Carlos Culo Feb 26 '13 at 6:31
Is GraphicsMesh documented somewhere? –  belisarius Feb 26 '13 at 12:12

I can not reproduce your problem. When I carry out the following evaluations

Needs@"ComputationalGeometry"

GraphicsRow@{
Graphics[Line@pts],
Graphics[Line@pts[[ConvexHull[pts]]]]}


I get

-
As I mentioned in my post, I was using GraphicsMeshConvexHull[] and not the implementation from the Computational Geometry package (I am aware of that, but due to a number of reasons, I prefer not to have to load a package)... –  Carlos Culo Feb 26 '13 at 6:30
@CarlosCulo. If that's the case, then you are probably stick with the behavior you observe. –  m_goldberg Feb 26 '13 at 7:12